Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: install npd #308

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions packages/sshnoports/scripts/install_sshnpd
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,16 @@ parse_env() {
fi
}

cleanup() {
rm -rf "$HOME_PATH/.atsign/temp/$TEMP_PATH";
}

make_dirs() {
rm -rf "$HOME_PATH/.atsign/temp/$TEMP_PATH";
mkdir -p "$HOME_PATH/.ssh/" \
"$HOME_PATH/.$BINARY_NAME/logs" \
"$HOME_PATH/.atsign/keys" \
"$HOME_PATH/.atsign/temp" \
"$HOME_PATH/.atsign/temp/$TEMP_PATH" \
"$HOME_PATH/.local/bin";

if [ ! -f "$HOME_PATH/.ssh/authorized_keys" ]; then
Expand All @@ -213,6 +217,15 @@ download() {

if [ ! -f "$HOME_PATH/.atsign/temp/$TEMP_PATH/$BINARY_NAME.$EXT" ]; then
echo "Failed to download $BINARY_NAME";
echo;
echo "Please try again, or download manually from $DOWNLOAD";
echo "After downloading manually, run the following command to install:";
if [ "$0" == 'bash' ]; then
echo "bash -c \"\$(curl https://getsshnpd.noports.com)\" -- -l <path to $EXT file>";
else
echo " $0 -l <path to $EXT file>";
fi
cleanup
exit 1;
fi

Expand Down Expand Up @@ -310,11 +323,6 @@ restart_service() {
killall -q -u "$SSHNP_USER" -r "$BINARY_NAME$"
}

post_install() {
rm -rf "$HOME_PATH/.atsign/temp";
echo; echo "Installation complete!";
}

# Wrapping install steps prevents issues caused by interrupting the download
main () {
parse_env
Expand All @@ -327,7 +335,8 @@ main () {
setup_service
fi

post_install
cleanup
echo; echo "Installation complete!";

if [ "$SSHNP_OP" = 'update' ]; then
restart_service
Expand Down