diff options
author | Mike Crute <mike@crute.us> | 2019-01-11 03:58:23 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2019-01-11 03:58:23 +0000 |
commit | 9dea8c2e5af9c2275e49f452ab19c885c0bae58f (patch) | |
tree | 4d3f61588d27321c74b72b933b7893cd269a9432 /unifi-video | |
parent | 0a3db0288ef8c297e4e19421a0e1211650aba104 (diff) | |
download | dockerfiles-9dea8c2e5af9c2275e49f452ab19c885c0bae58f.tar.bz2 dockerfiles-9dea8c2e5af9c2275e49f452ab19c885c0bae58f.tar.xz dockerfiles-9dea8c2e5af9c2275e49f452ab19c885c0bae58f.zip |
Conditionally add users and groups
Diffstat (limited to 'unifi-video')
-rwxr-xr-x | unifi-video/entrypoint.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/unifi-video/entrypoint.sh b/unifi-video/entrypoint.sh index e0740d1..f4974c4 100755 --- a/unifi-video/entrypoint.sh +++ b/unifi-video/entrypoint.sh | |||
@@ -19,9 +19,13 @@ fi | |||
19 | 19 | ||
20 | cd ${BASEDIR} | 20 | cd ${BASEDIR} |
21 | 21 | ||
22 | # Create the user and group | 22 | # Create the user and group if they don't exist |
23 | addgroup -g ${UNIFI_GID} -S ${USERNAME} | 23 | if ! grep "^${USERNAME}:" /etc/group 2>&1>/dev/null; then |
24 | adduser -u ${UNIFI_UID} -S -h /var/lib/${USERNAME} -H -D -G ${USERNAME} ${USERNAME} | 24 | addgroup -g ${UNIFI_GID} -S ${USERNAME} |
25 | fi | ||
26 | if ! grep "^${USERNAME}:" /etc/passwd 2>&1>/dev/null; then | ||
27 | adduser -u ${UNIFI_UID} -S -h /var/lib/${USERNAME} -H -D -G ${USERNAME} ${USERNAME} | ||
28 | fi | ||
25 | 29 | ||
26 | # Update permissions on the root directories | 30 | # Update permissions on the root directories |
27 | chown ${USERNAME}:${USERNAME} \ | 31 | chown ${USERNAME}:${USERNAME} \ |