Sync udhcpc script from RescueOS v1.1

When using the script from this repo, 'udhcpc -i wlan0' would error out
with this:

> Recreating /etc/resolv.conf
> /usr/share/udhcpc/default.script: line 37: /etc/resolv.conf-8352: Read-only file system
>  Adding DNS server 192.168.7.1
> /usr/share/udhcpc/default.script: line 41: /etc/resolv.conf-8352: Read-only file system
> mv: can't rename '/etc/resolv.conf-8352': No such file or directory
This commit is contained in:
Daniel Gnoutcheff 2015-03-30 14:54:05 -04:00
parent 8f1eabb7c9
commit 9f262fde9d

View File

@ -33,14 +33,12 @@ case "$1" in
done
fi
echo "Recreating $RESOLV_CONF"
echo -n > $RESOLV_CONF-$$
[ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$
echo "Setting $RESOLV_CONF"
[ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF
for i in $dns ; do
echo " Adding DNS server $i"
echo "nameserver $i" >> $RESOLV_CONF-$$
echo "nameserver $i" >> $RESOLV_CONF
done
mv $RESOLV_CONF-$$ $RESOLV_CONF
;;
esac