From 9e9b4dbc7d4b36c205763dc8b096e3646def5ea4 Mon Sep 17 00:00:00 2001 From: Haruue <i@haruue.moe> Date: Sat, 25 May 2024 17:05:20 +0800 Subject: [PATCH] feat(scripts): change HYSTERIA_USER w/o --force --- scripts/install_server.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/install_server.sh b/scripts/install_server.sh index 3166e80..d222f33 100644 --- a/scripts/install_server.sh +++ b/scripts/install_server.sh @@ -1045,22 +1045,26 @@ perform_install() { _is_update_required=1 fi - if [[ -z "$_is_update_required" ]]; then - echo "$(tgreen)Installed version is up-to-date, there is nothing to do.$(treset)" - return - fi - if is_hysteria1_version "$VERSION"; then error "This script can only install Hysteria 2." exit 95 fi - perform_install_hysteria_binary + if [[ -n "$_is_update_required" ]]; then + perform_install_hysteria_binary + fi + + # Always install additional files, regardless of $_is_update_required. + # This allows changes to be made with environment variables (e.g. change HYSTERIA_USER without --force). perform_install_hysteria_example_config perform_install_hysteria_home_legacy perform_install_hysteria_systemd - if [[ -n "$_is_frash_install" ]]; then + if [[ -z "$_is_update_required" ]]; then + echo + echo "$(tgreen)Installed version is up-to-date, there is nothing to do.$(treset)" + echo + elif [[ -n "$_is_frash_install" ]]; then echo echo -e "$(tbold)Congratulation! Hysteria 2 has been successfully installed on your server.$(treset)" echo