]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
backup: Allow passing name of tarball for creation/restore
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Apr 2019 12:22:10 +0000 (13:22 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Apr 2019 12:22:10 +0000 (13:22 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/backup/backup.pl

index 5737740e5684bd49f34500cec52596fd458b24bb..6ac4e496737b62d4cd1ddbf1836b18eac3f1cc38 100644 (file)
@@ -176,19 +176,34 @@ main() {
        local command="${1}"
        shift
 
-       # Desired backup filename
-       local filename="/var/ipfire/backup/${NOW}.ipf"
-
        case "${command}" in
                include)
+                       local filename="${1}"
+
+                       if [ -z "${filename}" ]; then
+                               filename="/var/ipfire/backup/${NOW}.ipf"
+                       fi
+
                        make_backup "${filename}" $(find_logfiles)
                        ;;
 
                exclude)
+                       local filename="${1}"
+
+                       if [ -z "${filename}" ]; then
+                               filename="/var/ipfire/backup/${NOW}.ipf"
+                       fi
+
                        make_backup "${filename}"
                        ;;
 
                restore)
+                       local filename="${1}"
+
+                       if [ -z "${filename}" ]; then
+                               filename="/tmp/restore.ipf"
+                       fi
+
                        restore_backup "/tmp/restore.ipf"
                        ;;
 
@@ -201,6 +216,9 @@ main() {
                        ;;
 
                iso)
+                       # Desired backup filename
+                       local filename="/var/ipfire/backup/${NOW}.ipf"
+
                        if make_backup "${filename}"; then
                                /usr/local/bin/backupiso "${NOW}" &
                        fi