Recover config files only once.
authorValentin Vidic <vvidic@carnet.hr>
Fri, 28 Dec 2007 16:37:29 +0000 (17:37 +0100)
committerValentin Vidic <vvidic@carnet.hr>
Fri, 28 Dec 2007 16:37:29 +0000 (17:37 +0100)
usr/share/carnet-upgrade/functions.sh

index 16f3d23..a67e267 100644 (file)
@@ -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
 }