diff options
author | John Kohl <jtk.git@bostonpog.org> | 2023-11-11 11:19:58 -0500 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2023-11-11 18:55:47 +0200 |
commit | 55e0f28b1ec2f86068d1dad9915641e3fb22afbf (patch) | |
tree | f6154422403e722e9a13233d5fde0fab06d8e37e /applications/luci-app-statistics | |
parent | 465bfe24fa89703d073e6830a36a5e8eedc8e4b0 (diff) |
luci-app-statistics: harden sysupgrade_backup
Remove sysupgrade_backup from help. Also have it check parameters.
Signed-off-by: John Kohl <jtk.git@bostonpog.org>
Diffstat (limited to 'applications/luci-app-statistics')
-rwxr-xr-x | applications/luci-app-statistics/root/etc/init.d/luci_statistics | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/applications/luci-app-statistics/root/etc/init.d/luci_statistics b/applications/luci-app-statistics/root/etc/init.d/luci_statistics index d36534cce4..20acf70019 100755 --- a/applications/luci-app-statistics/root/etc/init.d/luci_statistics +++ b/applications/luci-app-statistics/root/etc/init.d/luci_statistics @@ -13,9 +13,7 @@ SYSUPGRADE_BACKUP_TWIN_A="${BACKUP_DIR}/sysupgrade.trustme.txt" SYSUPGRADE_BACKUP_TWIN_B="${BACKUP_DIR}/sysupgrade.dont.trustme.txt" EXTRA_COMMANDS="backup sysupgrade_backup" EXTRA_HELP="\ - backup Backup current rrd database if configured to do so\n\ - sysupgrade_backup Take a special backup for sysupgrade/configuration saving" - + backup Backup current rrd database if configured to do so" TRACE=0 doing_backups() { @@ -150,6 +148,10 @@ copy_backup_for_sysupgrade() { sysupgrade_backup() { local filelist="$1" + [ -z "$filelist" -o ! -f "$filelist" ] && { + echo sysupgrade_backup requires an existing filename argument 1>&2 + exit 1 + } [ ${TRACE} -gt 0 ] && logger -t ${0##*/} -- luci_statistics sysupgrade_backup CONF_BACKUP_LIST=${CONF_BACKUP_LIST} doing_backups && { ### CONF_BACKUP_LIST=1 means we are generating the |