aboutsummaryrefslogtreecommitdiffstats
path: root/templates/usr_local_bin_gen_dhclient_conf.sh.j2
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-07-10 12:11:58 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-07-10 12:11:58 +0300
commit95466bf02741b67134ccb34163659a7a9c299c43 (patch)
treed08c6fa3f20fef9fcbcd5f9eae0c1d88edd090d6 /templates/usr_local_bin_gen_dhclient_conf.sh.j2
parentffd25cdb04f6a40bc9b95afd507042717b2f7fc5 (diff)
Fix wan0 dhcp issues by removing defaultrouter sysrc
Diffstat (limited to 'templates/usr_local_bin_gen_dhclient_conf.sh.j2')
-rw-r--r--templates/usr_local_bin_gen_dhclient_conf.sh.j238
1 files changed, 0 insertions, 38 deletions
diff --git a/templates/usr_local_bin_gen_dhclient_conf.sh.j2 b/templates/usr_local_bin_gen_dhclient_conf.sh.j2
deleted file mode 100644
index 8c05f70..0000000
--- a/templates/usr_local_bin_gen_dhclient_conf.sh.j2
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-set -eu
-
-IP=$(ifconfig wan0 | awk '/inet / {print $2}' | head -n1)
-HOSTNAME=$(hostname)
-CONFFILE=/etc/dhclient.conf
-NEWFILE=$(mktemp)
-if [ -f "${CONFFILE}" ]; then
- OLDHASH=$(md5 -q "${CONFFILE}")
-else
- OLDHASH="doesnotexist"
-fi
-
-cat <<EOF > "${NEWFILE}"
-# This file is generated by $0 periodically.
-# Changes will be overwritten.
-
-interface "wan0" {
- send host-name "${HOSTNAME}";
-EOF
-
-if [ ! -z "$IP" ]; then
-cat <<EOF >> "${NEWFILE}"
- send dhcp-requested-address $IP;
-EOF
-fi
-
-echo "}" >> "${NEWFILE}"
-
-mv "${NEWFILE}" "${CONFFILE}"
-
-# If changed, restart dhclient wan0
-md5 -c "${OLDHASH}" "${CONFFILE}" 1>/dev/null 2>/dev/null
-if [ ! "$?" = 0 ]; then
- echo "Generated ${CONFFILE} has changed, restarting dhclient on wan0 (IP: ${IP})"
- service dhclient restart wan0
-fi