Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit debb6d8

Browse files
committed
Merge branch 'master' into pr/32
2 parents 9f44e7c + 6fd7b18 commit debb6d8

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

util/entrypoint.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ set -e
55

66
# Support docker run --init parameter which obsoletes the use of dumb-init,
77
# but support dumb-init for those that still use it without --init
8-
if [ -x "/dev/init" ]; then
9-
run="exec"
10-
else
8+
if [ $$ -eq 1 ]; then
119
run="exec /usr/bin/dumb-init --"
10+
else
11+
run="exec"
1212
fi
1313

1414
# Single argument to command line is interface name
@@ -51,12 +51,8 @@ if [ -n "$IFACE" ]; then
5151

5252
uid=$(stat -c%u "$data_dir")
5353
gid=$(stat -c%g "$data_dir")
54-
if [ $gid -ne 0 ]; then
55-
groupmod -g $gid dhcpd
56-
fi
57-
if [ $uid -ne 0 ]; then
58-
usermod -u $uid dhcpd
59-
fi
54+
groupmod -og $gid dhcpd
55+
usermod -ou $uid dhcpd
6056

6157
[ -e "$data_dir/dhcpd.leases" ] || touch "$data_dir/dhcpd.leases"
6258
chown dhcpd:dhcpd "$data_dir/dhcpd.leases"
@@ -69,7 +65,7 @@ if [ -n "$IFACE" ]; then
6965
echo "You must add the 'docker run' option '--net=host' if you want to provide DHCP service to the host network."
7066
fi
7167

72-
$run /usr/sbin/dhcpd -$DHCPD_PROTOCOL -f -d --no-pid -cf "$data_dir/dhcpd.conf" -lf "$data_dir/dhcpd.leases" $IFACE
68+
$run /usr/sbin/dhcpd -$DHCPD_PROTOCOL -f -d --no-pid -cf "$data_dir/dhcpd.conf" -lf "$data_dir/dhcpd.leases" -user dhcpd -group dhcpd $IFACE
7369
else
7470
# Run another binary
7571
$run "$@"

0 commit comments

Comments
 (0)