Compare commits
47 commits
3e2c04dc91
...
8d1153146c
Author | SHA1 | Date | |
---|---|---|---|
8d1153146c | |||
1c2e2b69c6 | |||
d3db6ebaff | |||
62f9912fb1 | |||
a9e2cf9de7 | |||
185d0df160 | |||
f6b57447f0 | |||
b3012c5fcc | |||
55bff382a3 | |||
95cdf1a84f | |||
f05d134c66 | |||
ac306226fc | |||
bbf594383b | |||
2729d06668 | |||
19a5434bb4 | |||
8ba581e921 | |||
64595fdb37 | |||
8c91dddf1e | |||
e6db595f66 | |||
3111c04a7f | |||
dfedb72f59 | |||
f9cea44df0 | |||
0730bbd703 | |||
de476212c9 | |||
82a5606d2a | |||
0d6a25036a | |||
81dd9c2bd3 | |||
75335164e4 | |||
fe3175814d | |||
75d28556cf | |||
951dd60a15 | |||
4a642739c4 | |||
e53420e8a3 | |||
30601d5e90 | |||
3f745ac43d | |||
f2dd4ca628 | |||
f682768800 | |||
3ae347a428 | |||
2d265b1f20 | |||
3f507b60f3 | |||
ae426292a9 | |||
f0c2857668 | |||
5a7c0cd08a | |||
53be57a90b | |||
61b826de83 | |||
3a732b194c | |||
bc58bf13fb |
2 changed files with 12 additions and 13 deletions
|
@ -37,7 +37,7 @@ function backupAction -V dir
|
|||
echo
|
||||
end
|
||||
|
||||
read -xP "Please specify the path to the directory to save the backup to: " VALHALLA_BACKUP_DIR
|
||||
read -xP "Please specify the path to the directory to save the backup to: " BACKUP_DIR
|
||||
|
||||
runHook backupSoftware || begin
|
||||
echo "Backing up software..."
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
function backupFiles
|
||||
if [ -n "$VALHALLA_BACKUP_DIR" ]
|
||||
argparse -i "base-directory=" -- $argv
|
||||
argparse -i "u/user=" "n/name=" "base-directory=" -- $argv
|
||||
set -l tarArgs
|
||||
set -l path (getArchivePath $argv)
|
||||
set -l dir (dirname "$path")
|
||||
argparse -i "u/user=" "n/name=" -- $argv
|
||||
|
||||
if runRestorationCommand test ! -d "$dir"
|
||||
runRestorationCommand mkdir -p "$dir"
|
||||
end
|
||||
|
||||
if [ -n "$_flag_base_directory" ]
|
||||
set -a argv --base-directory "$_flag_base_directory"
|
||||
|
@ -17,7 +10,7 @@ function backupFiles
|
|||
set -a tarArgs -P
|
||||
end
|
||||
|
||||
sudo tar $tarArgs -cv (fd $argv) | createArchive "$path"
|
||||
tar $tarArgs -cvz (fd $argv) | createArchive $argv --user "$_flag_user" --name "$_flag_name"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,12 +31,18 @@ function restoreFiles
|
|||
end
|
||||
|
||||
fetchArchive $argv | begin
|
||||
sudo $sudoArgs tar $tarArgs -xv
|
||||
sudo $sudoArgs tar $tarArgs -xvz
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function createArchive -a path
|
||||
function createArchive
|
||||
set -l path (getArchivePath $argv)
|
||||
|
||||
if [ ! -d (dirname "$path") ]
|
||||
mkdir -p (dirname "$path")
|
||||
end
|
||||
|
||||
runRestorationCommand tee "$path" >/dev/null
|
||||
end
|
||||
|
||||
|
@ -62,7 +61,7 @@ function runRestorationCommand
|
|||
set -a args -p $VALHALLA_BACKUP_SERVER_PORT
|
||||
end
|
||||
|
||||
ssh $args "$VALHALLA_BACKUP_SERVER" (string escape -- $argv)
|
||||
ssh $args "$VALHALLA_BACKUP_SERVER" $argv
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue