From 4244f716e0c7b029f4fe086135bad39d22297b00 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 22:59:14 -0800 Subject: [PATCH 1/6] Create /opt/pihole before trying to install into it. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3dacdfff..b03b98d0 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -628,6 +628,7 @@ installScripts() { # Install files from local core repository if is_repo "${PI_HOLE_LOCAL_REPO}"; then cd "${PI_HOLE_LOCAL_REPO}" + install -o "${USER}" -Dm755 -d /opt/pihole install -o "${USER}" -Dm755 -t /opt/pihole/ gravity.sh install -o "${USER}" -Dm755 -t /opt/pihole/ ./advanced/Scripts/*.sh install -o "${USER}" -Dm755 -t /opt/pihole/ ./automated\ install/uninstall.sh From c9c28cb59afe904887a15412fe3a793466852aeb Mon Sep 17 00:00:00 2001 From: bcambl Date: Thu, 22 Dec 2016 03:33:32 -0600 Subject: [PATCH 2/6] replace 'git -C' with long version The -C argument was introduced in git 1.8.4. CentOS 7.3 at the time of this commit provides v1.8.3.1. see: https://git.kaarsemaker.net/git/commit/44e1e4d67d5148c245db362cc48c3cc6c2ec82ca/ Fixes #1004 --- 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 3dacdfff..9b19c19f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -135,7 +135,7 @@ fi is_repo() { # Use git to check if directory is currently under VCS, return the value local directory="${1}" - git -C "${directory}" status --short &> /dev/null + (cd ${directory} && git status --short) &> /dev/null return } From cbf84c1840fecce74b8554058aa32e9b8b4dfd18 Mon Sep 17 00:00:00 2001 From: bcambl Date: Thu, 22 Dec 2016 04:32:42 -0600 Subject: [PATCH 3/6] replace subshell with command chain --- 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 9b19c19f..bb2de017 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -135,8 +135,8 @@ fi is_repo() { # Use git to check if directory is currently under VCS, return the value local directory="${1}" - (cd ${directory} && git status --short) &> /dev/null - return + curdir=$PWD; cd $directory; git status --short &> /dev/null; rc=$?; cd $curdir + return $rc } make_repo() { From 4626b8ced50d17a4cf2da0ee7a4b3bfcb14efa5d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 22 Dec 2016 13:18:38 +0100 Subject: [PATCH 4/6] Removed fixed username from sudoers file --- advanced/pihole.sudo | 1 - 1 file changed, 1 deletion(-) diff --git a/advanced/pihole.sudo b/advanced/pihole.sudo index ef06249a..702bc7a5 100644 --- a/advanced/pihole.sudo +++ b/advanced/pihole.sudo @@ -9,4 +9,3 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -www-data ALL=NOPASSWD: /usr/local/bin/pihole From 60054da582b4c7d980944b768cd96ce924ac8356 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 22 Dec 2016 13:26:11 +0100 Subject: [PATCH 5/6] Add lighttpd user (OS dependent) to sudoers file --- automated install/basic-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index b03b98d0..e99a914a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -801,6 +801,8 @@ installPiholeWeb() { echo -n "::: Installing sudoer file..." mkdir -p /etc/sudoers.d/ cp /etc/.pihole/advanced/pihole.sudo /etc/sudoers.d/pihole + # Add lighttpd user (OS dependent) to sudoers file + echo "${LIGHTTPD_USER} ALL=NOPASSWD: /usr/local/bin/pihole" >> /etc/sudoers.d/pihole chmod 0440 /etc/sudoers.d/pihole echo " done!" } From ea5ee7b0f96e1a0a68af1cd42160c04ab8c7ce78 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 22 Dec 2016 11:30:36 -0800 Subject: [PATCH 6/6] Execute gravity in same shell as installer, don't subshell it. Signed-off-by: Dan Schaper --- 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 82ea64fd..33b1842d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -822,7 +822,7 @@ runGravity() { rm /etc/pihole/list.* fi echo "::: Running gravity.sh" - /opt/pihole/gravity.sh + { /opt/pihole/gravity.sh; } } create_pihole_user() {