1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-19 22:58:16 +00:00

Shellchecking.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
Dan Schaper 2017-03-04 19:05:32 -08:00
parent dc44fc9e27
commit 512c650441
No known key found for this signature in database
GPG Key ID: 572E999E385B7BFC

View File

@ -121,28 +121,41 @@ version_check() {
local admin_commit local admin_commit
local light_ver local light_ver
local php_ver local php_ver
local status
error_found=0 error_found=0
if [[ -d "${PIHOLEGITDIR}" ]]; then cd "${PIHOLEGITDIR}" &> /dev/null || \
cd "${PIHOLEGITDIR}" { status="Pi-hole git directory not found."; error_found=1; }
if git status &> /dev/null; then
pi_hole_ver=$(git describe --tags --abbrev=0) pi_hole_ver=$(git describe --tags --abbrev=0)
pi_hole_branch=$(git rev-parse --abbrev-ref HEAD) pi_hole_branch=$(git rev-parse --abbrev-ref HEAD)
pi_hole_commit=$(git describe --long --dirty --tags --always) pi_hole_commit=$(git describe --long --dirty --tags --always)
log_echo -r "Pi-hole: ${pi_hole_ver:-Untagged} (${pi_hole_branch:-Detached}:${pi_hole_commit})" log_echo -r "Pi-hole: ${pi_hole_ver:-Untagged} (${pi_hole_branch:-Detached}:${pi_hole_commit})"
else else
log_echo "Pi-hole git repository not detected." status=${status:-"Pi-hole repository damaged."}
error_found=1 error_found=1
fi fi
if [[ -d "${ADMINGITDIR}" ]]; then if [[ "${status}" ]]; then
cd "${ADMINGITDIR}" log_echo "${status}"
unset status
fi
cd "${ADMINGITDIR}" || \
{ status="Pi-hole Dashboard git directory not found."; error_found=1; }
if git status &> /dev/null; then
admin_ver=$(git describe --tags --abbrev=0) admin_ver=$(git describe --tags --abbrev=0)
admin_branch=$(git rev-parse --abbrev-ref HEAD) admin_branch=$(git rev-parse --abbrev-ref HEAD)
admin_commit=$(git describe --long --dirty --tags --always) admin_commit=$(git describe --long --dirty --tags --always)
log_echo -r "Web Dashboard: ${admin_ver:-Untagged} (${admin_branch:-Detached}:${admin_commit})" log_echo -r "Pi-hole Dashboard: ${admin_ver:-Untagged} (${admin_branch:-Detached}:${admin_commit})"
else else
log_echo "Pi-hole Admin Pages git repository not detected." status=${status:-"Pi-hole Dashboard repository damaged."}
error_found=1 error_found=1
fi fi
if [[ "${status}" ]]; then
log_echo "${status}"
unset status
fi
if light_ver=$(lighttpd -v |& head -n1 | cut -d " " -f1); then if light_ver=$(lighttpd -v |& head -n1 | cut -d " " -f1); then
log_echo -r "${light_ver}" log_echo -r "${light_ver}"
else else