From 8117ec8e20fe7253009b87922cdbc9d9e50a5ddc Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Tue, 20 Dec 2016 17:50:44 -0800 Subject: [PATCH 1/3] Remove v1 legacy detection code. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index a04cac3f..77d28651 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -62,7 +62,7 @@ else echo ":::" echo "::: Detecting the presence of the sudo utility for continuation of this install..." - if [ -x "$(command -v sudo)" ]; then + if command -v sudo; then echo "::: Utility sudo located." exec curl -sSL https://install.pi-hole.net | sudo bash "$@" exit $? @@ -74,7 +74,7 @@ fi # Compatibility -if [[ $(command -v apt-get) ]]; then +if command -v apt-get; then #Debian Family ############################################# PKG_MANAGER="apt-get" @@ -101,9 +101,9 @@ if [[ $(command -v apt-get) ]]; then package_check_install() { dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep -c "ok installed" || ${PKG_INSTALL} "${1}" } -elif [ $(command -v rpm) ]; then +elif command -v rpm; then # Fedora Family - if [ $(command -v dnf) ]; then + if command -v dnf; then PKG_MANAGER="dnf" else PKG_MANAGER="yum" @@ -623,16 +623,6 @@ version_check_dnsmasq() { fi } -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 -} - clean_existing() { # Clean an exiting installation to prepare for upgrade/reinstall # ${1} Directory to clean; ${2} Array of files to remove From 58261098fbb2847eb7e08f4610c998e165b4e9f1 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 21 Dec 2016 12:07:44 +0100 Subject: [PATCH 2/3] We should not call a function that Dan deleted --- automated install/basic-install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0c47aacd..cddc4dbf 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1059,8 +1059,6 @@ main() { welcomeDialogs # Create directory for Pi-hole storage mkdir -p /etc/pihole/ - # Remove legacy scripts from previous storage location - remove_legacy_scripts # Stop resolver and webserver while installing proceses stop_service dnsmasq stop_service lighttpd From 8841bdd2523be3774b245064173979c12d436df7 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 21 Dec 2016 12:57:02 +0100 Subject: [PATCH 3/3] Reset the if's --- automated install/basic-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index cddc4dbf..fb8570e0 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -62,7 +62,7 @@ else echo ":::" echo "::: Detecting the presence of the sudo utility for continuation of this install..." - if command -v sudo; then + if [ -x "$(command -v sudo)" ]; then echo "::: Utility sudo located." exec curl -sSL https://install.pi-hole.net | sudo bash "$@" exit $? @@ -74,7 +74,7 @@ fi # Compatibility -if command -v apt-get; then +if [[ $(command -v apt-get) ]]; then #Debian Family ############################################# PKG_MANAGER="apt-get" @@ -101,9 +101,9 @@ if command -v apt-get; then package_check_install() { dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep -c "ok installed" || ${PKG_INSTALL} "${1}" } -elif command -v rpm; then +elif [ $(command -v rpm) ]; then # Fedora Family - if command -v dnf; then + if [ $(command -v dnf) ]; then PKG_MANAGER="dnf" else PKG_MANAGER="yum"