From ab75f551cbebec6dbb9f4d0bc3d332affde718e7 Mon Sep 17 00:00:00 2001 From: Valentin Vidic Date: Fri, 28 Dec 2007 17:37:29 +0100 Subject: [PATCH] Recover config files only once. --- usr/share/carnet-upgrade/functions.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/usr/share/carnet-upgrade/functions.sh b/usr/share/carnet-upgrade/functions.sh index 16f3d23..a67e267 100644 --- a/usr/share/carnet-upgrade/functions.sh +++ b/usr/share/carnet-upgrade/functions.sh @@ -388,15 +388,16 @@ fix_etc_default_raid2 () { # restore distribution config file restore_config () { - local file + local file file_backup for file in "$@"; do - if [ -e "$file" ]; then - # backup changes - [ ! -e "$file.cn3-upgrade" ] && mv "$file" "$file.cn3-upgrade" + file_backup=$file.cn3-upgrade + if [ -e $file -a ! -e $file_backup ]; then + # backup file + mv $file $file_backup # install original - cp "/usr/share/carnet-upgrade/files/$file" "$file" + cp /usr/share/carnet-upgrade/files/$file $file fi done } -- 1.7.10.4