mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-25 07:33:43 +00:00
Add TRAP to the installer
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
parent
c47f8c2cd6
commit
cd7e5abe25
1 changed files with 12 additions and 0 deletions
|
@ -25,6 +25,9 @@ set -e
|
||||||
# When using "su" an incomplete PATH could be passed: https://github.com/pi-hole/pi-hole/issues/3209
|
# When using "su" an incomplete PATH could be passed: https://github.com/pi-hole/pi-hole/issues/3209
|
||||||
export PATH+=':/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
|
export PATH+=':/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
|
||||||
|
|
||||||
|
# Trap any errors, then exit
|
||||||
|
trap abort INT QUIT TERM
|
||||||
|
|
||||||
######## VARIABLES #########
|
######## VARIABLES #########
|
||||||
# For better maintainability, we store as much information that can change in variables
|
# For better maintainability, we store as much information that can change in variables
|
||||||
# This allows us to make a change in one place that can propagate to all instances of the variable
|
# This allows us to make a change in one place that can propagate to all instances of the variable
|
||||||
|
@ -195,6 +198,15 @@ show_ascii_berry() {
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abort() {
|
||||||
|
echo -e "\\n\\n ${COL_LIGHT_RED}Installation was interrupted${COL_NC}\\n"
|
||||||
|
echo -e "Pi-hole's dependencies might be already installed. If you want to remove them you can try to\\n"
|
||||||
|
echo -e "a) run 'pihole uninstall' \\n"
|
||||||
|
echo -e "b) Remove the meta-package 'pihole-meta' manually \\n"
|
||||||
|
echo -e "E.g. sudo apt-get remove pihole-meta && apt-get autoremove \\n"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
is_command() {
|
is_command() {
|
||||||
# Checks to see if the given command (passed as a string argument) exists on the system.
|
# Checks to see if the given command (passed as a string argument) exists on the system.
|
||||||
# The function returns 0 (success) if the command exists, and 1 if it doesn't.
|
# The function returns 0 (success) if the command exists, and 1 if it doesn't.
|
||||||
|
|
Loading…
Reference in a new issue