]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Kleinere fixes an der Backup Routine
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 18 Oct 2007 19:51:15 +0000 (19:51 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 18 Oct 2007 19:51:15 +0000 (19:51 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@977 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/backup/backup.pl
html/cgi-bin/backup.cgi
src/pakfire/lib/functions.sh

index ff9eea5cea17de1243fd1e0f3a605910fa817cdb..645a4f82b00369f69e1affaf6096bf2d577c1682 100644 (file)
@@ -61,7 +61,8 @@ elsif ($ARGV[0] eq 'restore') {
   system("cd / && tar -xvz --preserve -f /tmp/restore.ipf");
 }
 elsif ($ARGV[0] eq 'restoreaddon') {
-  system("cd / && tar -xvz --preserve -f /var/ipfire/backup/addons/backup/$ARGV[1].ipf");
+  system("mv /tmp/$ARGV[1] /var/ipfire/backup/addons/backup/$ARGV[1]");
+  system("cd / && tar -xvz --preserve -f /var/ipfire/backup/addons/backup/$ARGV[1]");
 }
 elsif ($ARGV[0] eq 'cli') {
   system("tar -cvzf /var/ipfire/backup/$Jahr$Monat$Monatstag-$Stunden$Minuten-$ARGV[1].ipf --files-from='$ARGV[2]' --exclude-from='$ARGV[3]'");
index a0b2dcf1641d56415e1a7e8dfba4946c9df22e7d..f6bf6cc07385be7dd409909ec7379639fb1ce229 100644 (file)
@@ -84,14 +84,13 @@ elsif ( $cgiparams{'ACTION'} eq "restore" )
 elsif ( $cgiparams{'ACTION'} eq "restoreaddon" )
 {
                my $upload = $a->param("UPLOAD");
-               open UPLOADFILE, ">/var/$cgiparams{'UPLOAD'}";
+               open UPLOADFILE, ">/tmp/$cgiparams{'UPLOAD'}";
                binmode $upload;
                while ( <$upload> ) {
                print UPLOADFILE;
                }
                close UPLOADFILE;
-               system("cp /var/ipfire/backup/addons/backup/$cgiparams{'UPLOAD'} /tmp/restore.ipf >/dev/null 2>&1");
-               system("/usr/local/bin/backupctrl restore >/dev/null 2>&1");
+               system("/usr/local/bin/backupctrl restoreaddon $cgiparams{'UPLOAD'} >/dev/null 2>&1");
 }
 
 &Header::showhttpheaders();
index 1c4e760ea69aa0a2ca7809d7e8fed8d91d18ce60..0ec8d8f8083dda6c973ad1fe4c18c260cced9f6c 100644 (file)
@@ -37,28 +37,29 @@ remove_files() {
 }
 
 make_backup(){
-               [ -e "/var/ipfire/backup/addons/include/${1}" ] && \
-               ( echo "Creating Backup..."
-                       /usr/local/bin/backupctrl addonbackup ${1}
-                       echo "...Finished." )
+       if [ -e "/var/ipfire/backup/addons/include/${1}" ];then
+       echo "Creating Backup..."
+       /usr/local/bin/backupctrl addonbackup ${1}
+       echo "...Finished."
+       fi
 }
 
 restore_backup(){
-               [ -e "/var/ipfire/backup/addons/backup/${1}" ] && \
-               ( echo "Restoring Backup..." && \
-                       /usr/local/bin/backupctrl restoreaddon ${1} && \
-                       echo "...Finished." )
+       if [ -e "/var/ipfire/backup/addons/backup/${1}" ];then
+       echo "Restoring Backup..."
+       /usr/local/bin/backupctrl restoreaddon ${1}.ipf
+       echo "...Finished."
+       fi
 }
 
 restart_service() {
-       
-       /etc/init.d/$1 restart
-
+       /etc/init.d/${1} restart
 }
 
 start_service() {
        DELAY=0
        while true
+        do
                case "${1}" in
                        --delay|-d)
                                DELAY=${2}
@@ -76,13 +77,16 @@ start_service() {
                                break
                                ;;                      
                esac
+       done
                
-               [ -e "/etc/init.d/${1}" ] && \
-                (sleep ${DELAY} && /etc/init.d/${1} start ${BACKGROUND})
+               if [ -e "/etc/init.d/${1}" ];then
+                sleep ${DELAY}
+     /etc/init.d/${1} start ${BACKGROUND}
+               fi
 }
 
 stop_service() {
-       
-       [ -e "/etc/init.d/${1}" ] && /etc/init.d/${1} stop
-
+       if [ -e "/etc/init.d/${1}" ];then
+       /etc/init.d/${1} stop
+       fi
 }