-
Notifications
You must be signed in to change notification settings - Fork 458
/
functions
33 lines (29 loc) · 967 Bytes
/
functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
log() {
echo "$(date +"[%Y-%m-%d %T,%3N]") <docker-entrypoint> $*"
}
set_java_home() {
JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/jre/bin/java::")
if [ ! -d "${JAVA_HOME}" ]; then
# For some reason readlink failed so lets just make some assumptions instead
# We're assuming openjdk 8 since thats what we install in Dockerfile
arch=`dpkg --print-architecture 2>/dev/null`
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${arch}
fi
}
instPkg() {
for pkg in $*; do
if [ $(dpkg-query -W -f='${Status}' "${pkg}" 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
apt-get -qy install "${pkg}";
fi
done
}
# Validate that any included hotfixes have been applied
validate() (
shopt -s nullglob
for i in /usr/local/unifi/hotfixes/*-validate.md5sum; do
md5sum -c "$i" > /dev/null 2>&1 || return 1
echo "Hotfix validated: $(basename ${i::-16})"
done
)