Incorporates changes requested by @Mcat12

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
pull/2730/head
pvogt09 5 years ago
parent 5c575e73c7
commit 8a92fb24c4

@ -92,13 +92,13 @@ PoplistFile() {
# Check whitelist file exists, and if not, create it
if [[ ! -f "${whitelist}" ]]; then
touch "${whitelist}"
chmod a+r "${whitelist}"
chmod 644 "${whitelist}"
fi
# Check blacklist file exists, and if not, create it
if [[ ! -f "${blacklist}" ]]; then
touch "${blacklist}"
chmod a+r "${blacklist}"
chmod 644 "${blacklist}"
fi
for dom in "${domList[@]}"; do
@ -244,7 +244,7 @@ NukeList() {
cp -p "${listMain}" "${listMain}.bck~"
# Empty out file
echo "" > "${listMain}"
chmod a+r "${listMain}"
chmod 644 "${listMain}"
fi
}

@ -90,7 +90,7 @@ checkout() {
local path
path="development/${binary}"
echo "development" > /etc/pihole/ftlbranch
chmod a+r /etc/pihole/ftlbranch
chmod 644 /etc/pihole/ftlbranch
elif [[ "${1}" == "master" ]] ; then
# Shortcut to check out master branches
echo -e " ${INFO} Shortcut \"master\" detected - checking out master branches..."
@ -105,7 +105,7 @@ checkout() {
local path
path="master/${binary}"
echo "master" > /etc/pihole/ftlbranch
chmod a+r /etc/pihole/ftlbranch
chmod 644 /etc/pihole/ftlbranch
elif [[ "${1}" == "core" ]] ; then
str="Fetching branches from ${piholeGitUrl}"
echo -ne " ${INFO} $str"
@ -168,7 +168,7 @@ checkout() {
if check_download_exists "$path"; then
echo " ${TICK} Branch ${2} exists"
echo "${2}" > /etc/pihole/ftlbranch
chmod a+r /etc/pihole/ftlbranch
chmod 644 /etc/pihole/ftlbranch
FTLinstall "${binary}"
restart_service pihole-FTL
enable_service pihole-FTL

@ -41,7 +41,7 @@ if [[ "$@" == *"once"* ]]; then
# moved file (it will have the same file handler)
cp -p /var/log/pihole.log /var/log/pihole.log.1
echo " " > /var/log/pihole.log
chmod a+r /var/log/pihole.log
chmod 644 /var/log/pihole.log
fi
else
# Manual flushing
@ -54,7 +54,7 @@ else
echo " " > /var/log/pihole.log
if [ -f /var/log/pihole.log.1 ]; then
echo " " > /var/log/pihole.log.1
chmod a+r /var/log/pihole.log.1
chmod 644 /var/log/pihole.log.1
fi
fi
# Delete most recent 24 hours from FTL's database, leave even older data intact (don't wipe out all history)

@ -51,7 +51,7 @@ if [[ "$2" == "remote" ]]; then
GITHUB_CORE_VERSION="$(json_extract tag_name "$(curl -s 'https://api.github.com/repos/pi-hole/pi-hole/releases/latest' 2> /dev/null)")"
echo -n "${GITHUB_CORE_VERSION}" > "${GITHUB_VERSION_FILE}"
chmod a+r "${GITHUB_VERSION_FILE}"
chmod 644 "${GITHUB_VERSION_FILE}"
if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -s 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")"
@ -67,7 +67,7 @@ else
CORE_BRANCH="$(get_local_branch /etc/.pihole)"
echo -n "${CORE_BRANCH}" > "${LOCAL_BRANCH_FILE}"
chmod a+r "${LOCAL_BRANCH_FILE}"
chmod 644 "${LOCAL_BRANCH_FILE}"
if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
WEB_BRANCH="$(get_local_branch /var/www/html/admin)"
@ -81,7 +81,7 @@ else
CORE_VERSION="$(get_local_version /etc/.pihole)"
echo -n "${CORE_VERSION}" > "${LOCAL_VERSION_FILE}"
chmod a+r "${LOCAL_VERSION_FILE}"
chmod 644 "${LOCAL_VERSION_FILE}"
if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
WEB_VERSION="$(get_local_version /var/www/html/admin)"

@ -322,7 +322,7 @@ dhcp-option=option:router,${DHCP_ROUTER}
dhcp-leasefile=/etc/pihole/dhcp.leases
#quiet-dhcp
" > "${dhcpconfig}"
chmod a+r "${dhcpconfig}"
chmod 644 "${dhcpconfig}"
if [[ "${PIHOLE_DOMAIN}" != "none" ]]; then
echo "domain=${PIHOLE_DOMAIN}" >> "${dhcpconfig}"
@ -542,13 +542,13 @@ addAudit()
do
echo "${var}" >> /etc/pihole/auditlog.list
done
chmod a+r /etc/pihole/auditlog.list
chmod 644 /etc/pihole/auditlog.list
}
clearAudit()
{
echo -n "" > /etc/pihole/auditlog.list
chmod a+r /etc/pihole/auditlog.list
chmod 644 /etc/pihole/auditlog.list
}
SetPrivacyLevel() {

@ -1242,7 +1242,7 @@ version_check_dnsmasq() {
printf " %b Restoring default dnsmasq.conf..." "${INFO}"
# and replace it with the default
cp -p ${dnsmasq_original_config} ${dnsmasq_conf}
chmod a+r ${dnsmasq_conf}
chmod 644 ${dnsmasq_conf}
printf "%b %b Restoring default dnsmasq.conf...\\n" "${OVER}" "${TICK}"
# Otherwise,
else
@ -1265,7 +1265,7 @@ version_check_dnsmasq() {
fi
# Copy the new Pi-hole DNS config file into the dnsmasq.d directory
cp ${dnsmasq_pihole_01_snippet} ${dnsmasq_pihole_01_location}
chmod a+r ${dnsmasq_pihole_01_location}
chmod 644 ${dnsmasq_pihole_01_location}
printf "%b %b Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf\\n" "${OVER}" "${TICK}"
# Replace our placeholder values with the GLOBAL DNS variables that we populated earlier
# First, swap in the interface to listen on
@ -1393,10 +1393,10 @@ installConfigs() {
fi
# and copy in the config file Pi-hole needs
cp ${PI_HOLE_LOCAL_REPO}/advanced/${LIGHTTPD_CFG} /etc/lighttpd/lighttpd.conf
chmod a+r /etc/lighttpd/lighttpd.conf
chmod 644 /etc/lighttpd/lighttpd.conf
# Make sure the external.conf file exists, as lighttpd v1.4.50 crashes without it
touch /etc/lighttpd/external.conf
chmod a+r /etc/lighttpd/external.conf
chmod 644 /etc/lighttpd/external.conf
# if there is a custom block page in the html/pihole directory, replace 404 handler in lighttpd config
if [[ -f "${PI_HOLE_BLOCKPAGE_DIR}/custom.php" ]]; then
sed -i 's/^\(server\.error-handler-404\s*=\s*\).*$/\1"pihole\/custom\.php"/' /etc/lighttpd/lighttpd.conf
@ -1428,26 +1428,20 @@ install_manpage() {
if [[ ! -d "/usr/local/share/man/man8" ]]; then
# if not present, create man8 directory
mkdir /usr/local/share/man/man8
chown root:staff /usr/local/share/man/man8
chmod a+r /usr/local/share/man/man8
chmod a+x /usr/local/share/man/man8
chmod g+s /usr/local/share/man/man8
chmod 755 /usr/local/share/man/man8
fi
if [[ ! -d "/usr/local/share/man/man5" ]]; then
# if not present, create man5 directory
mkdir /usr/local/share/man/man5
chown root:staff /usr/local/share/man/man5
chmod a+r /usr/local/share/man/man5
chmod a+x /usr/local/share/man/man5
chmod g+s /usr/local/share/man/man5
chmod 755 /usr/local/share/man/man5
fi
# Testing complete, copy the files & update the man db
cp ${PI_HOLE_LOCAL_REPO}/manpages/pihole.8 /usr/local/share/man/man8/pihole.8
chmod a+r /usr/local/share/man/man8/pihole.8
chmod 644 /usr/local/share/man/man8/pihole.8
cp ${PI_HOLE_LOCAL_REPO}/manpages/pihole-FTL.8 /usr/local/share/man/man8/pihole-FTL.8
chmod a+r /usr/local/share/man/man8/pihole-FTL.8
chmod 644 /usr/local/share/man/man8/pihole-FTL.8
cp ${PI_HOLE_LOCAL_REPO}/manpages/pihole-FTL.conf.5 /usr/local/share/man/man5/pihole-FTL.conf.5
chmod a+r /usr/local/share/man/man5/pihole-FTL.conf.5
chmod 644 /usr/local/share/man/man5/pihole-FTL.conf.5
if mandb -q &>/dev/null; then
# Updated successfully
printf "%b %b man pages installed and database updated\\n" "${OVER}" "${TICK}"
@ -1838,7 +1832,7 @@ finalExports() {
echo "INSTALL_WEB_INTERFACE=${INSTALL_WEB_INTERFACE}"
echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
}>> "${setupVars}"
chmod 744 "${setupVars}"
chmod 644 "${setupVars}"
# Set the privacy level
sed -i '/PRIVACYLEVEL/d' "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf"
@ -1862,7 +1856,7 @@ installLogrotate() {
printf "\\n %b %s..." "${INFO}" "${str}"
# Copy the file over from the local repo
cp ${PI_HOLE_LOCAL_REPO}/advanced/Templates/logrotate /etc/pihole/logrotate
chmod a+r /etc/pihole/logrotate
chmod 644 /etc/pihole/logrotate
# Different operating systems have different user / group
# settings for logrotate that makes it impossible to create
# a static logrotate file that will work with e.g.
@ -2453,7 +2447,7 @@ copy_to_install_log() {
# Copy the contents of file descriptor 3 into the install log
# Since we use color codes such as '\e[1;33m', they should be removed
sed 's/\[[0-9;]\{1,5\}m//g' < /proc/$$/fd/3 > "${installLogLoc}"
chmod a+r "${installLogLoc}"
chmod 644 "${installLogLoc}"
}
main() {
@ -2539,8 +2533,7 @@ main() {
welcomeDialogs
# Create directory for Pi-hole storage
mkdir -p /etc/pihole/
chmod a+r /ect/pihole/
chmod a+x /etc/pihole/
chmod 755 /ect/pihole/
# Determine available interfaces
get_available_interfaces
# Find interfaces and let the user choose one

@ -485,7 +485,7 @@ gravity_SortAndFilterConsolidatedList() {
fi
sort -u "${piholeDir}/${parsedMatter}" > "${piholeDir}/${preEventHorizon}"
chmod a+r "${piholeDir}/${preEventHorizon}"
chmod 644 "${piholeDir}/${preEventHorizon}"
if [[ "${haveSourceUrls}" == true ]]; then
echo -e "${OVER} ${TICK} ${str}"
@ -510,7 +510,7 @@ gravity_Whitelist() {
# Print everything from preEventHorizon into whitelistMatter EXCEPT domains in $whitelistFile
comm -23 "${piholeDir}/${preEventHorizon}" <(sort "${whitelistFile}") > "${piholeDir}/${whitelistMatter}"
chmod a+r "${piholeDir}/${whitelistMatter}"
chmod 644 "${piholeDir}/${whitelistMatter}"
echo -e "${OVER} ${INFO} ${str}"
}
@ -563,7 +563,7 @@ gravity_ParseLocalDomains() {
# Empty $localList if it already exists, otherwise, create it
: > "${localList}"
chmod a+r "${localList}"
chmod 644 "${localList}"
gravity_ParseDomainsIntoHosts "${localList}.tmp" "${localList}"
@ -586,7 +586,7 @@ gravity_ParseBlacklistDomains() {
# There was no whitelist file, so use preEventHorizon instead of whitelistMatter.
cp -p "${piholeDir}/${preEventHorizon}" "${piholeDir}/${accretionDisc}"
fi
chmod a+r "${piholeDir}/${accretionDisc}"
chmod 644 "${piholeDir}/${accretionDisc}"
# Move the file over as /etc/pihole/gravity.list so dnsmasq can use it
output=$( { mv "${piholeDir}/${accretionDisc}" "${adList}"; } 2>&1 )
@ -596,7 +596,7 @@ gravity_ParseBlacklistDomains() {
echo -e "\\n ${CROSS} Unable to move ${accretionDisc} from ${piholeDir}\\n ${output}"
gravity_Cleanup "error"
fi
chmod a+r "${adList}"
chmod 644 "${adList}"
}
# Create user-added blacklist entries
@ -607,7 +607,7 @@ gravity_ParseUserDomains() {
# Copy the file over as /etc/pihole/black.list so dnsmasq can use it
cp "${blacklistFile}" "${blackList}" 2> /dev/null || \
echo -e "\\n ${CROSS} Unable to move ${blacklistFile##*/} to ${piholeDir}"
chmod a+r "${blackList}"
chmod 644 "${blackList}"
}
# Trap Ctrl-C

@ -151,12 +151,12 @@ Time:
if [[ -e "${gravitylist}" ]]; then
mv "${gravitylist}" "${gravitylist}.bck"
echo "" > "${gravitylist}"
chmod a+r "${gravitylist}"
chmod 644 "${gravitylist}"
fi
if [[ -e "${blacklist}" ]]; then
mv "${blacklist}" "${blacklist}.bck"
echo "" > "${blacklist}"
chmod a+r "${blacklist}"
chmod 644 "${blacklist}"
fi
if [[ $# > 1 ]]; then
local error=false
@ -208,11 +208,11 @@ Time:
if [[ -e "${gravitylist}.bck" ]]; then
mv "${gravitylist}.bck" "${gravitylist}"
chmod a+r "${gravitylist}"
chmod 644 "${gravitylist}"
fi
if [[ -e "${blacklist}.bck" ]]; then
mv "${blacklist}.bck" "${blacklist}"
chmod a+r "${blacklist}"
chmod 644 "${blacklist}"
fi
sed -i "/BLOCKING_ENABLED=/d" "${setupVars}"
echo "BLOCKING_ENABLED=true" >> "${setupVars}"

Loading…
Cancel
Save