SHA256
1
0
forked from pool/dhcp
dhcp/dhcp-3.0.6-dhclient-script-ntp-runtime.patch

50 lines
1.4 KiB
Diff

Index: dhcp-3.0.6/client/scripts/linux
===================================================================
--- dhcp-3.0.6.orig/client/scripts/linux
+++ dhcp-3.0.6/client/scripts/linux
@@ -103,6 +103,28 @@ make_resolv_conf() {
done
}
+make_ntp_runtime_conf() {
+ if [ "x$new_ntp_servers" != "x" ]; then
+
+ cat > /var/run/ntp/servers << EOF
+### BEGIN INFO
+#
+# Modified_by: dhclient-script
+# Process: /sbin/dhclient
+# Process_id: $(pidof dhclient)
+# Script: /sbin/dhclient-script
+#
+# Info: This is a temporary autogenerated config by the NTP init script.
+# In the case of a restart these infomrmations are used to
+# configure ntpd during runtime.
+### END INFO
+
+RUNTIME_SERVERS="$new_ntp_servers"
+
+EOF
+ fi
+}
+
function write_informational_resolv_conf_header() {
cat > /etc/resolv.conf << EOF
### BEGIN INFO
@@ -250,6 +272,7 @@ if [ x$reason = xBOUND ] || [ x$reason =
fi
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 1 ) != 1 )); then
make_resolv_conf
+ make_ntp_runtime_conf
eval `grep --no-filename "^DHCLIENT_SET_HOSTNAME=" /etc/sysconfig/network/dhcp`
if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then
@@ -311,6 +334,7 @@ if [ x$reason = xTIMEOUT ]; then
route add default gw $router
done
make_resolv_conf
+ make_ntp_runtime_conf
exit_with_hooks 0
fi
ifconfig $interface inet 0 down