Skip to content

Commit

Permalink
Merge branch 'master' into pr/32
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsmidsrod committed Jul 25, 2022
2 parents 9f44e7c + 6fd7b18 commit debb6d8
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions util/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ 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 [ -x "/dev/init" ]; then
run="exec"
else
if [ $$ -eq 1 ]; then
run="exec /usr/bin/dumb-init --"
else
run="exec"
fi

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

uid=$(stat -c%u "$data_dir")
gid=$(stat -c%g "$data_dir")
if [ $gid -ne 0 ]; then
groupmod -g $gid dhcpd
fi
if [ $uid -ne 0 ]; then
usermod -u $uid dhcpd
fi
groupmod -og $gid dhcpd
usermod -ou $uid dhcpd

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

$run /usr/sbin/dhcpd -$DHCPD_PROTOCOL -f -d --no-pid -cf "$data_dir/dhcpd.conf" -lf "$data_dir/dhcpd.leases" $IFACE
$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
else
# Run another binary
$run "$@"
Expand Down

0 comments on commit debb6d8

Please sign in to comment.