fi
# Debian as a seperate file for DHCP config to avoid stamping on
# the master.
+ [ -e /var/lib/ntp ] || mkdir /var/lib/ntp
: ${NTP_DHCP_CONF:=/var/lib/ntp/ntp.conf.dhcp}
elif [ -x /etc/rc.d/ntpd ]; then
ntpd_restart_cmd="/etc/rc.d/ntpd status >/dev/null 2>&1 && /etc/rc.d/ntpd restart"
echo "$signature_base${header:+ $from }$header" >> "$cf"
printf "$search$servers" >> "$cf"
echo "$signature_base_end${header:+ $from }$header" >> "$cf"
+ else
+ [ -e "$ntp_conf" ] || return
fi
# If we changed anything, restart ntpd
# If different, replace first with second otherwise remove second
change_file()
{
- if type cmp >/dev/null 2>&1; then
- cmp -s "$1" "$2"
- elif type diff >/dev/null 2>&1; then
- diff -q "$1" "$2" >/dev/null
- else
- # Hopefully we're only working on small text files ...
- [ "$(cat "$1")" = "$(cat "$2")" ]
- fi
- if [ $? -eq 0 ]; then
- rm -f "$2"
- return 1
+ if [ -e "$1" ]; then
+ if type cmp >/dev/null 2>&1; then
+ cmp -s "$1" "$2"
+ elif type diff >/dev/null 2>&1; then
+ diff -q "$1" "$2" >/dev/null
+ else
+ # Hopefully we're only working on small text files ...
+ [ "$(cat "$1")" = "$(cat "$2")" ]
+ fi
+ if [ $? -eq 0 ]; then
+ rm -f "$2"
+ return 1
+ fi
fi
cat "$2" > "$1"
rm -f "$2"