mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Move first check to main()
, basic-install.sh
can now be sourced.
Set `PH_TEST=true` then `source basic-install.sh`. Careful for `set -e`. Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
fa055481a7
commit
8be37130e9
1 changed files with 22 additions and 22 deletions
|
@ -51,28 +51,6 @@ skipSpaceCheck=false
|
||||||
reconfigure=false
|
reconfigure=false
|
||||||
runUnattended=false
|
runUnattended=false
|
||||||
|
|
||||||
######## FIRST CHECK ########
|
|
||||||
# Must be root to install
|
|
||||||
echo ":::"
|
|
||||||
if [[ ${EUID} -eq 0 ]]; then
|
|
||||||
echo "::: You are root."
|
|
||||||
else
|
|
||||||
echo "::: Script called with non-root privileges. The Pi-hole installs server packages and configures"
|
|
||||||
echo "::: system networking, it requires elevated rights. Please check the contents of the script for"
|
|
||||||
echo "::: any concerns with this requirement. Please be sure to download this script from a trusted source."
|
|
||||||
echo ":::"
|
|
||||||
echo "::: Detecting the presence of the sudo utility for continuation of this install..."
|
|
||||||
|
|
||||||
if command -v sudo &> /dev/null; then
|
|
||||||
echo "::: Utility sudo located."
|
|
||||||
exec curl -sSL https://install.pi-hole.net | sudo bash "$@"
|
|
||||||
exit $?
|
|
||||||
else
|
|
||||||
echo "::: sudo is needed for the Web interface to run pihole commands. Please run this script as root and it will be automatically installed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Compatibility
|
# Compatibility
|
||||||
|
|
||||||
if command -v apt-get &> /dev/null; then
|
if command -v apt-get &> /dev/null; then
|
||||||
|
@ -1050,6 +1028,28 @@ update_dialogs() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
|
######## FIRST CHECK ########
|
||||||
|
# Must be root to install
|
||||||
|
echo ":::"
|
||||||
|
if [[ ${EUID} -eq 0 ]]; then
|
||||||
|
echo "::: You are root."
|
||||||
|
else
|
||||||
|
echo "::: Script called with non-root privileges. The Pi-hole installs server packages and configures"
|
||||||
|
echo "::: system networking, it requires elevated rights. Please check the contents of the script for"
|
||||||
|
echo "::: any concerns with this requirement. Please be sure to download this script from a trusted source."
|
||||||
|
echo ":::"
|
||||||
|
echo "::: Detecting the presence of the sudo utility for continuation of this install..."
|
||||||
|
|
||||||
|
if command -v sudo &> /dev/null; then
|
||||||
|
echo "::: Utility sudo located."
|
||||||
|
exec curl -sSL https://install.pi-hole.net | sudo bash "$@"
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
echo "::: sudo is needed for the Web interface to run pihole commands. Please run this script as root and it will be automatically installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# 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
|
||||||
|
|
Loading…
Reference in a new issue