summaryrefslogtreecommitdiffstats
path: root/dhcpcd-run-hooks.in
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-02-26 19:31:41 +0000
committerRoy Marples <roy@marples.name>2009-02-26 19:31:41 +0000
commite0dd8b7e4a3011200972a9103d84081aca91843f (patch)
tree967389de1578a2fd38d53fa203c791bb58be98d7 /dhcpcd-run-hooks.in
parentf68268b72b6372fd3c0ba2be78cbecbe8ceab98c (diff)
downloaddhcpcd-e0dd8b7e4a3011200972a9103d84081aca91843f.tar.xz
Use state dir for tmp files and try to preserve orig file more.
Diffstat (limited to 'dhcpcd-run-hooks.in')
-rw-r--r--dhcpcd-run-hooks.in10
1 files changed, 5 insertions, 5 deletions
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}"
}