diff --git a/tools/systemvm/debian/config/root/edithosts.sh b/tools/systemvm/debian/config/root/edithosts.sh index 5193376b8b5..0f2cca229bc 100755 --- a/tools/systemvm/debian/config/root/edithosts.sh +++ b/tools/systemvm/debian/config/root/edithosts.sh @@ -5,11 +5,11 @@ # $3 : the hostname wait_for_dnsmasq () { - local _pid=$(/sbin/pidof dnsmasq) + local _pid=$(pidof dnsmasq) for i in 0 1 2 3 4 5 6 7 8 9 10 do sleep 1 - _pid=$(/sbin/pidof dnsmasq) + _pid=$(pidof dnsmasq) [ "$_pid" != "" ] && break; done [ "$_pid" != "" ] && return 0; @@ -17,6 +17,9 @@ wait_for_dnsmasq () { return 1 } +[ ! -f /etc/dhcphosts.txt ] && touch /etc/dhcphosts.txt +[ ! -f /var/lib/misc/dnsmasq.leases ] && touch /var/lib/misc/dnsmasq.leases + #delete any previous entries from the dhcp hosts file sed -i /$1/d /etc/dhcphosts.txt sed -i /$2,/d /etc/dhcphosts.txt @@ -39,7 +42,7 @@ sed -i /"$3"/d /etc/hosts echo "$2 $3" >> /etc/hosts # make dnsmasq re-read files -pid=$(/sbin/pidof dnsmasq) +pid=$(pidof dnsmasq) if [ "$pid" != "" ] then service dnsmasq restart