Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issues that occur if WebAdmin not installed #165

Merged
merged 2 commits into from
Feb 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 22 additions & 19 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ today=$(date +%Y%m%d)
declare -i core_count=1
core_count=$(cat /sys/devices/system/cpu/kernel_max 2> /dev/null)+1

# Get Config variables
. /etc/pihole/setupVars.conf

# COLORS
black_text=$(tput setaf 0) # Black
red_text=$(tput setaf 1) # Red
Expand Down Expand Up @@ -511,20 +514,27 @@ GetVersionInformation() {
fi

# Gather web version information...
read -r -a web_versions <<< "$(pihole -v -a)"
web_version=$(echo "${web_versions[3]}" | tr -d '\r\n[:alpha:]')
web_version_latest=${web_versions[5]//)}
if [[ "${web_version_latest}" == "ERROR" ]]; then
web_version_heatmap=${yellow_text}
else
web_version_latest=$(echo "${web_version_latest}" | tr -d '\r\n[:alpha:]')
# is web up-to-date?
if [[ "${web_version}" != "${web_version_latest}" ]]; then
out_of_date_flag="true"
web_version_heatmap=${red_text}
if [[ "$INSTALL_WEB_INTERFACE" = true ]]; then
read -r -a web_versions <<< "$(pihole -v -a)"
web_version=$(echo "${web_versions[3]}" | tr -d '\r\n[:alpha:]')
web_version_latest=${web_versions[5]//)}
if [[ "${web_version_latest}" == "ERROR" ]]; then
web_version_heatmap=${yellow_text}
else
web_version_heatmap=${green_text}
web_version_latest=$(echo "${web_version_latest}" | tr -d '\r\n[:alpha:]')
# is web up-to-date?
if [[ "${web_version}" != "${web_version_latest}" ]]; then
out_of_date_flag="true"
web_version_heatmap=${red_text}
else
web_version_heatmap=${green_text}
fi
fi
else
# Web interface not installed
web_version_heatmap=${red_text}
web_version="$(printf '\x08')" # Hex 0x08 is for backspace, to delete the leading 'v'
web_version="${web_version}N/A" # N/A = Not Available
fi

# Gather FTL version information...
Expand Down Expand Up @@ -1181,9 +1191,6 @@ NormalPADD() {
# Sizing Checks
SizeChecker

# Get Config variables
. /etc/pihole/setupVars.conf

# Move the cursor to top left of console to redraw
tput cup 0 0

Expand Down Expand Up @@ -1237,10 +1244,6 @@ if [[ $# = 0 ]]; then
console_width=$(tput cols)
console_height=$(tput lines)

# Get Our Config Values
# shellcheck disable=SC1091
. /etc/pihole/setupVars.conf

SizeChecker

StartupRoutine ${padd_size}
Expand Down