From f44636bf235ded452dd520fcba51a5d22373873d Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Wed, 28 Jun 2023 13:33:59 -0400 Subject: [PATCH 1/3] chore: do cleanup before restarting sshnpd when updating --- scripts/install_sshnpd | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/scripts/install_sshnpd b/scripts/install_sshnpd index 786db2024..e0c9d1301 100755 --- a/scripts/install_sshnpd +++ b/scripts/install_sshnpd @@ -280,20 +280,15 @@ main () { setup_main_binaries - case "$SSHNP_OP" in - install) - setup_service - ;; - update) - restart_service - ;; - *) - echo "Invalid operation: $SSHNP_OP"; - exit 0; - ;; - esac + if [ "$SSHNP_OP" = 'install' ]; then + setup_service + fi post_install + + if [ "$SSHNP_OP" = 'update' ]; then + restart_service + fi } parse_args "$@"; From ba95e42b2dcdb8ff609725dde93bea2601332aa1 Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Wed, 28 Jun 2023 13:42:49 -0400 Subject: [PATCH 2/3] fix: update via restarting sshnpd rather than sshnpd@client --- scripts/install_sshnpd | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/install_sshnpd b/scripts/install_sshnpd index e0c9d1301..598c1a858 100755 --- a/scripts/install_sshnpd +++ b/scripts/install_sshnpd @@ -259,12 +259,7 @@ setup_service() { # used to restart the service after an update restart_service() { - SERVICE_LIST_FILE="$HOME_PATH/.$BINARY_NAME/.service_list"; - while read -r SERVICE; - do - SERVICE=$(echo "$SERVICE" | cut -f 1 -d ' '); - killall -qu "$SSHNP_USER" "$SERVICE"; - done < "$SERVICE_LIST_FILE"; + killall -qu "$SSHNP_USER" -r "$BINARY_NAME$" } post_install() { From 59d83f4457727d0185bfb40f2a4c78431d5f68f6 Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Wed, 28 Jun 2023 13:57:45 -0400 Subject: [PATCH 3/3] fix: separate q flag --- scripts/install_sshnpd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_sshnpd b/scripts/install_sshnpd index 598c1a858..b23632f7b 100755 --- a/scripts/install_sshnpd +++ b/scripts/install_sshnpd @@ -259,7 +259,7 @@ setup_service() { # used to restart the service after an update restart_service() { - killall -qu "$SSHNP_USER" -r "$BINARY_NAME$" + killall -q -u "$SSHNP_USER" -r "$BINARY_NAME$" } post_install() {