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 <e.burkov@adguard.com>
Date:   Mon Aug 16 19:00:03 2021 +0300

    scripts: fix install
This commit is contained in:
Eugene Burkov 2021-08-16 19:22:09 +03:00
parent 91c1c9e61d
commit 6013f7ce3e
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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