mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2026-03-12 12:52:52 -07:00
Update file paths to use /etc/pwnagotchi for configuration and data storage
This commit is contained in:
6
.idea/copilot.data.migration.ask2agent.xml
generated
Normal file
6
.idea/copilot.data.migration.ask2agent.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Ask2AgentMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -3,7 +3,7 @@
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.11 (pwnagotchi)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (pwnagotchi)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" />
|
||||
<component name="PythonCompatibilityInspectionAdvertiser">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
|
||||
2
.idea/pwnagotchi.iml
generated
2
.idea/pwnagotchi.iml
generated
@@ -5,7 +5,7 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.12 (pwnagotchi)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
|
||||
@@ -21,14 +21,14 @@ custom_plugin_repos = [
|
||||
"https://github.com/wpa-2/Pwnagotchi-Plugins/archive/master.zip",
|
||||
"https://github.com/cyberartemio/wardriver-pwnagotchi-plugin/archive/main.zip"
|
||||
]
|
||||
custom_plugins = "/usr/local/share/pwnagotchi/custom-plugins/"
|
||||
custom_plugins = "/etc/pwnagotchi/custom-plugins/"
|
||||
|
||||
[main.plugins.auto-tune]
|
||||
enabled = true
|
||||
|
||||
[main.plugins.auto_backup] #More options availble https://github.com/wpa-2/Pwnagotchi-Plugins/blob/main/auto_backup_config.md
|
||||
enabled = true
|
||||
backup_location = "/home/pi/backups"
|
||||
backup_location = "/etc/pwnagotchi/backups"
|
||||
|
||||
[main.plugins.auto-update]
|
||||
enabled = true
|
||||
@@ -234,7 +234,7 @@ rotation = 180
|
||||
type = "waveshare_4"
|
||||
|
||||
[bettercap]
|
||||
handshakes = "/home/pi/handshakes"
|
||||
handshakes = "/etc/pwnagotchi/handshakes"
|
||||
silence = [
|
||||
"ble.device.new",
|
||||
"ble.device.lost",
|
||||
|
||||
@@ -57,7 +57,7 @@ class auto_tune(plugins.Plugin):
|
||||
"sta_ttl": "Clients older than this will ignored",
|
||||
}
|
||||
self.options = dict()
|
||||
self.presets_dir = os.path.expanduser("~/auto-tune-presets")
|
||||
self.presets_dir = os.path.expanduser("/etc/pwnagotchi/auto-tune-presets")
|
||||
self._ensure_presets_dir()
|
||||
|
||||
def _ensure_presets_dir(self):
|
||||
|
||||
@@ -72,7 +72,7 @@ def check(version, repo, native=True, token=""):
|
||||
|
||||
|
||||
def make_path_for(name):
|
||||
path = os.path.join("/home/pi/", name)
|
||||
path = os.path.join("/opt/", name)
|
||||
if os.path.exists(path):
|
||||
logging.debug("[update] deleting %s" % path)
|
||||
shutil.rmtree(path, ignore_errors=True, onerror=None)
|
||||
@@ -155,7 +155,7 @@ def install(display, update):
|
||||
try:
|
||||
# Activate the virtual environment and install the package
|
||||
subprocess.run(
|
||||
["bash", "-c", f"source /home/pi/.pwn/bin/activate && pip install {source_path}"],
|
||||
["bash", "-c", f"source /opt/.pwn/bin/activate && pip install {source_path}"],
|
||||
check=True
|
||||
)
|
||||
|
||||
|
||||
@@ -20,20 +20,13 @@ class AutoBackup(plugins.Plugin):
|
||||
|
||||
# Hardcoded defaults for Pwnagotchi
|
||||
DEFAULT_FILES = [
|
||||
"/root/settings.yaml",
|
||||
"/root/client_secrets.json",
|
||||
"/root/.api-report.json",
|
||||
"/root/.ssh",
|
||||
"/root/.bashrc",
|
||||
"/root/.profile",
|
||||
"/root/peers",
|
||||
"/etc/pwnagotchi/",
|
||||
"/usr/local/share/pwnagotchi/custom-plugins",
|
||||
"/etc/ssh/",
|
||||
"/home/pi/handshakes/",
|
||||
"/home/pi/.bashrc",
|
||||
"/home/pi/.profile",
|
||||
"/home/pi/.wpa_sec_uploads",
|
||||
]
|
||||
|
||||
DEFAULT_INTERVAL_SECONDS = 60 * 60 # 60 minutes
|
||||
|
||||
@@ -491,7 +491,7 @@ class SessionStats(plugins.Plugin):
|
||||
)
|
||||
DEFAULT_UPDATE_INTERVAL = 15 # RPi-friendly: 15 sec = 4 disk writes/min
|
||||
DEFAULT_SAVE_PATH = (
|
||||
"/home/pi/pwnagotchi/sessions/" # Standard location for user data
|
||||
"/etc/pwnagotchi/sessions/" # Standard location for user data
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -34,7 +34,7 @@ class WpaSec(plugins.Plugin):
|
||||
self._init_db()
|
||||
|
||||
def _init_db(self):
|
||||
db_conn = sqlite3.connect('/home/pi/.wpa_sec_db')
|
||||
db_conn = sqlite3.connect('/etc/pwnagotchi/.wpa_sec_db')
|
||||
db_conn.execute('pragma journal_mode=wal')
|
||||
with db_conn:
|
||||
db_conn.execute('''
|
||||
@@ -72,7 +72,7 @@ class WpaSec(plugins.Plugin):
|
||||
if not remove_whitelisted([filename], config['main']['whitelist']):
|
||||
return
|
||||
|
||||
db_conn = sqlite3.connect('/home/pi/.wpa_sec_db')
|
||||
db_conn = sqlite3.connect('/etc/pwnagotchi/.wpa_sec_db')
|
||||
with db_conn:
|
||||
db_conn.execute('''
|
||||
INSERT INTO handshakes (path, status)
|
||||
@@ -93,7 +93,7 @@ class WpaSec(plugins.Plugin):
|
||||
display = agent.view()
|
||||
|
||||
try:
|
||||
db_conn = sqlite3.connect('/home/pi/.wpa_sec_db')
|
||||
db_conn = sqlite3.connect('/etc/pwnagotchi/.wpa_sec_db')
|
||||
cursor = db_conn.cursor()
|
||||
|
||||
cursor.execute('SELECT path FROM handshakes WHERE status = ?', (self.Status.TOUPLOAD.value,))
|
||||
@@ -264,7 +264,7 @@ class WpaSec(plugins.Plugin):
|
||||
|
||||
def on_ui_update(self, ui):
|
||||
if 'show_pwd' in self.options and self.options['show_pwd'] and 'download_results' in self.options and self.options['download_results']:
|
||||
file_path = '/home/pi/handshakes/wpa-sec.cracked.potfile'
|
||||
file_path = '/etc/pwnagotchi/handshakes/wpa-sec.cracked.potfile'
|
||||
try:
|
||||
with open(file_path, 'r') as file:
|
||||
# Read all lines and extract the required fields
|
||||
|
||||
@@ -85,7 +85,7 @@ if errorlevel 1 (
|
||||
)
|
||||
|
||||
echo [INFO] Backing up %UNIT_HOSTNAME% to %OUTPUT% ... >> "%LOGFILE%"
|
||||
set "FILES_TO_BACKUP=/root/settings.yaml /root/client_secrets.json /root/auto-tune-presets /root/.ssh /root/.api-report.json /root/.bashrc /root/.profile /home/pi/handshakes /root/peers /etc/pwnagotchi/ /usr/local/share/pwnagotchi/custom-plugins /etc/ssh/ /home/pi/.bashrc /home/pi/.profile /home/pi/.wpa_sec_uploads"
|
||||
set "FILES_TO_BACKUP=/root/settings.yaml /root/client_secrets.json /root/auto-tune-presets /root/.ssh /root/.api-report.json /root/.bashrc /root/.profile /root/peers /etc/pwnagotchi/ /etc/ssh/"
|
||||
|
||||
ssh %UNIT_USERNAME%@%UNIT_HOSTNAME% "sudo tar -cf - %FILES_TO_BACKUP% | gzip -9" > "%OUTPUT%" 2>> "%LOGFILE%"
|
||||
if errorlevel 1 (
|
||||
|
||||
391
scripts/BR.sh
391
scripts/BR.sh
@@ -1,198 +1,193 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# A Combined backup/restore script for linux
|
||||
# Usage:
|
||||
# backup-restore.sh backup [ -n HOST ] [ -u USER ] [ -o OUTPUT ]
|
||||
# backup-restore.sh restore [ -n HOST ] [ -u USER ] [ -b BACKUP_FILE ]
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# GLOBAL USAGE
|
||||
###############################################################################
|
||||
usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 backup [ -n HOST ] [ -u USER ] [ -o OUTPUT ]"
|
||||
echo " $0 restore [ -n HOST ] [ -u USER ] [ -b BACKUP_FILE ]"
|
||||
echo
|
||||
echo "Subcommands:"
|
||||
echo " backup Backup files from the remote device."
|
||||
echo " restore Restore files to the remote device."
|
||||
echo
|
||||
echo "Common Options:"
|
||||
echo " -n HOST Hostname or IP of remote device (default: 10.0.0.2)"
|
||||
echo " -u USER Username for SSH (default: pi)"
|
||||
echo
|
||||
echo "Options for 'backup':"
|
||||
echo " -o OUTPUT Path/name of the output archive (default: \$HOST-backup-\$(date +%s).tgz)"
|
||||
echo
|
||||
echo "Options for 'restore':"
|
||||
echo " -b BACKUP Path to the local backup archive to restore."
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " $0 backup"
|
||||
echo " $0 backup -n 10.0.0.2 -u pi -o my-backup.tgz"
|
||||
echo " $0 restore -b 10.0.0.2-backup-123456789.tgz"
|
||||
echo
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# BACKUP FUNCTION
|
||||
###############################################################################
|
||||
do_backup() {
|
||||
# Defaults
|
||||
UNIT_HOSTNAME="10.0.0.2"
|
||||
UNIT_USERNAME="pi"
|
||||
OUTPUT=""
|
||||
|
||||
# Parse arguments specific to backup
|
||||
while getopts "hn:u:o:" arg; do
|
||||
case $arg in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
n)
|
||||
UNIT_HOSTNAME=$OPTARG
|
||||
;;
|
||||
u)
|
||||
UNIT_USERNAME=$OPTARG
|
||||
;;
|
||||
o)
|
||||
OUTPUT=$OPTARG
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If OUTPUT was not specified, set a default
|
||||
if [[ -z "$OUTPUT" ]]; then
|
||||
OUTPUT="${UNIT_HOSTNAME}-backup-$(date +%s).tgz"
|
||||
fi
|
||||
|
||||
# List of files/directories to backup
|
||||
# (the same list you used in your backup.sh script)
|
||||
FILES_TO_BACKUP="
|
||||
/root/settings.yaml
|
||||
/root/client_secrets.json
|
||||
/root/auto-tune-presets
|
||||
/root/.api-report.json
|
||||
/root/.ssh
|
||||
/root/.bashrc
|
||||
/root/.profile
|
||||
/home/pi/handshakes
|
||||
/root/peers
|
||||
/etc/pwnagotchi/
|
||||
/usr/local/share/pwnagotchi/custom-plugins
|
||||
/etc/ssh/
|
||||
/home/pi/.bashrc
|
||||
/home/pi/.profile
|
||||
/home/pi/.wpa_sec_uploads
|
||||
"
|
||||
# Convert multiline variable into a space-separated list
|
||||
FILES_TO_BACKUP=$(echo "$FILES_TO_BACKUP" | tr '\n' ' ')
|
||||
|
||||
echo "@ Checking connectivity to $UNIT_HOSTNAME ..."
|
||||
if ! ping -c 1 "$UNIT_HOSTNAME" &>/dev/null; then
|
||||
echo "@ unit ${UNIT_HOSTNAME} can't be reached, check network or USB interface IP."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "@ Backing up ${UNIT_HOSTNAME} to ${OUTPUT} ..."
|
||||
# -n => do not read from stdin
|
||||
ssh -n "${UNIT_USERNAME}@${UNIT_HOSTNAME}" \
|
||||
"sudo tar -cf - ${FILES_TO_BACKUP}" \
|
||||
| gzip -9 > "${OUTPUT}"
|
||||
|
||||
echo "@ Backup finished. Archive: ${OUTPUT}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# RESTORE FUNCTION
|
||||
###############################################################################
|
||||
do_restore() {
|
||||
# Defaults
|
||||
UNIT_HOSTNAME="10.0.0.2"
|
||||
UNIT_USERNAME="pi"
|
||||
BACKUP_FILE=""
|
||||
|
||||
# Parse arguments specific to restore
|
||||
while getopts "hn:u:b:" arg; do
|
||||
case $arg in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
n)
|
||||
UNIT_HOSTNAME=$OPTARG
|
||||
;;
|
||||
u)
|
||||
UNIT_USERNAME=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BACKUP_FILE=$OPTARG
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If no backup file given, try to find the latest
|
||||
if [[ -z "$BACKUP_FILE" ]]; then
|
||||
BACKUP_FILE=$(ls -rt "${UNIT_HOSTNAME}"-backup-*.tgz 2>/dev/null | tail -n1)
|
||||
if [[ -z "$BACKUP_FILE" ]]; then
|
||||
echo "@ Can't find backup file. Please specify one with '-b'."
|
||||
exit 1
|
||||
fi
|
||||
echo "@ Found backup file: $BACKUP_FILE"
|
||||
echo -n "@ Continue restoring this file? (y/n) "
|
||||
read -r CONTINUE
|
||||
CONTINUE=$(echo "${CONTINUE}" | tr "[:upper:]" "[:lower:]")
|
||||
if [[ "${CONTINUE}" != "y" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "@ Checking connectivity to $UNIT_HOSTNAME ..."
|
||||
if ! ping -c 1 "$UNIT_HOSTNAME" &>/dev/null; then
|
||||
echo "@ unit ${UNIT_HOSTNAME} can't be reached, make sure it's connected and a static IP assigned."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "@ Restoring $BACKUP_FILE to $UNIT_HOSTNAME ..."
|
||||
cat "${BACKUP_FILE}" | ssh "${UNIT_USERNAME}@${UNIT_HOSTNAME}" "sudo tar xzv -C /"
|
||||
|
||||
echo "@ Restore finished."
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# MAIN ENTRY POINT
|
||||
###############################################################################
|
||||
# We expect the first argument to be either 'backup', 'restore', or '-h'.
|
||||
SUBCOMMAND=$1
|
||||
if [[ -z "$SUBCOMMAND" ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
shift # Shift past subcommand
|
||||
|
||||
case "$SUBCOMMAND" in
|
||||
backup)
|
||||
do_backup "$@"
|
||||
;;
|
||||
restore)
|
||||
do_restore "$@"
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# A Combined backup/restore script for linux
|
||||
# Usage:
|
||||
# backup-restore.sh backup [ -n HOST ] [ -u USER ] [ -o OUTPUT ]
|
||||
# backup-restore.sh restore [ -n HOST ] [ -u USER ] [ -b BACKUP_FILE ]
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# GLOBAL USAGE
|
||||
###############################################################################
|
||||
usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 backup [ -n HOST ] [ -u USER ] [ -o OUTPUT ]"
|
||||
echo " $0 restore [ -n HOST ] [ -u USER ] [ -b BACKUP_FILE ]"
|
||||
echo
|
||||
echo "Subcommands:"
|
||||
echo " backup Backup files from the remote device."
|
||||
echo " restore Restore files to the remote device."
|
||||
echo
|
||||
echo "Common Options:"
|
||||
echo " -n HOST Hostname or IP of remote device (default: 10.0.0.2)"
|
||||
echo " -u USER Username for SSH (default: pi)"
|
||||
echo
|
||||
echo "Options for 'backup':"
|
||||
echo " -o OUTPUT Path/name of the output archive (default: \$HOST-backup-\$(date +%s).tgz)"
|
||||
echo
|
||||
echo "Options for 'restore':"
|
||||
echo " -b BACKUP Path to the local backup archive to restore."
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " $0 backup"
|
||||
echo " $0 backup -n 10.0.0.2 -u pi -o my-backup.tgz"
|
||||
echo " $0 restore -b 10.0.0.2-backup-123456789.tgz"
|
||||
echo
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# BACKUP FUNCTION
|
||||
###############################################################################
|
||||
do_backup() {
|
||||
# Defaults
|
||||
UNIT_HOSTNAME="10.0.0.2"
|
||||
UNIT_USERNAME="pi"
|
||||
OUTPUT=""
|
||||
|
||||
# Parse arguments specific to backup
|
||||
while getopts "hn:u:o:" arg; do
|
||||
case $arg in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
n)
|
||||
UNIT_HOSTNAME=$OPTARG
|
||||
;;
|
||||
u)
|
||||
UNIT_USERNAME=$OPTARG
|
||||
;;
|
||||
o)
|
||||
OUTPUT=$OPTARG
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If OUTPUT was not specified, set a default
|
||||
if [[ -z "$OUTPUT" ]]; then
|
||||
OUTPUT="${UNIT_HOSTNAME}-backup-$(date +%s).tgz"
|
||||
fi
|
||||
|
||||
# List of files/directories to backup
|
||||
# (the same list you used in your backup.sh script)
|
||||
FILES_TO_BACKUP="
|
||||
/root/settings.yaml
|
||||
/root/client_secrets.json
|
||||
/root/auto-tune-presets
|
||||
/root/.api-report.json
|
||||
/root/.ssh
|
||||
/root/.bashrc
|
||||
/root/.profile
|
||||
/root/peers
|
||||
/etc/pwnagotchi/
|
||||
/etc/ssh/
|
||||
"
|
||||
# Convert multiline variable into a space-separated list
|
||||
FILES_TO_BACKUP=$(echo "$FILES_TO_BACKUP" | tr '\n' ' ')
|
||||
|
||||
echo "@ Checking connectivity to $UNIT_HOSTNAME ..."
|
||||
if ! ping -c 1 "$UNIT_HOSTNAME" &>/dev/null; then
|
||||
echo "@ unit ${UNIT_HOSTNAME} can't be reached, check network or USB interface IP."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "@ Backing up ${UNIT_HOSTNAME} to ${OUTPUT} ..."
|
||||
# -n => do not read from stdin
|
||||
ssh -n "${UNIT_USERNAME}@${UNIT_HOSTNAME}" \
|
||||
"sudo tar -cf - ${FILES_TO_BACKUP}" \
|
||||
| gzip -9 > "${OUTPUT}"
|
||||
|
||||
echo "@ Backup finished. Archive: ${OUTPUT}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# RESTORE FUNCTION
|
||||
###############################################################################
|
||||
do_restore() {
|
||||
# Defaults
|
||||
UNIT_HOSTNAME="10.0.0.2"
|
||||
UNIT_USERNAME="pi"
|
||||
BACKUP_FILE=""
|
||||
|
||||
# Parse arguments specific to restore
|
||||
while getopts "hn:u:b:" arg; do
|
||||
case $arg in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
n)
|
||||
UNIT_HOSTNAME=$OPTARG
|
||||
;;
|
||||
u)
|
||||
UNIT_USERNAME=$OPTARG
|
||||
;;
|
||||
b)
|
||||
BACKUP_FILE=$OPTARG
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If no backup file given, try to find the latest
|
||||
if [[ -z "$BACKUP_FILE" ]]; then
|
||||
BACKUP_FILE=$(ls -rt "${UNIT_HOSTNAME}"-backup-*.tgz 2>/dev/null | tail -n1)
|
||||
if [[ -z "$BACKUP_FILE" ]]; then
|
||||
echo "@ Can't find backup file. Please specify one with '-b'."
|
||||
exit 1
|
||||
fi
|
||||
echo "@ Found backup file: $BACKUP_FILE"
|
||||
echo -n "@ Continue restoring this file? (y/n) "
|
||||
read -r CONTINUE
|
||||
CONTINUE=$(echo "${CONTINUE}" | tr "[:upper:]" "[:lower:]")
|
||||
if [[ "${CONTINUE}" != "y" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "@ Checking connectivity to $UNIT_HOSTNAME ..."
|
||||
if ! ping -c 1 "$UNIT_HOSTNAME" &>/dev/null; then
|
||||
echo "@ unit ${UNIT_HOSTNAME} can't be reached, make sure it's connected and a static IP assigned."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "@ Restoring $BACKUP_FILE to $UNIT_HOSTNAME ..."
|
||||
cat "${BACKUP_FILE}" | ssh "${UNIT_USERNAME}@${UNIT_HOSTNAME}" "sudo tar xzv -C /"
|
||||
|
||||
echo "@ Restore finished."
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# MAIN ENTRY POINT
|
||||
###############################################################################
|
||||
# We expect the first argument to be either 'backup', 'restore', or '-h'.
|
||||
SUBCOMMAND=$1
|
||||
if [[ -z "$SUBCOMMAND" ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
shift # Shift past subcommand
|
||||
|
||||
case "$SUBCOMMAND" in
|
||||
backup)
|
||||
do_backup "$@"
|
||||
;;
|
||||
restore)
|
||||
do_restore "$@"
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user