Compare commits
31 Commits
v6.0
...
43ee724718
| Author | SHA1 | Date | |
|---|---|---|---|
| 43ee724718 | |||
| 4609f90860 | |||
| 9840b42847 | |||
| b59ab5852a | |||
| 48c4efd7b0 | |||
| 9c995962a5 | |||
| a7e414aca4 | |||
| 567bb724b1 | |||
| bc3c78f4fa | |||
| ce18de3d6d | |||
| 8e706e4a16 | |||
| 667a25574a | |||
| 8f5296536e | |||
| da4048ba5d | |||
| 1764f99333 | |||
| cadee26dba | |||
| b64a54bba1 | |||
| 5d5bddc979 | |||
| bd3a0f4891 | |||
| cd269cbca1 | |||
| 8290e414ce | |||
| 0e6d9e74d9 | |||
| f38332409f | |||
| cd4efc3141 | |||
| 99bd142dd5 | |||
| 49bb6dc0da | |||
| 6f82ec5121 | |||
| 9de976cbbd | |||
| 0890f67322 | |||
| f7403e2ee6 | |||
| 51a9412c4b |
@@ -34,6 +34,12 @@ TestAPIAvailability() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If an error occurred, the variable starts with ;;
|
||||||
|
if [ "${chaos_api_list#;;}" != "${chaos_api_list}" ]; then
|
||||||
|
echo "Communication error. Is FTL running?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Iterate over space-separated list of URLs
|
# Iterate over space-separated list of URLs
|
||||||
while [ -n "${chaos_api_list}" ]; do
|
while [ -n "${chaos_api_list}" ]; do
|
||||||
# Get the first URL
|
# Get the first URL
|
||||||
|
|||||||
@@ -97,6 +97,50 @@ GitCheckUpdateAvail() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateWarnDialog() {
|
||||||
|
# Display the warning dialog
|
||||||
|
|
||||||
|
local core_str web_str ftl_str
|
||||||
|
|
||||||
|
if [[ "${core_update}" == true ]]; then
|
||||||
|
core_str="Core: \\Zb\\Z1update available\\Zn"
|
||||||
|
else
|
||||||
|
core_str="Core: \\Zb\\Z4up to date\\Zn"
|
||||||
|
fi
|
||||||
|
if [[ "${web_update}" == true ]]; then
|
||||||
|
web_str="Web: \\Zb\\Z1update available\\Zn"
|
||||||
|
else
|
||||||
|
web_str="Web: \\Zb\\Z4up to date\\Zn"
|
||||||
|
fi
|
||||||
|
if [[ "${FTL_update}" == true ]]; then
|
||||||
|
ftl_str="FTL: \\Zb\\Z1update available\\Zn"
|
||||||
|
else
|
||||||
|
ftl_str="FTL: \\Zb\\Z4up to date\\Zn"
|
||||||
|
fi
|
||||||
|
# shellcheck disable=SC2154 # Variables "${r}" "${c}" are defined in the main script
|
||||||
|
dialog --no-shadow --clear --keep-tite \
|
||||||
|
--colors \
|
||||||
|
--backtitle "Updating Pi-hole" \
|
||||||
|
--title "Warning" \
|
||||||
|
--no-button "Exit" --yes-button "Continue" \
|
||||||
|
--defaultno \
|
||||||
|
--yesno "\\nThe following Pi-hole components are going to be updated.\\n\\n\\n\
|
||||||
|
$core_str\\n\
|
||||||
|
$web_str\\n\
|
||||||
|
$ftl_str\\n\\n\\n\
|
||||||
|
\\Zb\\Z1IMPORTANT:\\Zn Make a (teleporter) backup of your system!\\n\\n\
|
||||||
|
Updates can come with significant changes. Please read the changelog at https://pi-hole.net/blog carefully.\\n\\n\\n\
|
||||||
|
Please confirm you want to start the update process." \
|
||||||
|
"${r}" "${c}" && result=0 || result="$?"
|
||||||
|
|
||||||
|
case "${result}" in
|
||||||
|
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
||||||
|
printf " %b User canceled the update process.\\n" "${INFO}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
local basicError="\\n ${COL_LIGHT_RED}Unable to complete update, please contact Pi-hole Support${COL_NC}"
|
local basicError="\\n ${COL_LIGHT_RED}Unable to complete update, please contact Pi-hole Support${COL_NC}"
|
||||||
local core_update
|
local core_update
|
||||||
@@ -198,6 +242,11 @@ main() {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if there is any update, show the warning dialog and ask for confirmation
|
||||||
|
if [[ "${core_update}" == true || "${web_update}" == true || "${FTL_update}" == true ]]; then
|
||||||
|
updateWarnDialog
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${core_update}" == true ]]; then
|
if [[ "${core_update}" == true ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " ${INFO} Pi-hole core files out of date, updating local repo."
|
echo -e " ${INFO} Pi-hole core files out of date, updating local repo."
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ chmod 0755 /etc/pihole /var/log/pihole
|
|||||||
|
|
||||||
# allow pihole to access subdirs in /etc/pihole (sets execution bit on dirs)
|
# allow pihole to access subdirs in /etc/pihole (sets execution bit on dirs)
|
||||||
# credits https://stackoverflow.com/a/11512211
|
# credits https://stackoverflow.com/a/11512211
|
||||||
find /etc/pihole -type d -exec chmod 0755 {} \;
|
find /etc/pihole/ -type d -exec chmod 0755 {} \;
|
||||||
|
|
||||||
# Touch files to ensure they exist (create if non-existing, preserve if existing)
|
# Touch files to ensure they exist (create if non-existing, preserve if existing)
|
||||||
[ -f "${FTL_PID_FILE}" ] || install -D -m 644 -o pihole -g pihole /dev/null "${FTL_PID_FILE}"
|
[ -f "${FTL_PID_FILE}" ] || install -D -m 644 -o pihole -g pihole /dev/null "${FTL_PID_FILE}"
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ IPV6_ADDRESS=${IPV6_ADDRESS}
|
|||||||
QUERY_LOGGING=
|
QUERY_LOGGING=
|
||||||
WEBPORT=
|
WEBPORT=
|
||||||
PRIVACY_LEVEL=
|
PRIVACY_LEVEL=
|
||||||
|
v5_to_v6_update=false
|
||||||
|
|
||||||
# Where old configs go to if a v6 migration is performed
|
# Where old configs go to if a v6 migration is performed
|
||||||
V6_CONF_MIGRATION_DIR="/etc/pihole/migration_backup_v6"
|
V6_CONF_MIGRATION_DIR="/etc/pihole/migration_backup_v6"
|
||||||
@@ -1160,27 +1161,23 @@ installDefaultBlocklists() {
|
|||||||
echo "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >>"${adlistFile}"
|
echo "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >>"${adlistFile}"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_old_dnsmasq_ftl_configs() {
|
move_old_dnsmasq_ftl_configs() {
|
||||||
# Local, named variables
|
# Create migration directory /etc/pihole/migration_backup_v6
|
||||||
|
# and make it owned by pihole:pihole
|
||||||
|
mkdir -p "${V6_CONF_MIGRATION_DIR}"
|
||||||
|
chown pihole:pihole "${V6_CONF_MIGRATION_DIR}"
|
||||||
|
|
||||||
|
# Move all conf files originally created by Pi-hole into this directory
|
||||||
|
# - 01-pihole.conf
|
||||||
|
# - 02-pihole-dhcp.conf
|
||||||
|
# - 04-pihole-static-dhcp.conf
|
||||||
|
# - 05-pihole-custom-cname.conf
|
||||||
|
# - 06-rfc6761.conf
|
||||||
|
mv /etc/dnsmasq.d/0{1,2,4,5}-pihole*.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
|
||||||
|
mv /etc/dnsmasq.d/06-rfc6761.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
|
||||||
|
|
||||||
|
# If the dnsmasq main config file exists
|
||||||
local dnsmasq_conf="/etc/dnsmasq.conf"
|
local dnsmasq_conf="/etc/dnsmasq.conf"
|
||||||
local pihole_01="/etc/dnsmasq.d/01-pihole.conf"
|
|
||||||
local rfc6761_06="/etc/dnsmasq.d/06-rfc6761.conf"
|
|
||||||
local pihole_dhcp_02="/etc/dnsmasq.d/02-pihole-dhcp.conf"
|
|
||||||
|
|
||||||
# pihole-FTL does some fancy stuff with config these days, and so we can remove some old config files
|
|
||||||
if [[ -f "${pihole_01}" ]]; then
|
|
||||||
rm "${pihole_01}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "${rfc6761_06}" ]]; then
|
|
||||||
rm "${rfc6761_06}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "${pihole_dhcp_02}" ]]; then
|
|
||||||
rm "${pihole_dhcp_02}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If the dnsmasq config file exists
|
|
||||||
if [[ -f "${dnsmasq_conf}" ]]; then
|
if [[ -f "${dnsmasq_conf}" ]]; then
|
||||||
# There should not be anything custom in here for Pi-hole users
|
# There should not be anything custom in here for Pi-hole users
|
||||||
# It is no longer needed, but we'll back it up instead of deleting it just in case
|
# It is no longer needed, but we'll back it up instead of deleting it just in case
|
||||||
@@ -1211,12 +1208,12 @@ remove_old_pihole_lighttpd_configs() {
|
|||||||
lighty-disable-mod pihole-admin >/dev/null || true
|
lighty-disable-mod pihole-admin >/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${confavailable}" ]]; then
|
if [[ -f "${confenabled}" || -L "${confenabled}" ]]; then
|
||||||
rm "${confavailable}"
|
rm "${confenabled}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${confenabled}" ]]; then
|
if [[ -f "${confavailable}" ]]; then
|
||||||
rm "${confenabled}"
|
rm "${confavailable}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1694,7 +1691,8 @@ installPihole() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
remove_old_dnsmasq_ftl_configs
|
# Move old dnsmasq files to $V6_CONF_MIGRATION_DIR for later migration via migrate_dnsmasq_configs()
|
||||||
|
move_old_dnsmasq_ftl_configs
|
||||||
remove_old_pihole_lighttpd_configs
|
remove_old_pihole_lighttpd_configs
|
||||||
|
|
||||||
# Install config files
|
# Install config files
|
||||||
@@ -1766,7 +1764,7 @@ displayFinalMessage() {
|
|||||||
if [[ "${#1}" -gt 0 ]]; then
|
if [[ "${#1}" -gt 0 ]]; then
|
||||||
# set the password to the first argument.
|
# set the password to the first argument.
|
||||||
pwstring="$1"
|
pwstring="$1"
|
||||||
elif [[ $(pihole-FTL --config webserver.api.pwhash) == '""' ]]; then
|
elif [[ -n $(pihole-FTL --config webserver.api.pwhash) ]]; then
|
||||||
# Else if the password exists from previous setup, we'll load it later
|
# Else if the password exists from previous setup, we'll load it later
|
||||||
pwstring="unchanged"
|
pwstring="unchanged"
|
||||||
else
|
else
|
||||||
@@ -2122,7 +2120,7 @@ get_binary_name() {
|
|||||||
else
|
else
|
||||||
printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}"
|
printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}"
|
||||||
fi
|
fi
|
||||||
l_binary="pihole-FTL-linux-386"
|
l_binary="pihole-FTL-386"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Returning a string value via echo
|
# Returning a string value via echo
|
||||||
@@ -2311,33 +2309,18 @@ migrate_dnsmasq_configs() {
|
|||||||
# avoid conflicts with other services on this system
|
# avoid conflicts with other services on this system
|
||||||
|
|
||||||
# Exit early if this is already Pi-hole v6.0
|
# Exit early if this is already Pi-hole v6.0
|
||||||
# We decide this on the presence of the file /etc/pihole/pihole.toml
|
# We decide this on the non-existence of the file /etc/pihole/setupVars.conf (either moved by previous migration or fresh install)
|
||||||
if [[ -f "${PI_HOLE_V6_CONFIG}" ]]; then
|
if [[ ! -f "/etc/pihole/setupVars.conf" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable lighttpd server during v6 migration
|
# Disable lighttpd server during v6 migration
|
||||||
disableLighttpd
|
disableLighttpd
|
||||||
|
|
||||||
# Create target directory /etc/pihole/migration_backup_v6
|
# move_old_dnsmasq_ftl_configs() moved everything is in place,
|
||||||
# and make it owned by pihole:pihole
|
# so we can create the new config file /etc/pihole/pihole.toml
|
||||||
mkdir -p "${V6_CONF_MIGRATION_DIR}"
|
|
||||||
chown pihole:pihole "${V6_CONF_MIGRATION_DIR}"
|
|
||||||
|
|
||||||
# Move all conf files originally created by Pi-hole into this directory
|
|
||||||
# - 01-pihole.conf
|
|
||||||
# - 02-pihole-dhcp.conf
|
|
||||||
# - 04-pihole-static-dhcp.conf
|
|
||||||
# - 05-pihole-custom-cname.conf
|
|
||||||
# - 06-rfc6761.conf
|
|
||||||
|
|
||||||
mv /etc/dnsmasq.d/0{1,2,4,5}-pihole*.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
|
|
||||||
mv /etc/dnsmasq.d/06-rfc6761.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
|
|
||||||
|
|
||||||
# Finally, after everything is in place, we can create the new config file
|
|
||||||
# /etc/pihole/pihole.toml
|
|
||||||
# This file will be created with the default settings unless the user has
|
# This file will be created with the default settings unless the user has
|
||||||
# changed settings via setupVars.conf or the other dnsmasq files moved above
|
# changed settings via setupVars.conf or the other dnsmasq files moved before
|
||||||
# During migration, setupVars.conf is moved to /etc/pihole/migration_backup_v6
|
# During migration, setupVars.conf is moved to /etc/pihole/migration_backup_v6
|
||||||
str="Migrating Pi-hole configuration to version 6"
|
str="Migrating Pi-hole configuration to version 6"
|
||||||
printf " %b %s..." "${INFO}" "${str}"
|
printf " %b %s..." "${INFO}" "${str}"
|
||||||
@@ -2356,6 +2339,8 @@ migrate_dnsmasq_configs() {
|
|||||||
|
|
||||||
# Print a blank line for separation
|
# Print a blank line for separation
|
||||||
printf "\\n"
|
printf "\\n"
|
||||||
|
|
||||||
|
v5_to_v6_update=true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for availability of either the "service" or "systemctl" commands
|
# Check for availability of either the "service" or "systemctl" commands
|
||||||
@@ -2515,18 +2500,11 @@ main() {
|
|||||||
# Copy the temp log file into final log location for storage
|
# Copy the temp log file into final log location for storage
|
||||||
copy_to_install_log
|
copy_to_install_log
|
||||||
|
|
||||||
# Add password to web UI if there is none
|
|
||||||
pw=""
|
|
||||||
# If no password is set,
|
|
||||||
if [[ $(pihole-FTL --config webserver.api.pwhash) == '""' ]]; then
|
|
||||||
# generate a random password
|
|
||||||
pw=$(tr -dc _A-Z-a-z-0-9 </dev/urandom | head -c 8)
|
|
||||||
pihole setpassword "${pw}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Migrate existing install to v6.0
|
# Migrate existing install to v6.0
|
||||||
migrate_dnsmasq_configs
|
migrate_dnsmasq_configs
|
||||||
|
|
||||||
|
|
||||||
# Check for and disable systemd-resolved-DNSStubListener before reloading resolved
|
# Check for and disable systemd-resolved-DNSStubListener before reloading resolved
|
||||||
# DNSStubListener needs to remain in place for installer to download needed files,
|
# DNSStubListener needs to remain in place for installer to download needed files,
|
||||||
# so this change needs to be made after installation is complete,
|
# so this change needs to be made after installation is complete,
|
||||||
@@ -2549,9 +2527,23 @@ main() {
|
|||||||
|
|
||||||
restart_service pihole-FTL
|
restart_service pihole-FTL
|
||||||
|
|
||||||
# write privacy level and logging to pihole.toml
|
# Add password to web UI if there is none
|
||||||
|
pw=""
|
||||||
|
# If this is a fresh installation and no password is set,
|
||||||
|
if [[ ${v5_to_v6_update} = false && -z $(getFTLConfigValue webserver.api.pwhash) ]]; then
|
||||||
|
# generate a random password
|
||||||
|
pw=$(tr -dc _A-Z-a-z-0-9 </dev/urandom | head -c 8)
|
||||||
|
pihole setpassword "${pw}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# apply settings to pihole.toml
|
||||||
# needs to be done after FTL service has been started, otherwise pihole.toml does not exist
|
# needs to be done after FTL service has been started, otherwise pihole.toml does not exist
|
||||||
# set on fresh installations by setPrivacyLevel() and setLogging(
|
# set on fresh installations by setDNS() and setPrivacyLevel() and setLogging()
|
||||||
|
if [ -n "${PIHOLE_DNS_1}" ]; then
|
||||||
|
local string="\"${PIHOLE_DNS_1}\""
|
||||||
|
[ -n "${PIHOLE_DNS_2}" ] && string+=", \"${PIHOLE_DNS_2}\""
|
||||||
|
setFTLConfigValue "dns.upstreams" "[ $string ]"
|
||||||
|
fi
|
||||||
if [ -n "${QUERY_LOGGING}" ]; then
|
if [ -n "${QUERY_LOGGING}" ]; then
|
||||||
setFTLConfigValue "dns.queryLogging" "${QUERY_LOGGING}"
|
setFTLConfigValue "dns.queryLogging" "${QUERY_LOGGING}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -1082,7 +1082,7 @@ migrate_to_listsCache_dir() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Update the list's paths in the corresponding .sha1 files to the new location
|
# Update the list's paths in the corresponding .sha1 files to the new location
|
||||||
sed -i "s|${piholeDir}/|${listsCacheDir}/|g" "${listsCacheDir}"/*.sha1
|
sed -i "s|${piholeDir}/|${listsCacheDir}/|g" "${listsCacheDir}"/*.sha1 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
helpFunc() {
|
helpFunc() {
|
||||||
|
|||||||
@@ -398,7 +398,10 @@ tailFunc() {
|
|||||||
|
|
||||||
piholeCheckoutFunc() {
|
piholeCheckoutFunc() {
|
||||||
if [ -n "${DOCKER_VERSION}" ]; then
|
if [ -n "${DOCKER_VERSION}" ]; then
|
||||||
unsupportedFunc
|
echo -e "${CROSS} Function not supported in Docker images"
|
||||||
|
echo "Please build a custom image following the steps at"
|
||||||
|
echo "https://github.com/pi-hole/docker-pi-hole?tab=readme-ov-file#building-the-image-locally"
|
||||||
|
exit 0
|
||||||
else
|
else
|
||||||
if [[ "$2" == "-h" ]] || [[ "$2" == "--help" ]]; then
|
if [[ "$2" == "-h" ]] || [[ "$2" == "--help" ]]; then
|
||||||
echo "Switch Pi-hole subsystems to a different GitHub branch
|
echo "Switch Pi-hole subsystems to a different GitHub branch
|
||||||
|
|||||||
Reference in New Issue
Block a user