forked from jacobalberty/unifi-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions
More file actions
24 lines (21 loc) · 709 Bytes
/
functions
File metadata and controls
24 lines (21 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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-8-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
}