Consistency

Again trying to move the repo to one style. Doesn't matter if it's
changed afterwards, but one style instead of about five seems
saner.
This commit is contained in:
Marcus Hildum 2016-10-22 10:01:15 -07:00
parent a30c75ef71
commit 69ba8a3c2f
2 changed files with 109 additions and 114 deletions

View file

@ -18,12 +18,12 @@ piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
piholeFilesDir="/etc/.pihole" piholeFilesDir="/etc/.pihole"
spinner() { spinner() {
local pid=$1 local pid=${1}
local delay=0.50 local delay=0.50
local spinstr='/-\|' local spinstr='/-\|'
while [ "$(ps a | awk '{print $1}' | grep "$pid")" ]; do while [ "$(ps a | awk '{print $1}' | grep "${pid}")" ]; do
local temp=${spinstr#?} local temp=${spinstr#?}
printf " [%c] " "$spinstr" printf " [%c] " "${spinstr}"
local spinstr=${temp}${spinstr%"$temp"} local spinstr=${temp}${spinstr%"$temp"}
sleep ${delay} sleep ${delay}
printf "\b\b\b\b\b\b" printf "\b\b\b\b\b\b"
@ -117,7 +117,6 @@ elif [[ ${piholeVersion} == ${piholeVersionLatest} && ${webVersion} != ${webVers
echo "::: Web Admin version is now at ${webVersion}" echo "::: Web Admin version is now at ${webVersion}"
echo "::: If you had made any changes in '/var/www/html/admin', they have been stashed using 'git stash'" echo "::: If you had made any changes in '/var/www/html/admin', they have been stashed using 'git stash'"
echo "" echo ""
elif [[ ${piholeVersion} != ${piholeVersionLatest} && ${webVersion} == ${webVersionLatest} ]]; then elif [[ ${piholeVersion} != ${piholeVersionLatest} && ${webVersion} == ${webVersionLatest} ]]; then
echo "::: Pi-hole core files out of date" echo "::: Pi-hole core files out of date"
getGitFiles ${piholeFilesDir} ${piholeGitUrl} getGitFiles ${piholeFilesDir} ${piholeGitUrl}
@ -127,7 +126,6 @@ elif [[ ${piholeVersion} != ${piholeVersionLatest} && ${webVersion} == ${webVers
echo "::: Pi-hole version is now at ${piholeVersion}" echo "::: Pi-hole version is now at ${piholeVersion}"
echo "::: If you had made any changes in '/etc/.pihole', they have been stashed using 'git stash'" echo "::: If you had made any changes in '/etc/.pihole', they have been stashed using 'git stash'"
echo "" echo ""
elif [[ ${piholeVersion} != ${piholeVersionLatest} && ${webVersion} != ${webVersionLatest} ]]; then elif [[ ${piholeVersion} != ${piholeVersionLatest} && ${webVersion} != ${webVersionLatest} ]]; then
echo "::: Updating Everything" echo "::: Updating Everything"
getGitFiles ${piholeFilesDir} ${piholeGitUrl} getGitFiles ${piholeFilesDir} ${piholeGitUrl}

View file

@ -21,14 +21,13 @@ normalOutput() {
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//') piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//') webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
echo "::: Pi-hole version is $piholeVersion (Latest version is $piholeVersionLatest)" echo "::: Pi-hole version is ${piholeVersion} (Latest version is ${piholeVersionLatest})"
echo "::: Web-Admin version is $webVersion (Latest version is $webVersionLatest)" echo "::: Web-Admin version is ${webVersion} (Latest version is ${webVersionLatest})"
} }
webOutput() { webOutput() {
for var in "$@" for var in "$@"; do
do case "${var}" in
case "$var" in
"-l" | "--latest" ) latest=true;; "-l" | "--latest" ) latest=true;;
"-c" | "--current" ) current=true;; "-c" | "--current" ) current=true;;
* ) echo "::: Invalid Option!"; exit 1; * ) echo "::: Invalid Option!"; exit 1;
@ -49,9 +48,8 @@ webOutput() {
} }
coreOutput() { coreOutput() {
for var in "$@" for var in "$@"; do
do case "${var}" in
case "$var" in
"-l" | "--latest" ) latest=true;; "-l" | "--latest" ) latest=true;;
"-c" | "--current" ) current=true;; "-c" | "--current" ) current=true;;
* ) echo "::: Invalid Option!"; exit 1; * ) echo "::: Invalid Option!"; exit 1;
@ -93,9 +91,8 @@ if [[ $# = 0 ]]; then
normalOutput normalOutput
fi fi
for var in "$@" for var in "$@"; do
do case "${var}" in
case "$var" in
"-a" | "--admin" ) shift; webOutput "$@";; "-a" | "--admin" ) shift; webOutput "$@";;
"-p" | "--pihole" ) shift; coreOutput "$@" ;; "-p" | "--pihole" ) shift; coreOutput "$@" ;;
"-h" | "--help" ) helpFunc;; "-h" | "--help" ) helpFunc;;