From 6013f7ce3edd10e5fac7615bea6ea6d0f0546be6 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 16 Aug 2021 19:22:09 +0300 Subject: [PATCH] Pull request: 3450 fix install script Merge in DNS/adguard-home from 3450-install-script to master Closes #3450. Squashed commit of the following: commit ab28d0b2bf7fca0fb292f250b728ae6214a75829 Author: Eugene Burkov Date: Mon Aug 16 19:00:03 2021 +0300 scripts: fix install --- CHANGELOG.md | 2 ++ scripts/install.sh | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d20ef582..08b14548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ and this project adheres to ### Fixed +- Inaccurate using of service actions in the installation script ([#3450]). - Client ID checking ([#3437]). - Discovering other DHCP servers on `darwin` and `freebsd` ([#3417]). - Switching listening address to unspecified one when bound to a single @@ -126,6 +127,7 @@ and this project adheres to [#3417]: https://github.com/AdguardTeam/AdGuardHome/issues/3417 [#3435]: https://github.com/AdguardTeam/AdGuardHome/issues/3435 [#3437]: https://github.com/AdguardTeam/AdGuardHome/issues/3437 +[#3450]: https://github.com/AdguardTeam/AdGuardHome/issues/3450 diff --git a/scripts/install.sh b/scripts/install.sh index c1b290d2..3fa62cfd 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -474,10 +474,10 @@ handle_existing() { if [ "$reinstall" -ne '1' ] && [ "$uninstall" -ne '1' ] then error_exit \ -"to reinstall/uninstall the AdGuard Home using\this script specify one of the '-r' or '-u' flags" +"to reinstall/uninstall the AdGuard Home using this script specify one of the '-r' or '-u' flags" fi - if ( cd "$agh_dir" && ! ./AdGuardHome -s uninstall ) + if ( cd "$agh_dir" && ! ./AdGuardHome -s stop || ! ./AdGuardHome -s uninstall ) then # It doesn't terminate the script since it is possible # that AGH just not installed as service but appearing @@ -498,9 +498,11 @@ handle_existing() { # Function install_service tries to install AGH as service. install_service() { + # Installing as root is required at least on FreeBSD. + # # TODO(e.burkov): Think about AGH's output suppressing with no verbose # flag. - if ( cd "$agh_dir" && ./AdGuardHome -s install ) + if ( cd "$agh_dir" && $sudo_cmd ./AdGuardHome -s install ) then return 0 fi