mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Update basic-install.sh
This hands checking of lighttpd's status over to the existing check_service_active() function. All other checks of service status within the install script are handled by this function. Use of existing function: Avoids duplication of service detection logic. Uses return code to determine status, thereby avoids parsing text to determine status, and reliance on English language locale to determine activity, (which may also be broken on some systems (# 2204) Signed-off-by: Rob Gill <rrobgill@protonmail.com>
This commit is contained in:
parent
1a30043776
commit
a8f0283e93
1 changed files with 7 additions and 9 deletions
|
@ -2290,13 +2290,11 @@ main() {
|
||||||
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
|
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
|
||||||
enable_service lighttpd
|
enable_service lighttpd
|
||||||
fi
|
fi
|
||||||
|
# Determin if lighttpd is correctly enabled
|
||||||
if [[ -x "$(command -v systemctl)" ]]; then
|
if check_service_active "lighttpd"; then
|
||||||
# Value will either be 1, if true, or 0
|
LIGHTTPD_ENABLED=true;
|
||||||
LIGHTTPD_ENABLED=$(systemctl is-enabled lighttpd | grep -c 'enabled' || true)
|
|
||||||
else
|
else
|
||||||
# Value will either be 1, if true, or 0
|
LIGHTTPD_ENABLED=false;
|
||||||
LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install and log everything to a file
|
# Install and log everything to a file
|
||||||
|
@ -2327,7 +2325,7 @@ main() {
|
||||||
# If the Web server was installed,
|
# If the Web server was installed,
|
||||||
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
|
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
|
||||||
|
|
||||||
if [[ "${LIGHTTPD_ENABLED}" == "1" ]]; then
|
if [[ "${LIGHTTPD_ENABLED}" == true ]]; then
|
||||||
start_service lighttpd
|
start_service lighttpd
|
||||||
enable_service lighttpd
|
enable_service lighttpd
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue