mirror of
https://github.com/stevejenkins/pihole-cloudsync.git
synced 2024-08-30 18:22:11 +00:00
Normalize indentation and style
This commit is contained in:
parent
e039298355
commit
0f8a428365
@ -45,21 +45,18 @@ cname_list='05-pihole-custom-cname.conf'
|
||||
|
||||
# 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
|
||||
DOCKER=''
|
||||
DOCKER_CMD="$(command -v docker)"
|
||||
JQ_CMD="$(command -v jq)"
|
||||
if [ -n "${DOCKER_CMD}" ]
|
||||
then
|
||||
if [ -n "${DOCKER_CMD}" ]; then
|
||||
CONTAINER="$(${DOCKER_CMD} ps -f "ancestor=pihole/pihole" --format "{{.Names}}")"
|
||||
if [ -n "${CONTAINER}" ]
|
||||
then
|
||||
if [ -n "${JQ_CMD}" ]
|
||||
then
|
||||
if [ -n "${CONTAINER}" ]; then
|
||||
if [ -n "${JQ_CMD}" ]; then
|
||||
echo "Found pihole running under Docker container '${CONTAINER}'"
|
||||
|
||||
pihole_dir="$(${DOCKER_CMD} inspect -f "{{json .Mounts}}" "${CONTAINER}" | ${JQ_CMD} -r --arg dir "${pihole_dir}" '.[] | select(.Destination==$dir) | .Source')"
|
||||
@ -194,42 +191,35 @@ pull () {
|
||||
}
|
||||
###########################################################################
|
||||
# Check to see whether a command line option was provided
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
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
|
||||
for arg in "$@"; do
|
||||
# Initialize - adds primary Pi-hole's lists to local Git repo before first push/upload
|
||||
if [ "$arg" == "--initpush" ]
|
||||
then
|
||||
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
|
||||
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
|
||||
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."
|
||||
pull
|
||||
exit 0
|
||||
# Help - Displays help dialog
|
||||
elif [ "$arg" == "--help" ] || [ "$arg" == "-h" ] || [ "$arg" == "-?" ]
|
||||
then
|
||||
cat << EOF
|
||||
elif [ "$arg" == "--help" ] || [ "$arg" == "-h" ] || [ "$arg" == "-?" ]; then
|
||||
cat <<- EOF
|
||||
Usage: pihole-cloudsync <option>
|
||||
|
||||
Options:
|
||||
@ -248,8 +238,7 @@ Project Home: https://github.com/stevejenkins/pihole-cloudsync
|
||||
EOF
|
||||
|
||||
# Version - Displays version number
|
||||
elif [ "$arg" == "--version" ] || [ "$arg" == "-v" ]
|
||||
then
|
||||
elif [ "$arg" == "--version" ] || [ "$arg" == "-v" ]; then
|
||||
echo 'pihole-cloudsync v'$version' - Updated '"$update";
|
||||
echo 'https://github.com/stevejenkins/pihole-cloudsync';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user