From 6b2c30b7ccb3ce06f2466149d5c704515c3f70e2 Mon Sep 17 00:00:00 2001 From: Emanuele Petriglia Date: Sat, 16 Jun 2018 11:54:08 +0200 Subject: [PATCH] Add backup option --- updater.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/updater.sh b/updater.sh index 8e7f244..f2e1036 100755 --- a/updater.sh +++ b/updater.sh @@ -14,14 +14,14 @@ # # Report bugs to https://github.com/ghacksuserjs/ghacks-user.js/issues -readonly VERSION="1.4" +readonly VERSION="2.0" # Default values for flags. QUIET="false" VERBOSE="false" FORCE_VERSION="false" UPDATED="false" - +MAKE_BACKUP="false" # Prints a message to the standard error and exit with error code 1. error() { @@ -68,12 +68,13 @@ show_help() { cat <<-_EOF Usage: $PROGRAM [--update,-u] [--verbose] [--quiet,-q] [--force-version,-f] - [--help,-h] [--version,-v] + [--help,-h] [--version,-v] [--backup,-b] Options: -u, --update First updates the updater script, then the user.js --force-version, -f Force to download the user.js according to the Firefox version + --backup, -b Make a copy of the old user.js before overwriting it --quiet, -q Print only errors --verbose Print additional informations --help Print this message @@ -128,6 +129,7 @@ while :; do --verbose) shift; VERBOSE="true";; --help|-h) shift; SHOW_HELP="true";; --version|-v) shift; SHOW_VERSION="true";; + --backup|-b) shift; MAKE_BACKUP="true";; "") break;; # Default case: no more options. *) error "Unrecognized option '$1'";; esac