34 lines
967 B
Bash
34 lines
967 B
Bash
#!/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
|
|
)
|