From ef0680a14018a50d9f0cbbd2b3b7afdad5c81487 Mon Sep 17 00:00:00 2001 From: wpa-2 <9049886+wpa-2@users.noreply.github.com> Date: Sun, 2 Feb 2025 19:36:01 +0000 Subject: [PATCH] Delete scripts/restore.sh Signed-off-by: wpa-2 <9049886+wpa-2@users.noreply.github.com> --- scripts/restore.sh | 60 ---------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100755 scripts/restore.sh diff --git a/scripts/restore.sh b/scripts/restore.sh deleted file mode 100755 index b805a01a..00000000 --- a/scripts/restore.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -usage() { - echo "Usage: restore.sh [-bhnu] [-h] [-b backup name] [-n host name] [-u user name]" -} - -while getopts "hb:n:u:" arg; do - case $arg in - b) - BACKUP=$OPTARG - ;; - h) - usage - exit - ;; - n) - UNIT_HOSTNAME=$OPTARG - ;; - u) - UNIT_USERNAME=$OPTARG - ;; - *) - usage - exit 1 - esac -done -# name of the ethernet gadget interface on the host -UNIT_HOSTNAME=${UNIT_HOSTNAME:-10.0.0.2} -# output backup tgz file -# shellcheck disable=SC2086 -if [ -z $BACKUP ]; then - # shellcheck disable=SC2012 - BACKUP=$(ls -rt "${UNIT_HOSTNAME}"-backup-*.tgz 2>/dev/null | tail -n1) - if [ -z "$BACKUP" ]; then - echo "@ Can't find backup file. Please specify one with '-b'" - exit 1 - fi - echo "@ Found backup file:" - # shellcheck disable=SC2028 - echo "\t${BACKUP}" - # shellcheck disable=SC2039 - echo -n "@ continue restroring this file? (y/n) " - # shellcheck disable=SC2162 - read CONTINUE - CONTINUE=$(echo "${CONTINUE}" | tr "[:upper:]" "[:lower:]") - if [ "${CONTINUE}" != "y" ]; then - exit 1 - fi -fi -# username to use for ssh -UNIT_USERNAME=${UNIT_USERNAME:-pi} - -ping -c 1 "${UNIT_HOSTNAME}" > /dev/null 2>&1 || { - echo "@ unit ${UNIT_HOSTNAME} can't be reached, make sure it's connected and a static IP assigned to the USB interface." - exit 1 -} - -echo "@ restoring $BACKUP to $UNIT_HOSTNAME ..." -# shellcheck disable=SC2002 -cat "${BACKUP}" | ssh "${UNIT_USERNAME}@${UNIT_HOSTNAME}" "sudo tar xzv -C /"