@@ -1193,6 +1193,37 @@ installConfigs() {
|
||||
fi
|
||||
}
|
||||
|
||||
install_manpage() {
|
||||
# Copy Pi-hole man page and call mandb to update man page database
|
||||
# Default location for man files for /usr/local/bin is /usr/local/share/man
|
||||
# on lightweight systems may not be present, so check before copying.
|
||||
echo -en " ${INFO} Testing man page installation"
|
||||
if ! command -v mandb &>/dev/null; then
|
||||
# if mandb is not present, no manpage support
|
||||
echo -e "${OVER} ${INFO} man not installed"
|
||||
return
|
||||
elif [[ ! -d "/usr/local/share/man" ]]; then
|
||||
# appropriate directory for Pi-hole's man page is not present
|
||||
echo -e "${OVER} ${INFO} man page not installed"
|
||||
return
|
||||
elif [[ ! -d "/usr/local/share/man/man8" ]]; then
|
||||
# if not present, create man8 directory
|
||||
mkdir /usr/local/share/man/man8
|
||||
fi
|
||||
# Testing complete, copy the file & update the man db
|
||||
cp ${PI_HOLE_LOCAL_REPO}/pihole.8 /usr/local/share/man/man8/pihole.8
|
||||
if mandb -q &>/dev/null; then
|
||||
# Updated successfully
|
||||
echo -e "${OVER} ${TICK} man page installed and database updated"
|
||||
return
|
||||
else
|
||||
# Something is wrong with the system's man installation, clean up
|
||||
# our file, (leave everything how we found it).
|
||||
rm /usr/local/share/man/man8/pihole.8
|
||||
echo -e "${OVER} ${CROSS} man page db not updated, man page not installed"
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
# Stop service passed in as argument.
|
||||
# Can softfail, as process may not be installed when this is called
|
||||
@@ -1695,6 +1726,9 @@ installPihole() {
|
||||
configureFirewall
|
||||
fi
|
||||
|
||||
# install a man page entry for pihole
|
||||
install_manpage
|
||||
|
||||
# Update setupvars.conf with any variables that may or may not have been changed during the install
|
||||
finalExports
|
||||
}
|
||||
|
@@ -171,6 +171,13 @@ removeNoPurge() {
|
||||
echo -e "${OVER} ${TICK} Removed pihole-FTL"
|
||||
fi
|
||||
|
||||
# If the pihole manpage exists, then delete and rebuild man-db
|
||||
if [[ -f /usr/local/share/man/man8/pihole.8 ]]; then
|
||||
${SUDO} rm -f /usr/local/share/man/man8/pihole.8
|
||||
${SUDO} mandb -q &>/dev/null
|
||||
echo -e " ${TICK} Removed pihole man page"
|
||||
fi
|
||||
|
||||
# If the pihole user exists, then remove
|
||||
if id "pihole" &> /dev/null; then
|
||||
if ${SUDO} userdel -r pihole 2> /dev/null; then
|
||||
|
Reference in New Issue
Block a user