summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild5
-rwxr-xr-xsrc.usr/share/udhcpc/default.script32
2 files changed, 37 insertions, 0 deletions
diff --git a/build b/build
index ca8e05d..401d9d3 100755
--- a/build
+++ b/build
@@ -59,5 +59,10 @@ install: build
install -d -m 0755 dest/var/www; \
install -p -m 0644 ../src.var/www/index.html \
dest/var/www/index.html; \
+ fi; \
+ if config_enabled UDHCPC; then \
+ install -d -m 0755 dest/usr/share/udhcpc; \
+ install -p -m 0644 ../src.usr/share/udhcpc/default.script \
+ dest/usr/share/udhcpc/default.script; \
fi
oh-installfiles
diff --git a/src.usr/share/udhcpc/default.script b/src.usr/share/udhcpc/default.script
new file mode 100755
index 0000000..2f65e45
--- /dev/null
+++ b/src.usr/share/udhcpc/default.script
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+case "${1}" in
+ 'deconfig')
+ /sbin/ifconfig "${interface}" 0.0.0.0
+ ;;
+ 'renew' | 'bound')
+ /sbin/ifconfig "${interface}" "${ip}" \
+ ${broadcast+broadcast ${broadcast}} \
+ ${netmask+netmask ${netmask}}
+ if [ "x${router+set}" = 'xset' ]; then
+ while /sbin/route del default gw 0.0.0.0 \
+ dev "${interface}" 2>/dev/null; do
+ :
+ done
+ for router in ${router}; do
+ /sbin/route add default gw "${router}" \
+ dev "${interface}"
+ done
+ fi
+ exec 3>'/etc/resolv.conf'
+ if [ "x${domain+set}" = 'xset' ]; then
+ printf 'search %s\n' "${domain}" >&3
+ fi
+ for dns in ${dns}; do
+ printf 'nameserver %s\n' "${dns}" >&3
+ done
+ exec 3>&-
+ ;;
+esac
+
+exit 0