mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-07-28 16:14:07 +02:00
Update update.sh, updatecheck.sh and uninstall.sh to honour pihole.to… (#5981)
This commit is contained in:
commit
bdcb6fc88c
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
readonly ADMIN_INTERFACE_GIT_URL="https://github.com/pi-hole/web.git"
|
readonly ADMIN_INTERFACE_GIT_URL="https://github.com/pi-hole/web.git"
|
||||||
readonly ADMIN_INTERFACE_DIR="/var/www/html/admin"
|
|
||||||
readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git"
|
readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git"
|
||||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||||
|
|
||||||
@ -26,12 +25,18 @@ CHECK_ONLY=false
|
|||||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source "/opt/pihole/COL_TABLE"
|
source "/opt/pihole/COL_TABLE"
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${PI_HOLE_INSTALL_DIR}/utils.sh"
|
||||||
|
|
||||||
# is_repo() sourced from basic-install.sh
|
# is_repo() sourced from basic-install.sh
|
||||||
# make_repo() sourced from basic-install.sh
|
# make_repo() sourced from basic-install.sh
|
||||||
# update_repo() source from basic-install.sh
|
# update_repo() source from basic-install.sh
|
||||||
# getGitFiles() sourced from basic-install.sh
|
# getGitFiles() sourced from basic-install.sh
|
||||||
# FTLcheckUpdate() sourced from basic-install.sh
|
# FTLcheckUpdate() sourced from basic-install.sh
|
||||||
|
# getFTLConfigValue() sourced from utils.sh
|
||||||
|
|
||||||
|
# Honour configured paths for the web application.
|
||||||
|
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||||
|
|
||||||
GitCheckUpdateAvail() {
|
GitCheckUpdateAvail() {
|
||||||
local directory
|
local directory
|
||||||
@ -209,7 +214,7 @@ main() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo -e " ${INFO} Pi-hole Web Admin files out of date, updating local repo."
|
echo -e " ${INFO} Pi-hole Web Admin files out of date, updating local repo."
|
||||||
getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}"
|
getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}"
|
||||||
echo -e " ${INFO} If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'"
|
echo -e " ${INFO} If you had made any changes in '${ADMIN_INTERFACE_DIR}', they have been stashed using 'git stash'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${FTL_update}" == true ]]; then
|
if [[ "${FTL_update}" == true ]]; then
|
||||||
|
@ -42,6 +42,8 @@ function get_remote_hash() {
|
|||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /opt/pihole/utils.sh
|
. /opt/pihole/utils.sh
|
||||||
|
|
||||||
|
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||||
|
|
||||||
# Remove the below three legacy files if they exist
|
# Remove the below three legacy files if they exist
|
||||||
rm -f "/etc/pihole/GitHubVersions"
|
rm -f "/etc/pihole/GitHubVersions"
|
||||||
rm -f "/etc/pihole/localbranches"
|
rm -f "/etc/pihole/localbranches"
|
||||||
@ -85,13 +87,13 @@ addOrEditKeyValPair "${VERSION_FILE}" "GITHUB_CORE_HASH" "${GITHUB_CORE_HASH}"
|
|||||||
|
|
||||||
# get Web versions
|
# get Web versions
|
||||||
|
|
||||||
WEB_VERSION="$(get_local_version /var/www/html/admin)"
|
WEB_VERSION="$(get_local_version "${ADMIN_INTERFACE_DIR}")"
|
||||||
addOrEditKeyValPair "${VERSION_FILE}" "WEB_VERSION" "${WEB_VERSION}"
|
addOrEditKeyValPair "${VERSION_FILE}" "WEB_VERSION" "${WEB_VERSION}"
|
||||||
|
|
||||||
WEB_BRANCH="$(get_local_branch /var/www/html/admin)"
|
WEB_BRANCH="$(get_local_branch "${ADMIN_INTERFACE_DIR}")"
|
||||||
addOrEditKeyValPair "${VERSION_FILE}" "WEB_BRANCH" "${WEB_BRANCH}"
|
addOrEditKeyValPair "${VERSION_FILE}" "WEB_BRANCH" "${WEB_BRANCH}"
|
||||||
|
|
||||||
WEB_HASH="$(get_local_hash /var/www/html/admin)"
|
WEB_HASH="$(get_local_hash "${ADMIN_INTERFACE_DIR}")"
|
||||||
addOrEditKeyValPair "${VERSION_FILE}" "WEB_HASH" "${WEB_HASH}"
|
addOrEditKeyValPair "${VERSION_FILE}" "WEB_HASH" "${WEB_HASH}"
|
||||||
|
|
||||||
GITHUB_WEB_VERSION="$(get_remote_version web "${WEB_BRANCH}")"
|
GITHUB_WEB_VERSION="$(get_remote_version web "${WEB_BRANCH}")"
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
# Please see LICENSE file for your rights under this license.
|
# Please see LICENSE file for your rights under this license.
|
||||||
|
|
||||||
source "/opt/pihole/COL_TABLE"
|
source "/opt/pihole/COL_TABLE"
|
||||||
|
source "/opt/pihole/utils.sh"
|
||||||
|
|
||||||
|
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -rp " ${QST} Are you sure you would like to remove ${COL_WHITE}Pi-hole${COL_NC}? [y/N] " answer
|
read -rp " ${QST} Are you sure you would like to remove ${COL_WHITE}Pi-hole${COL_NC}? [y/N] " answer
|
||||||
@ -53,17 +56,9 @@ removeMetaPackage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removePiholeFiles() {
|
removePiholeFiles() {
|
||||||
# Only web directories/files that are created by Pi-hole should be removed
|
# Remove the web interface of Pi-hole
|
||||||
echo -ne " ${INFO} Removing Web Interface..."
|
echo -ne " ${INFO} Removing Web Interface..."
|
||||||
${SUDO} rm -rf /var/www/html/admin &> /dev/null
|
${SUDO} rm -rf "${ADMIN_INTERFACE_DIR}" &> /dev/null
|
||||||
|
|
||||||
|
|
||||||
# If the web directory is empty after removing these files, then the parent html directory can be removed.
|
|
||||||
if [ -d "/var/www/html" ]; then
|
|
||||||
if [[ ! "$(ls -A /var/www/html)" ]]; then
|
|
||||||
${SUDO} rm -rf /var/www/html &> /dev/null
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo -e "${OVER} ${TICK} Removed Web Interface"
|
echo -e "${OVER} ${TICK} Removed Web Interface"
|
||||||
|
|
||||||
# Attempt to preserve backwards compatibility with older versions
|
# Attempt to preserve backwards compatibility with older versions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user