diff options
| author | Roy Marples <roy@marples.name> | 2009-04-20 09:38:08 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-04-20 09:38:08 +0000 |
| commit | 4f06fdc0f91d4a1a5dcc16853bad22501bb3ce70 (patch) | |
| tree | bf0f4ec021bdf31630aeb07bffdd9ae9e1c7b4f0 /dhcpcd-hooks/50-ntp.conf | |
| parent | e77f6a45143343565f3efe06487ccb18dd8dd071 (diff) | |
| download | dhcpcd-4f06fdc0f91d4a1a5dcc16853bad22501bb3ce70.tar.xz | |
Remove old NetworkManager script - it's useless these days.
Remove gratuitous usage of {} in variables.
Diffstat (limited to 'dhcpcd-hooks/50-ntp.conf')
| -rw-r--r-- | dhcpcd-hooks/50-ntp.conf | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf index 2135dc7e..e569cf1e 100644 --- a/dhcpcd-hooks/50-ntp.conf +++ b/dhcpcd-hooks/50-ntp.conf @@ -18,58 +18,58 @@ elif [ -x /usr/local/etc/rc.d/ntpd ]; then ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status && /usr/local/etc/rc.d/ntpd restart" fi -ntp_conf_dir="${state_dir}/ntp.conf" +ntp_conf_dir="$state_dir/ntp.conf" ntp_conf=${NTP_CONF:-/etc/ntp.conf} build_ntp_conf() { - local cf="${state_dir}/ntp.conf.${interface}" + local cf="$state_dir/ntp.conf.$interface" local interfaces= header= srvs= servers= x= # Build a list of interfaces - interfaces=$(list_interfaces "${ntp_conf_dir}") + interfaces=$(list_interfaces "$ntp_conf_dir") - if [ -n "${interfaces}" ]; then + if [ -n "$interfaces" ]; then # Build the header for x in ${interfaces}; do - header="${header}${header:+, }${x}" + header="$header${header:+, }$x" done # Build a server list - srvs=$(cd "${ntp_conf_dir}"; - key_get_value "server " ${interfaces}) - if [ -n "${srvs}" ]; then - for x in $(uniqify ${srvs}); do - servers="${servers}server ${x}\n" + srvs=$(cd "$ntp_conf_dir"; + key_get_value "server " $interfaces) + if [ -n "$srvs" ]; then + for x in $(uniqify $srvs); do + servers="${servers}server $x\n" done fi fi # Merge our config into ntp.conf - [ -e "${cf}" ] && rm -f "${cf}" - remove_markers "${signature_base}" "${signature_base_end}" \ - "${ntp_conf}" > "${cf}" - if [ -n "${servers}" ]; then - echo "${signature_base}${header:+ ${from} }${header}" >> "${cf}" - printf "${search}${servers}" >> "${cf}" - echo "${signature_base_end}${header:+ ${from} }${header}" >> "${cf}" + [ -e "$cf" ] && rm -f "$cf" + remove_markers "$signature_base" "$signature_base_end" \ + "$ntp_conf" > "$cf" + if [ -n "$servers" ]; then + echo "$signature_base${header:+ $from }$header" >> "$cf" + printf "$search$servers" >> "$cf" + echo "$signature_base_end${header:+ $from }$header" >> "$cf" fi # If we changed anything, restart ntpd - if change_file "${ntp_conf}" "${cf}"; then - [ -n "${ntpd_restart_cmd}" ] && eval ${ntpd_restart_cmd} + if change_file "$ntp_conf" "$cf"; then + [ -n "$ntpd_restart_cmd" ] && eval $ntpd_restart_cmd fi } add_ntp_conf() { - local cf="${ntp_conf_dir}/${interface}" x= + local cf="$ntp_conf_dir/$interface" x= - [ -e "${cf}" ] && rm "${cf}" - [ -d "${ntp_conf_dir}" ] || mkdir -p "${ntp_conf_dir}" - if [ -n "${new_ntp_servers}" ]; then - for x in ${new_ntp_servers}; do - echo "server ${x}" >> "${cf}" + [ -e "$cf" ] && rm "$cf" + [ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir" + if [ -n "$new_ntp_servers" ]; then + for x in $new_ntp_servers; do + echo "server $x" >> "$cf" done fi build_ntp_conf @@ -77,13 +77,13 @@ add_ntp_conf() remove_ntp_conf() { - if [ -e "${ntp_conf_dir}/${interface}" ]; then - rm "${ntp_conf_dir}/${interface}" + if [ -e "$ntp_conf_dir/$interface" ]; then + rm "$ntp_conf_dir/$interface" fi build_ntp_conf } -case "${reason}" in +case "$reason" in BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) add_ntp_conf add;; PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) remove_ntp_conf del;; esac |
