From 4e9851769af83015b1b4ab5e12c4d60c117c1440 Mon Sep 17 00:00:00 2001 From: mrazzoli-elemento Date: Tue, 17 Dec 2024 16:28:15 +0100 Subject: [PATCH] workaround for usermod's unreliable behaviour in container See https://github.com/cytopia/devilbox/issues/703#issuecomment-727190879 for more details --- util/entrypoint.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/entrypoint.sh b/util/entrypoint.sh index f9ae107..6ecb81c 100755 --- a/util/entrypoint.sh +++ b/util/entrypoint.sh @@ -2,7 +2,6 @@ set -e - # Support docker run --init parameter which obsoletes the use of dumb-init, # but support dumb-init for those that still use it without --init if [ $$ -eq 1 ]; then @@ -52,8 +51,8 @@ if [ -n "$IFACE" ]; then uid=$(stat -c%u "$data_dir") gid=$(stat -c%g "$data_dir") groupmod -og $gid dhcpd - usermod -ou $uid dhcpd - + usermod -ou $uid dhcpd || usermod -ou $uid dhcpd # first attempt could fail, see https://github.com/cytopia/devilbox/issues/703#issuecomment-727190879 + [ -e "$data_dir/dhcpd.leases" ] || touch "$data_dir/dhcpd.leases" chown dhcpd:dhcpd "$data_dir/dhcpd.leases" if [ -e "$data_dir/dhcpd.leases~" ]; then