diff options
| author | Roy Marples <roy@marples.name> | 2009-02-26 19:31:41 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-02-26 19:31:41 +0000 |
| commit | e0dd8b7e4a3011200972a9103d84081aca91843f (patch) | |
| tree | 967389de1578a2fd38d53fa203c791bb58be98d7 | |
| parent | f68268b72b6372fd3c0ba2be78cbecbe8ceab98c (diff) | |
| download | dhcpcd-e0dd8b7e4a3011200972a9103d84081aca91843f.tar.xz | |
Use state dir for tmp files and try to preserve orig file more.
| -rw-r--r-- | dhcpcd-hooks/20-resolv.conf | 2 | ||||
| -rw-r--r-- | dhcpcd-hooks/50-ntp.conf | 2 | ||||
| -rw-r--r-- | dhcpcd-hooks/50-yp.conf | 3 | ||||
| -rw-r--r-- | dhcpcd-run-hooks.in | 10 |
4 files changed, 9 insertions, 8 deletions
diff --git a/dhcpcd-hooks/20-resolv.conf b/dhcpcd-hooks/20-resolv.conf index 64005ee5..7f69d4c2 100644 --- a/dhcpcd-hooks/20-resolv.conf +++ b/dhcpcd-hooks/20-resolv.conf @@ -10,7 +10,7 @@ resolv_conf_dir="${state_dir}/resolv.conf" build_resolv_conf() { - local cf="/var/run/resolv.conf.${interface}" + local cf="${state_dir}/resolv.conf.${interface}" local interfaces= header= search= srvs= servers= x= # Build a list of interfaces diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf index 7ec2d3f6..2135dc7e 100644 --- a/dhcpcd-hooks/50-ntp.conf +++ b/dhcpcd-hooks/50-ntp.conf @@ -23,7 +23,7 @@ ntp_conf=${NTP_CONF:-/etc/ntp.conf} build_ntp_conf() { - local cf="/var/run/ntp.conf.${interface}" + local cf="${state_dir}/ntp.conf.${interface}" local interfaces= header= srvs= servers= x= # Build a list of interfaces diff --git a/dhcpcd-hooks/50-yp.conf b/dhcpcd-hooks/50-yp.conf index 2758606d..1b83d61d 100644 --- a/dhcpcd-hooks/50-yp.conf +++ b/dhcpcd-hooks/50-yp.conf @@ -26,7 +26,8 @@ make_yp_conf() echo "${prefix}${x}" >> "${cf}" done save_conf /etc/yp.conf - mv -f "${cf}" /etc/yp.conf + cat "${cf}" > /etc/yp.conf + rm -f "${cf}" pid="$(ypbind_pid)" if [ -n "${pid}" ]; then kill -HUP "${pid}" diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in index da37b5df..ca8fe94a 100644 --- a/dhcpcd-run-hooks.in +++ b/dhcpcd-run-hooks.in @@ -114,17 +114,17 @@ change_file() save_conf() { if [ -f "$1" ]; then - rm -f "$1"-pre."${interface}" - mv -f "$1" "$1"-pre."${interface}" + rm -f "${1}-pre.${interface}" + cat "$1" > "${1}-pre.${interface}" fi } # Restore a config file restore_conf() { - [ -f "$1"-pre."${interface}" ] || return 1 - rm -f "$1" - mv -f "$1"-pre."${interface}" "$1" + [ -f "${1}-pre.${interface}" ] || return 1 + cat "${1}-pre.${interface}" > "$1" + rm -f "${1}-pre.${interface}" } |
