From 5382b4fa3785b1f2f16201436826a3ea1cd8c725 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 5 Oct 2016 09:42:15 -0700 Subject: [PATCH 1/7] Change installScripts to use install Use the install program instead of copying files and directories in installScripts function. --- automated install/basic-install.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 4d8c602a..63ce926f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -526,11 +526,8 @@ installScripts() { # Install the scripts from /etc/.pihole to their various locations ${SUDO} echo ":::" ${SUDO} echo -n "::: Installing scripts to /opt/pihole..." - if [ ! -d /opt/pihole ]; then - ${SUDO} mkdir /opt/pihole - ${SUDO} chown "$USER":root /opt/pihole - ${SUDO} chmod u+srwx /opt/pihole - fi + ${SUDO} install -o ${USER} -m755 -d /opt/pihole + ${SUDO} cp /etc/.pihole/gravity.sh /opt/pihole/gravity.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/chronometer.sh /opt/pihole/chronometer.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/whitelist.sh /opt/pihole/whitelist.sh From 36987cb1cca0169adc9c655c9c951c04df2c9ded Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 5 Oct 2016 09:57:48 -0700 Subject: [PATCH 2/7] Continue migration to `install` --- automated install/basic-install.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 63ce926f..ed9fa7e7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -526,13 +526,11 @@ installScripts() { # Install the scripts from /etc/.pihole to their various locations ${SUDO} echo ":::" ${SUDO} echo -n "::: Installing scripts to /opt/pihole..." - ${SUDO} install -o ${USER} -m755 -d /opt/pihole - - ${SUDO} cp /etc/.pihole/gravity.sh /opt/pihole/gravity.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/chronometer.sh /opt/pihole/chronometer.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/whitelist.sh /opt/pihole/whitelist.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/blacklist.sh /opt/pihole/blacklist.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/piholeDebug.sh /opt/pihole/piholeDebug.sh + ${SUDO} install -o "${USER}" -m755 -d /opt/pihole + + cd /etc/.pihole/ + + ${SUDO} install cp "${USER}" -m755 -d /opt/pihole/ gravity.sh chronometer.sh whitelist.sh blacklist.sh piholeDebug.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /opt/pihole/piholeLogFlush.sh ${SUDO} cp /etc/.pihole/automated\ install/uninstall.sh /opt/pihole/uninstall.sh ${SUDO} cp /etc/.pihole/advanced/Scripts/setupLCD.sh /opt/pihole/setupLCD.sh From e8bb4a7e363c4316e2832af5377bcce3620466ad Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 5 Oct 2016 10:14:36 -0700 Subject: [PATCH 3/7] Continue migration to `install` --- automated install/basic-install.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ed9fa7e7..12fccfa0 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -530,12 +530,8 @@ installScripts() { cd /etc/.pihole/ - ${SUDO} install cp "${USER}" -m755 -d /opt/pihole/ gravity.sh chronometer.sh whitelist.sh blacklist.sh piholeDebug.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /opt/pihole/piholeLogFlush.sh - ${SUDO} cp /etc/.pihole/automated\ install/uninstall.sh /opt/pihole/uninstall.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/setupLCD.sh /opt/pihole/setupLCD.sh - ${SUDO} cp /etc/.pihole/advanced/Scripts/version.sh /opt/pihole/version.sh - ${SUDO} chmod 755 /opt/pihole/gravity.sh /opt/pihole/chronometer.sh /opt/pihole/whitelist.sh /opt/pihole/blacklist.sh /opt/pihole/piholeLogFlush.sh /opt/pihole/uninstall.sh /opt/pihole/setupLCD.sh /opt/pihole/version.sh + ${SUDO} install -o "${USER}" -Dm755 -t /opt/pihole/ gravity.sh + ${SUDO} install -o "${USER}" -Dm755 -t /opt/pihole/ ./advanced/Scripts/*.sh ${SUDO} cp /etc/.pihole/pihole /usr/local/bin/pihole ${SUDO} chmod 755 /usr/local/bin/pihole ${SUDO} cp /etc/.pihole/advanced/bash-completion/pihole /etc/bash_completion.d/pihole From 3600fd277e0385496bd496e350f5ed6d23f84a0a Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 5 Oct 2016 10:16:56 -0700 Subject: [PATCH 4/7] Don't need `sudo` to echo to term. --- automated install/basic-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 12fccfa0..56b9934e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -524,8 +524,8 @@ versionCheckDNSmasq(){ installScripts() { # Install the scripts from /etc/.pihole to their various locations - ${SUDO} echo ":::" - ${SUDO} echo -n "::: Installing scripts to /opt/pihole..." + echo ":::" + echo -n "::: Installing scripts to /opt/pihole..." ${SUDO} install -o "${USER}" -m755 -d /opt/pihole cd /etc/.pihole/ @@ -545,7 +545,7 @@ installScripts() { fi done - ${SUDO} echo " done." + echo " done." } installConfigs() { From 3bbac9a5f219cc07831a1e5425d1266a2e650135 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 5 Oct 2016 10:19:47 -0700 Subject: [PATCH 5/7] `install` pihole --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 56b9934e..6308a0ed 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -532,8 +532,8 @@ installScripts() { ${SUDO} install -o "${USER}" -Dm755 -t /opt/pihole/ gravity.sh ${SUDO} install -o "${USER}" -Dm755 -t /opt/pihole/ ./advanced/Scripts/*.sh - ${SUDO} cp /etc/.pihole/pihole /usr/local/bin/pihole - ${SUDO} chmod 755 /usr/local/bin/pihole + ${SUDO} install -o "${USER}" -Dm755 -t /usr/local/bin/ pihole + ${SUDO} cp /etc/.pihole/advanced/bash-completion/pihole /etc/bash_completion.d/pihole . /etc/bash_completion.d/pihole From 50d16d8215f2a7016d9cf3650a61e44814c1b8ba Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 5 Oct 2016 10:45:17 -0700 Subject: [PATCH 6/7] Finish `install` conversion for installScripts() --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 6308a0ed..84ef9788 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -534,7 +534,7 @@ installScripts() { ${SUDO} install -o "${USER}" -Dm755 -t /opt/pihole/ ./advanced/Scripts/*.sh ${SUDO} install -o "${USER}" -Dm755 -t /usr/local/bin/ pihole - ${SUDO} cp /etc/.pihole/advanced/bash-completion/pihole /etc/bash_completion.d/pihole + ${SUDO} install -Dm644 ./advanced/bash-completion/pihole /etc/bash_completion.d/pihole . /etc/bash_completion.d/pihole #Tidy up /usr/local/bin directory if installing over previous install. From 8c151c62ce3ab311d561d5048a53685e75d9b037 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 5 Oct 2016 10:46:10 -0700 Subject: [PATCH 7/7] echo's don't need sudo --- automated install/basic-install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 84ef9788..72b28d22 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -550,8 +550,8 @@ installScripts() { installConfigs() { # Install the configs from /etc/.pihole to their various locations - ${SUDO} echo ":::" - ${SUDO} echo "::: Installing configs..." + echo ":::" + echo "::: Installing configs..." versionCheckDNSmasq if [ ! -d "/etc/lighttpd" ]; then ${SUDO} mkdir /etc/lighttpd @@ -567,15 +567,15 @@ installConfigs() { stopServices() { # Stop dnsmasq and lighttpd - ${SUDO} echo ":::" - ${SUDO} echo -n "::: Stopping services..." + echo ":::" + echo -n "::: Stopping services..." #$SUDO service dnsmasq stop & spinner $! || true if [ -x "$(command -v systemctl)" ]; then ${SUDO} systemctl stop lighttpd & spinner $! || true else ${SUDO} service lighttpd stop & spinner $! || true fi - ${SUDO} echo " done." + echo " done." } installerDependencies() {