aboutsummaryrefslogtreecommitdiffstats
path: root/dhcpcd-run-hooks
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commite95877ecfa1170d77b1ec1f66752725cdda01b64 (patch)
tree81940f62fdf7891f127a1d1ffa712ac1ea1c4c5c /dhcpcd-run-hooks
downloadexternal_dhcpcd-e95877ecfa1170d77b1ec1f66752725cdda01b64.zip
external_dhcpcd-e95877ecfa1170d77b1ec1f66752725cdda01b64.tar.gz
external_dhcpcd-e95877ecfa1170d77b1ec1f66752725cdda01b64.tar.bz2
Initial Contribution
Diffstat (limited to 'dhcpcd-run-hooks')
-rwxr-xr-xdhcpcd-run-hooks38
1 files changed, 38 insertions, 0 deletions
diff --git a/dhcpcd-run-hooks b/dhcpcd-run-hooks
new file mode 100755
index 0000000..83534be
--- /dev/null
+++ b/dhcpcd-run-hooks
@@ -0,0 +1,38 @@
+#!/system/bin/sh
+# dhcpcd client configuration script
+
+# Handy functions for our hooks to use
+signature="# Generated by dhcpcd for ${interface}"
+save_conf()
+{
+ if ls "$1" >/dev/null 2>&1; then
+ rm -f "$1"-pre."${interface}"
+ mv -f "$1" "$1"-pre."${interface}"
+ fi
+}
+restore_conf()
+{
+ ls "$1"-pre."${interface}" >/dev/null 2>&1 || return 1
+ rm -f "$1"
+ mv -f "$1"-pre."${interface}" "$1"
+}
+
+# We source each script into this one so that scripts run earlier can
+# remove variables from the environment so later scripts don't see them.
+# Thus, the user can create their dhcpcd.hook script to configure
+# /etc/resolv.conf how they want and stop the system scripts ever updating it.
+for hook in \
+ /system/etc/dhcpcd/dhcpcd.hook \
+ /system/etc/dhcpcd/dhcpcd-hooks/*
+do
+ for skip in ${skip_hooks}; do
+ case "${hook}" in
+ "${skip}") continue 2;;
+ */[0-9][0-9]"-${skip}") continue 2;;
+ */[0-9][0-9]"-${skip}.sh") continue 2;;
+ esac
+ done
+ if ls "${hook}" >/dev/null 2>&1; then
+ . "${hook}"
+ fi
+done