From 3eb90f5ca9cb3ca2b646f8e0ac12823226e430ea Mon Sep 17 00:00:00 2001 From: Michael Gamlem III Date: Mon, 25 Jul 2022 16:26:08 -0700 Subject: [PATCH 1/5] Add missing semicolons --- pihole-cloudsync | 57 ++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/pihole-cloudsync b/pihole-cloudsync index ec24aec..b18a2a2 100755 --- a/pihole-cloudsync +++ b/pihole-cloudsync @@ -67,8 +67,8 @@ DB_DUMP_FILE="db_dump.sql" # Force sudo if not running with root privileges SUDO='' -if [ "$EUID" -ne 0 ]; then - SUDO='sudo' +if [ "$EUID" -ne 0 ]; + then SUDO='sudo' fi # Attempt to detect pihole running in Docker @@ -217,40 +217,44 @@ pull () { } ########################################################################### # Check to see whether a command line option was provided -if [ -z "$1" ]; then - echo "Missing command line option. Try --push, --pull, or --help." - exit 1 +if [ -z "$1" ]; + then + echo "Missing command line option. Try --push, --pull, or --help." + exit 1 fi # Determine which action to perform (InitPush, InitPull, Push, Pull, or Help) for arg in "$@"; do # Initialize - adds primary Pi-hole's lists to local Git repo before first push/upload - if [ "$arg" == "--initpush" ]; then - echo "$arg option detected. Initializing local Git repo for Push/Upload."; - push_initialize - exit 0 + if [ "$arg" == "--initpush" ]; + then + echo "$arg option detected. Initializing local Git repo for Push/Upload."; + push_initialize + exit 0 # Initialize - adds primary Pi-hole's lists to local Git repo before first push/upload - elif [ "$arg" == "--initpull" ]; then - echo "$arg option detected. Initializing local Git repo for Pull/Download."; - shift - [ -n "$1" ] && git_branch="$1" - pull_initialize - exit 0 + elif [ "$arg" == "--initpull" ]; + then + echo "$arg option detected. Initializing local Git repo for Pull/Download."; + pull_initialize + exit 0 # Push / Upload - Pushes updated local Pi-hole lists to remote Git repo - elif [ "$arg" == "--push" ] || [ "$arg" == "--upload" ] || [ "$arg" == "--up" ] || [ "$arg" == "-u" ]; then - echo "$arg option detected. Running in Push/Upload mode." - push - exit 0 + elif [ "$arg" == "--push" ] || [ "$arg" == "--upload" ] || [ "$arg" == "--up" ] || [ "$arg" == "-u" ]; + then + echo "$arg option detected. Running in Push/Upload mode." + push + exit 0 # Pull / Download - Pulls updated Pi-hole lists from remote Git repo - elif [ "$arg" == "--pull" ] || [ "$arg" == "--download" ] || [ "$arg" == "--down" ]|| [ "$arg" == "-d" ]; then + elif [ "$arg" == "--pull" ] || [ "$arg" == "--download" ] || [ "$arg" == "--down" ]|| [ "$arg" == "-d" ]; + then echo "$arg option detected. Running in Pull/Download mode." shift [ -n "$1" ] && git_branch="$1" pull exit 0 # Help - Displays help dialog - elif [ "$arg" == "--help" ] || [ "$arg" == "-h" ] || [ "$arg" == "-?" ]; then - cat <<- EOF - Usage: pihole-cloudsync