From 25cbf4cb35d5f977ca00f942567da4c8b4f59bde Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 10 Oct 2016 01:43:10 -0700 Subject: [PATCH] Factor out legacy location script removal. --- automated install/basic-install.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index f3e51a63..d8ec764c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -524,6 +524,16 @@ versionCheckDNSmasq(){ sed -i 's/^#conf-dir=\/etc\/dnsmasq.d$/conf-dir=\/etc\/dnsmasq.d/' ${dnsFile1} } +remove_legacy_scripts(){ + #Tidy up /usr/local/bin directory if installing over previous install. + oldFiles=( gravity chronometer whitelist blacklist piholeLogFlush updateDashboard uninstall setupLCD piholeDebug) + for i in "${oldFiles[@]}"; do + if [ -f "/usr/local/bin/$i.sh" ]; then + rm /usr/local/bin/"$i".sh + fi + done +} + installScripts() { # Install the scripts from /etc/.pihole to their various locations echo ":::" @@ -537,15 +547,6 @@ installScripts() { install -o "${USER}" -Dm755 -t /usr/local/bin/ pihole install -Dm644 ./advanced/bash-completion/pihole /etc/bash_completion.d/pihole - - #Tidy up /usr/local/bin directory if installing over previous install. - oldFiles=( gravity chronometer whitelist blacklist piholeLogFlush updateDashboard uninstall setupLCD piholeDebug) - for i in "${oldFiles[@]}"; do - if [ -f "/usr/local/bin/$i.sh" ]; then - rm /usr/local/bin/"$i".sh - fi - done - echo " done." } @@ -899,6 +900,8 @@ if [[ ${useUpdateVars} == false ]]; then welcomeDialogs # Create directory for Pi-hole storage mkdir -p /etc/pihole/ + # Remove legacy scripts from previous storage location + remove_legacy_scripts # Get Git files for Core and Admin getGitFiles ${piholeFilesDir} ${piholeGitUrl} getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl}