Pull request: scripts: do not require sudo where not needed
Merge in DNS/adguard-home from fix-install to master Squashed commit of the following: commit 54c3b18c946c88def396f82a941b0b35eb6ef60d Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Jan 26 19:08:48 2022 +0300 scripts: do not require sudo where not needed
This commit is contained in:
parent
5ff7cdbac8
commit
642d68c482
|
@ -384,16 +384,15 @@ rerun_with_root() {
|
||||||
|
|
||||||
log 'restarting with root privileges'
|
log 'restarting with root privileges'
|
||||||
|
|
||||||
# Group curl together with an echo, so that if curl fails before
|
# Group curl together with an echo, so that if curl fails before producing
|
||||||
# producing any output, the echo prints an exit command for the
|
# any output, the echo prints an exit command for the following shell to
|
||||||
# following shell to execute to prevent it from getting an empty input
|
# execute to prevent it from getting an empty input and exiting with a zero
|
||||||
# and exiting with a zero code in that case.
|
# code in that case.
|
||||||
{ curl -L -S -s "$script_url" || echo 'exit 1'; }\
|
{ curl -L -S -s "$script_url" || echo 'exit 1'; }\
|
||||||
| $sudo_cmd sh -s -- -c "$channel" -C "$cpu" -O "$os" -o "$out_dir" "$r" "$u" "$v"
|
| $sudo_cmd sh -s -- -c "$channel" -C "$cpu" -O "$os" -o "$out_dir" "$r" "$u" "$v"
|
||||||
|
|
||||||
# Exit the script. Since if the code of the previous pipeline is
|
# Exit the script. Since if the code of the previous pipeline is non-zero,
|
||||||
# non-zero, the execution won't reach this point thanks to set -e, exit
|
# the execution won't reach this point thanks to set -e, exit with zero.
|
||||||
# with zero.
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,11 +482,7 @@ handle_existing() {
|
||||||
|
|
||||||
# Function install_service tries to install AGH as service.
|
# Function install_service tries to install AGH as service.
|
||||||
install_service() {
|
install_service() {
|
||||||
# Installing as root is required at least on FreeBSD.
|
if ( cd "$agh_dir" && ./AdGuardHome -s install )
|
||||||
#
|
|
||||||
# TODO(e.burkov): Think about AGH's output suppressing with no verbose
|
|
||||||
# flag.
|
|
||||||
if ( cd "$agh_dir" && $sudo_cmd ./AdGuardHome -s install )
|
|
||||||
then
|
then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue