Compare commits
48 commits
8d1153146c
...
3e2c04dc91
Author | SHA1 | Date | |
---|---|---|---|
3e2c04dc91 | |||
c05a5f011c | |||
b780b1a20e | |||
208f77f323 | |||
49cf6f6161 | |||
e1a744b823 | |||
ea3d326f5f | |||
766b0504cf | |||
e9a57fafad | |||
896bd319f2 | |||
bd6bb9935f | |||
5256a95f46 | |||
7b4fd8008c | |||
faddb0013b | |||
b2a593a795 | |||
30c1d9f3a4 | |||
32eef7792f | |||
46a4f1cc4a | |||
4566ca107b | |||
c50d6ddd2e | |||
bd9faadec0 | |||
9396e489d7 | |||
07e759193c | |||
7f777c16ed | |||
d07518fac9 | |||
88a46b14c8 | |||
9fc504b0bf | |||
f4e72d9c4c | |||
73e465ccf9 | |||
01346dc4e3 | |||
df2edcba7f | |||
6a3a829037 | |||
49e5ebdabb | |||
8729b8ed76 | |||
ed35546f7f | |||
e17ab90d82 | |||
4e0f8a4e8e | |||
fc2bccd548 | |||
7d44c655dc | |||
87924fe725 | |||
33b957bbaa | |||
eb0e00619a | |||
d789800639 | |||
e203f93c6b | |||
608b7a9e51 | |||
406e284273 | |||
68d0c889a9 | |||
41f88b0df3 |
2 changed files with 13 additions and 12 deletions
|
@ -37,7 +37,7 @@ function backupAction -V dir
|
||||||
echo
|
echo
|
||||||
end
|
end
|
||||||
|
|
||||||
read -xP "Please specify the path to the directory to save the backup to: " BACKUP_DIR
|
read -xP "Please specify the path to the directory to save the backup to: " VALHALLA_BACKUP_DIR
|
||||||
|
|
||||||
runHook backupSoftware || begin
|
runHook backupSoftware || begin
|
||||||
echo "Backing up software..."
|
echo "Backing up software..."
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
function backupFiles
|
function backupFiles
|
||||||
if [ -n "$VALHALLA_BACKUP_DIR" ]
|
if [ -n "$VALHALLA_BACKUP_DIR" ]
|
||||||
argparse -i "u/user=" "n/name=" "base-directory=" -- $argv
|
argparse -i "base-directory=" -- $argv
|
||||||
set -l tarArgs
|
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" ]
|
if [ -n "$_flag_base_directory" ]
|
||||||
set -a argv --base-directory "$_flag_base_directory"
|
set -a argv --base-directory "$_flag_base_directory"
|
||||||
|
@ -10,7 +17,7 @@ function backupFiles
|
||||||
set -a tarArgs -P
|
set -a tarArgs -P
|
||||||
end
|
end
|
||||||
|
|
||||||
tar $tarArgs -cvz (fd $argv) | createArchive $argv --user "$_flag_user" --name "$_flag_name"
|
sudo tar $tarArgs -cv (fd $argv) | createArchive "$path"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,18 +38,12 @@ function restoreFiles
|
||||||
end
|
end
|
||||||
|
|
||||||
fetchArchive $argv | begin
|
fetchArchive $argv | begin
|
||||||
sudo $sudoArgs tar $tarArgs -xvz
|
sudo $sudoArgs tar $tarArgs -xv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function createArchive
|
function createArchive -a path
|
||||||
set -l path (getArchivePath $argv)
|
|
||||||
|
|
||||||
if [ ! -d (dirname "$path") ]
|
|
||||||
mkdir -p (dirname "$path")
|
|
||||||
end
|
|
||||||
|
|
||||||
runRestorationCommand tee "$path" >/dev/null
|
runRestorationCommand tee "$path" >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ function runRestorationCommand
|
||||||
set -a args -p $VALHALLA_BACKUP_SERVER_PORT
|
set -a args -p $VALHALLA_BACKUP_SERVER_PORT
|
||||||
end
|
end
|
||||||
|
|
||||||
ssh $args "$VALHALLA_BACKUP_SERVER" $argv
|
ssh $args "$VALHALLA_BACKUP_SERVER" (string escape -- $argv)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue