fix(install_server.sh): sudo with $@

This commit is contained in:
Haruue Icymoon 2022-11-28 13:22:39 +08:00
parent e2cc0dff48
commit 173d3a5a1d
No known key found for this signature in database
GPG Key ID: F6083B28CBCBC148

View File

@ -17,6 +17,9 @@ set -e
# Basename of this script # Basename of this script
SCRIPT_NAME="$(basename "$0")" SCRIPT_NAME="$(basename "$0")"
# Command line arguments of this script
SCRIPT_ARGS=("$@")
# Path for installing executable # Path for installing executable
EXECUTABLE_INSTALL_PATH="/usr/local/bin/hysteria" EXECUTABLE_INSTALL_PATH="/usr/local/bin/hysteria"
@ -272,8 +275,7 @@ check_permission() {
*) *)
if has_command sudo; then if has_command sudo; then
note "Re-running this script with sudo, you can also specify FORCE_NO_ROOT=1 to force this script running with current user." note "Re-running this script with sudo, you can also specify FORCE_NO_ROOT=1 to force this script running with current user."
sudo "$0" "$@" exec sudo "$0" "${SCRIPT_ARGS[@]}"
exit $?
else else
error "Please run this script with root or specify FORCE_NO_ROOT=1 to force this script running with current user." error "Please run this script with root or specify FORCE_NO_ROOT=1 to force this script running with current user."
exit 13 exit 13