dhcp: fork in background

This commit is contained in:
Jörg Thalheim 2015-01-01 21:02:33 +01:00
parent e37e5ec635
commit 16f7b622c0

18
tinc-up
View File

@ -68,14 +68,24 @@ set_ip() {
fi
}
start_dhclient() {
local interface=$1
if [[ "$OSTYPE" == "linux-gnu" ]]; then
dhclient -nw "$interface"
elif [[ "$OSTYPE" == "freebsd"* ]]; then
dhclient -b "$interface"
else
nohup setsid dhclient "$interface" >/dev/null 2>&1
fi
}
start_dhcp() {
local interface=$1
if has dhcpcd; then
dhcpcd "$interface"
dhcpcd -b -n "$interface"
elif has dhclient; then
dhclient "$interface"
elif [[ "$OSTYPE" == "darwin"* ]]; then # TODO
untested
start_dhclient "$interface"
elif [[ "$OSTYPE" == "darwin"* ]]; then # TODO untested
ipconfig set "$interface" DHCP
else
die "no suitable dhcp program found, need dhcpcd or dhclient"