Remove 'reconfigure' option

Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
Christian König 2025-02-06 21:26:14 +01:00
parent 9d53ad7668
commit 49cf5bb221
No known key found for this signature in database
4 changed files with 26 additions and 40 deletions

View file

@ -218,7 +218,7 @@ main() {
fi fi
if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || \ ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --repair --unattended || \
echo -e "${basicError}" && exit 1 echo -e "${basicError}" && exit 1
fi fi

View file

@ -7,7 +7,7 @@ _pihole() {
case "${prev}" in case "${prev}" in
"pihole") "pihole")
opts="allow allow-regex allow-wild deny checkout debug disable enable flush help logging query reconfigure regex reloaddns reloadlists status tail uninstall updateGravity updatePihole version wildcard arpflush api" opts="allow allow-regex allow-wild deny checkout debug disable enable flush help logging query repair regex reloaddns reloadlists status tail uninstall updateGravity updatePihole version wildcard arpflush api"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;; ;;
"allow"|"deny"|"wildcard"|"regex"|"allow-regex"|"allow-wild") "allow"|"deny"|"wildcard"|"regex"|"allow-regex"|"allow-wild")

View file

@ -142,12 +142,12 @@ EOM
######## Undocumented Flags. Shhh ######## ######## Undocumented Flags. Shhh ########
# These are undocumented flags; some of which we can use when repairing an installation # These are undocumented flags; some of which we can use when repairing an installation
# The runUnattended flag is one example of this # The runUnattended flag is one example of this
reconfigure=false repair=false
runUnattended=false runUnattended=false
# Check arguments for the undocumented flags # Check arguments for the undocumented flags
for var in "$@"; do for var in "$@"; do
case "$var" in case "$var" in
"--reconfigure") reconfigure=true ;; "--repair") repair=true ;;
"--unattended") runUnattended=true ;; "--unattended") runUnattended=true ;;
esac esac
done done
@ -1111,7 +1111,7 @@ setPrivacyLevel() {
# A function to display a list of example blocklists for users to select # A function to display a list of example blocklists for users to select
chooseBlocklists() { chooseBlocklists() {
# Back up any existing adlist file, on the off chance that it exists. Useful in case of a reconfigure. # Back up any existing adlist file, on the off chance that it exists.
if [[ -f "${adlistFile}" ]]; then if [[ -f "${adlistFile}" ]]; then
mv "${adlistFile}" "${adlistFile}.old" mv "${adlistFile}" "${adlistFile}.old"
fi fi
@ -1787,21 +1787,12 @@ displayFinalMessage() {
\\n${additional}" "${r}" "${c}" \\n${additional}" "${r}" "${c}"
} }
update_dialogs() { repair_dialog() {
# If pihole -r "reconfigure" option was selected, # pihole -r/--repair option was selected
if [[ "${reconfigure}" = true ]]; then
# set some variables that will be used # set some variables that will be used
opt1a="Repair" opt1a="Repair"
opt1b="This will retain existing settings" opt1b="This will retain existing settings"
strAdd="You will remain on the same version" strAdd="You will remain on the same version"
else
# Otherwise, set some variables with different values
opt1a="Update"
opt1b="This will retain existing settings."
strAdd="You will be updated to the latest version."
fi
opt2a="Reconfigure"
opt2b="Resets Pi-hole and allows re-selecting settings."
# Display the information to the user # Display the information to the user
UpdateCmd=$(dialog --no-shadow --keep-tite --output-fd 1 \ UpdateCmd=$(dialog --no-shadow --keep-tite --output-fd 1 \
@ -1810,9 +1801,8 @@ update_dialogs() {
--menu "\\n\\nWe have detected an existing install.\ --menu "\\n\\nWe have detected an existing install.\
\\n\\nPlease choose from the following options:\ \\n\\nPlease choose from the following options:\
\\n($strAdd)" \ \\n($strAdd)" \
"${r}" "${c}" 2 \ "${r}" "${c}" 1 \
"${opt1a}" "${opt1b}" \ "${opt1a}" "${opt1b}") || result=$?
"${opt2a}" "${opt2b}") || result=$?
case ${result} in case ${result} in
"${DIALOG_CANCEL}" | "${DIALOG_ESC}") "${DIALOG_CANCEL}" | "${DIALOG_ESC}")
@ -1823,16 +1813,11 @@ update_dialogs() {
# Set the variable based on if the user chooses # Set the variable based on if the user chooses
case ${UpdateCmd} in case ${UpdateCmd} in
# repair, or # repair
"${opt1a}") "${opt1a}")
printf " %b %s option selected\\n" "${INFO}" "${opt1a}" printf " %b %s option selected\\n" "${INFO}" "${opt1a}"
useUpdateVars=true useUpdateVars=true
;; ;;
# reconfigure,
"${opt2a}")
printf " %b %s option selected\\n" "${INFO}" "${opt2a}"
useUpdateVars=false
;;
esac esac
} }
@ -1923,9 +1908,9 @@ checkout_pull_branch() {
} }
clone_or_update_repos() { clone_or_update_repos() {
# If the user wants to reconfigure, # If the user wants to repair/update,
if [[ "${reconfigure}" == true ]]; then if [[ "${repair}" == true ]]; then
printf " %b Performing reconfiguration, skipping download of local repos\\n" "${INFO}" printf " %b Resetting local repos\\n" "${INFO}"
# Reset the Core repo # Reset the Core repo
resetRepo ${PI_HOLE_LOCAL_REPO} || resetRepo ${PI_HOLE_LOCAL_REPO} ||
{ {
@ -1938,7 +1923,7 @@ clone_or_update_repos() {
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_LIGHT_RED}" "${webInterfaceDir}" "${COL_NC}" printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_LIGHT_RED}" "${webInterfaceDir}" "${COL_NC}"
exit 1 exit 1
} }
# Otherwise, a repair is happening # Otherwise, a fresh installation is happening
else else
# so get git files for Core # so get git files for Core
getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} || getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} ||
@ -2455,8 +2440,9 @@ main() {
# also disable debconf-apt-progress dialogs # also disable debconf-apt-progress dialogs
export DEBIAN_FRONTEND="noninteractive" export DEBIAN_FRONTEND="noninteractive"
else else
# If running attended, show the available options (repair/reconfigure) # If running attended, show the available options (repair/cancel)
update_dialogs # if repair is selected useUpdateVars will be 'true'
repair_dialog
fi fi
fi fi

10
pihole
View file

@ -107,11 +107,11 @@ updatePiholeFunc() {
fi fi
} }
reconfigurePiholeFunc() { repairPiholeFunc() {
if [ -n "${DOCKER_VERSION}" ]; then if [ -n "${DOCKER_VERSION}" ]; then
unsupportedFunc unsupportedFunc
else else
/etc/.pihole/automated\ install/basic-install.sh --reconfigure /etc/.pihole/automated\ install/basic-install.sh --repair
exit 0; exit 0;
fi fi
} }
@ -476,7 +476,7 @@ Debugging Options:
Add '-c' or '--check-database' to include a Pi-hole database integrity check Add '-c' or '--check-database' to include a Pi-hole database integrity check
Add '-a' to automatically upload the log to tricorder.pi-hole.net Add '-a' to automatically upload the log to tricorder.pi-hole.net
-f, flush Flush the Pi-hole log -f, flush Flush the Pi-hole log
-r, reconfigure Reconfigure or Repair Pi-hole subsystems -r, repair Repair Pi-hole subsystems
-t, tail [arg] View the live output of the Pi-hole log. -t, tail [arg] View the live output of the Pi-hole log.
Add an optional argument to filter the log Add an optional argument to filter the log
(regular expressions are supported) (regular expressions are supported)
@ -533,7 +533,7 @@ case "${1}" in
"--allow-wild" | "allow-wild" ) need_root=0;; "--allow-wild" | "allow-wild" ) need_root=0;;
"-f" | "flush" ) ;; "-f" | "flush" ) ;;
"-up" | "updatePihole" ) ;; "-up" | "updatePihole" ) ;;
"-r" | "reconfigure" ) ;; "-r" | "repair" ) ;;
"-l" | "logging" ) ;; "-l" | "logging" ) ;;
"uninstall" ) ;; "uninstall" ) ;;
"enable" ) need_root=0;; "enable" ) need_root=0;;
@ -576,7 +576,7 @@ case "${1}" in
"-d" | "debug" ) debugFunc "$@";; "-d" | "debug" ) debugFunc "$@";;
"-f" | "flush" ) flushFunc "$@";; "-f" | "flush" ) flushFunc "$@";;
"-up" | "updatePihole" ) updatePiholeFunc "$@";; "-up" | "updatePihole" ) updatePiholeFunc "$@";;
"-r" | "reconfigure" ) reconfigurePiholeFunc;; "-r" | "repair" ) repairPiholeFunc;;
"-g" | "updateGravity" ) updateGravityFunc "$@";; "-g" | "updateGravity" ) updateGravityFunc "$@";;
"-l" | "logging" ) piholeLogging "$@";; "-l" | "logging" ) piholeLogging "$@";;
"uninstall" ) uninstallFunc;; "uninstall" ) uninstallFunc;;