From 7ca1168fed71f891381d05e4f99a144ada34e6fc Mon Sep 17 00:00:00 2001 From: Daniel Hoherd Date: Sat, 9 Nov 2019 17:20:42 -0800 Subject: [PATCH] Ignore backup archives. Use 'find | xargs' to handle missing files. Correct file type in comments. Signed-off-by: Daniel Hoherd --- .gitignore | 2 ++ scripts/backup.sh | 4 ++-- scripts/restore.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0cac4ae..58560b2 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ output-pwnagotchi build dist pwnagotchi.egg-info +*backup*.tgz +*backup*.gz diff --git a/scripts/backup.sh b/scripts/backup.sh index 9934327..da011dd 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -2,7 +2,7 @@ # name of the ethernet gadget interface on the host UNIT_HOSTNAME=${1:-10.0.0.2} -# output backup zip file +# output backup tgz file OUTPUT=${2:-pwnagotchi-backup.tgz} # username to use for ssh USERNAME=${3:-pi} @@ -26,4 +26,4 @@ ping -c 1 "${UNIT_HOSTNAME}" >/dev/null || { } echo "@ backing up $UNIT_HOSTNAME to $OUTPUT ..." -ssh "${USERNAME}@${UNIT_HOSTNAME}" "sudo tar cv ${FILES_TO_BACKUP[@]}" | gzip -9 > "$OUTPUT" +ssh "${USERNAME}@${UNIT_HOSTNAME}" "sudo find ${FILES_TO_BACKUP[@]} -print0 | xargs -0 sudo tar cv" | gzip -9 > "$OUTPUT" diff --git a/scripts/restore.sh b/scripts/restore.sh index ca60a80..50aa5ec 100755 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -2,7 +2,7 @@ # name of the ethernet gadget interface on the host UNIT_HOSTNAME=${1:-10.0.0.2} -# output backup zip file +# output backup tgz file BACKUP=${2:-pwnagotchi-backup.tgz} # username to use for ssh USERNAME=${3:-pi}