procd_set_param command "$PROG" -n -N
if [ "$enable_server" = "1" ]; then
procd_append_param command -l
- [ -n "$interface" ] && procd_append_param command -I $interface
+ [ -n "$interface" ] && {
+ local ifname
+
+ network_get_device ifname "$interface" || \
+ ifname="$interface"
+ procd_append_param command -I "$ifname"
+ procd_append_param netdev "$ifname"
+ }
fi
[ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S "$HOTPLUG_SCRIPT"
for peer in $server; do
}
start_service() {
+ . /lib/functions/network.sh
validate_ntp_section ntp start_ntpd_instance
}
service_triggers() {
- local script name use_dhcp
+ local script name use_dhcp enable_server interface
script=$(readlink -f "$initscript")
name=$(basename ${script:-$initscript})
fi
}
+ config_get_bool enable_server ntp enable_server 0
+ config_get interface ntp interface
+
+ [ $enable_server -eq 1 ] && [ -n "$interface" ] && {
+ local ifname
+
+ network_get_device ifname "$interface" || \
+ ifname="$interface"
+ procd_add_interface_trigger "interface.*" "$ifname" \
+ /etc/init.d/"$name" reload
+ }
+
procd_add_validation validate_ntp_section
}