Skip to content

Commit

Permalink
Fix minor issues
Browse files Browse the repository at this point in the history
* Remove BIND_PRIV handling since there is no need for it according to jacobalberty#362
* Add functionality to ensure that system.properties file is always created, even if no settings are actally written
* Backport permset handling from master
  • Loading branch information
boureei committed Jul 19, 2023
1 parent 0323da3 commit 274f006
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fi

UNIFI_CMD="java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start"

if command -v permset &> /dev/null
if [ "$EUID" -ne 0 ] && command -v permset &> /dev/null
then
permset
fi
Expand All @@ -182,6 +182,9 @@ if [[ "${@}" == "unifi" ]]; then
mkdir -p "${dir}"
fi
done
if [[ "$newfile" == "true" ]]; then
touch "$confFile"
fi
for key in "${!settings[@]}"; do
confSet "$confFile" "$key" "${settings[$key]}"
done
Expand All @@ -191,16 +194,6 @@ if [[ "${@}" == "unifi" ]]; then
fi
${UNIFI_CMD} &
elif [ "${RUNAS_UID0}" == "false" ]; then
if [ "${BIND_PRIV}" == "true" ]; then
if setcap 'cap_net_bind_service=+ep' "${JAVA_HOME}/jre/bin/java"; then
sleep 1
else
log "ERROR: setcap failed, can not continue"
log "ERROR: You may either launch with -e BIND_PRIV=false and only use ports >1024"
log "ERROR: or run this container as root with -e RUNAS_UID0=true"
exit 1
fi
fi
if [ "$(id unifi -u)" != "${UNIFI_UID}" ] || [ "$(id unifi -g)" != "${UNIFI_GID}" ]; then
log "INFO: Changing 'unifi' UID to '${UNIFI_UID}' and GID to '${UNIFI_GID}'"
usermod -o -u ${UNIFI_UID} unifi && groupmod -o -g ${UNIFI_GID} unifi
Expand Down

0 comments on commit 274f006

Please sign in to comment.