Kill off mask_service function

Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
Adam Warner 2018-03-17 22:48:11 +00:00
parent fc10e3fcac
commit 44d8cb77e3
No known key found for this signature in database
GPG key ID: F5410858022DA5EB

View file

@ -1148,7 +1148,7 @@ enable_service() {
if command -v systemctl &> /dev/null; then if command -v systemctl &> /dev/null; then
# use that to enable the service # use that to enable the service
systemctl enable "${1}" &> /dev/null systemctl enable "${1}" &> /dev/null
# Othwerwise, # Otherwise,
else else
# use update-rc.d to accomplish this # use update-rc.d to accomplish this
update-rc.d "${1}" defaults &> /dev/null update-rc.d "${1}" defaults &> /dev/null
@ -1165,7 +1165,7 @@ disable_service() {
if command -v systemctl &> /dev/null; then if command -v systemctl &> /dev/null; then
# use that to disable the service # use that to disable the service
systemctl disable "${1}" &> /dev/null systemctl disable "${1}" &> /dev/null
# Othwerwise, # Otherwise,
else else
# use update-rc.d to accomplish this # use update-rc.d to accomplish this
update-rc.d "${1}" disable &> /dev/null update-rc.d "${1}" disable &> /dev/null
@ -1173,25 +1173,6 @@ disable_service() {
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${TICK} ${str}"
} }
# Mask service so that it cannot be started accidentally
mask_service() {
# Local, named variables
local str="Masking ${1} service"
echo -ne " ${INFO} ${str}..."
# If systemctl exists,
if command -v systemctl &> /dev/null; then
# use that to disable the service
systemctl mask "${1}" &> /dev/null
echo -e "${OVER} ${TICK} ${str}"
# Othwerwise,
else
# use update-rc.d to accomplish this
echo -e "${OVER} ${CROSS} ${str}"
echo -e " ${INFO} systemctl not detected. Cannot mask service."
fi
}
check_service_active() { check_service_active() {
# If systemctl exists, # If systemctl exists,
if command -v systemctl &> /dev/null; then if command -v systemctl &> /dev/null; then
@ -1201,7 +1182,7 @@ check_service_active() {
else else
return 1 return 1
fi fi
# Othwerwise, # Otherwise,
else else
# fall back to service command # fall back to service command
if service "${1}" status | grep "Active: active" > /dev/null; then if service "${1}" status | grep "Active: active" > /dev/null; then
@ -1385,7 +1366,7 @@ installPiholeWeb() {
# back it up # back it up
mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${TICK} ${str}"
# Othwerwise, # Otherwise,
else else
# don't do anything # don't do anything
echo -e "${OVER} ${CROSS} ${str} echo -e "${OVER} ${CROSS} ${str}
@ -1458,7 +1439,7 @@ create_pihole_user() {
if id -u pihole &> /dev/null; then if id -u pihole &> /dev/null; then
# just show a success # just show a success
echo -ne "${OVER} ${TICK} ${str}" echo -ne "${OVER} ${TICK} ${str}"
# Othwerwise, # Otherwise,
else else
echo -ne "${OVER} ${CROSS} ${str}" echo -ne "${OVER} ${CROSS} ${str}"
local str="Creating user 'pihole'" local str="Creating user 'pihole'"
@ -1498,7 +1479,7 @@ configureFirewall() {
iptables -C INPUT -p tcp -m tcp --dport 4711:4720 -i lo -j ACCEPT &> /dev/null || iptables -I INPUT 1 -p tcp -m tcp --dport 4711:4720 -i lo -j ACCEPT iptables -C INPUT -p tcp -m tcp --dport 4711:4720 -i lo -j ACCEPT &> /dev/null || iptables -I INPUT 1 -p tcp -m tcp --dport 4711:4720 -i lo -j ACCEPT
return 0 return 0
fi fi
# Othwerwise, # Otherwise,
else else
# no firewall is running # no firewall is running
echo -e " ${INFO} No active firewall detected.. skipping firewall configuration" echo -e " ${INFO} No active firewall detected.. skipping firewall configuration"