mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 06:08:21 +00:00
Manual page install function
Function to install man page. Verifies that man pages are installed, and correct directory for the pihole manpage is present. Copies file, and runs man-db to update man page database. Signed-off-by: Rob Gill <rrobgill@protonmail.com>
This commit is contained in:
parent
ef17f4913b
commit
a8103ca22d
@ -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; 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} ${INFO} 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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user