handle arguments better, convert to flags, echo when they're set to true.

This commit is contained in:
Promofaux 2016-10-15 20:52:20 +01:00
parent a43577fa26
commit e612003293

View file

@ -40,7 +40,7 @@ columns=$(tput cols)
r=$(( rows / 2 )) r=$(( rows / 2 ))
c=$(( columns / 2 )) c=$(( columns / 2 ))
######## Flags. Shhh ######## ######## Undocumented Flags. Shhh ########
skipSpaceCheck=false skipSpaceCheck=false
skipRepoUpdate=false skipRepoUpdate=false
runUnattended=false runUnattended=false
@ -890,6 +890,7 @@ update_dialogs(){
main() { main() {
# Check arguments for the undocumented flags
for var in "$@" for var in "$@"
do do
case "$var" in case "$var" in
@ -901,6 +902,7 @@ done
if [[ -f ${setupVars} ]];then if [[ -f ${setupVars} ]];then
if [ "$runUnattended" = true ]; then if [ "$runUnattended" = true ]; then
echo "::: --unattended passed to install script, no whiptail dialogs will be displayed"
useUpdateVars=true useUpdateVars=true
else else
update_dialogs update_dialogs
@ -910,8 +912,7 @@ fi
# Start the installer # Start the installer
# Verify there is enough disk space for the install # Verify there is enough disk space for the install
if [[ "$skipSpaceCheck" = true ]]; then if [[ "$skipSpaceCheck" = true ]]; then
echo "::: --i_do_not_follow_recommendations passed to script" echo "::: --i_do_not_follow_recommendations passed to script, skipping free disk space verification!"
echo "::: skipping free disk space verification!"
else else
verifyFreeDiskSpace verifyFreeDiskSpace
fi fi
@ -928,6 +929,14 @@ install_dependent_packages INSTALLER_DEPS[@]
# Install packages used by the Pi-hole # Install packages used by the Pi-hole
install_dependent_packages PIHOLE_DEPS[@] install_dependent_packages PIHOLE_DEPS[@]
if [[ "$skipRepoUpdate" = true ]]; then
echo "::: --reconfigure passed to install script. Not downloading/updating local repos"
else
# Get Git files for Core and Admin
getGitFiles ${piholeFilesDir} ${piholeGitUrl}
getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl}
fi
if [[ ${useUpdateVars} == false ]]; then if [[ ${useUpdateVars} == false ]]; then
# Display welcome dialogs # Display welcome dialogs
welcomeDialogs welcomeDialogs
@ -935,9 +944,6 @@ if [[ ${useUpdateVars} == false ]]; then
mkdir -p /etc/pihole/ mkdir -p /etc/pihole/
# Remove legacy scripts from previous storage location # Remove legacy scripts from previous storage location
remove_legacy_scripts remove_legacy_scripts
# Get Git files for Core and Admin
getGitFiles ${piholeFilesDir} ${piholeGitUrl}
getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl}
# Stop resolver and webserver while installing proceses # Stop resolver and webserver while installing proceses
stop_service dnsmasq stop_service dnsmasq
stop_service lighttpd stop_service lighttpd