diff --git a/.github/scripts/functional_test.sh b/.github/scripts/functional_test.sh index f3a9e55..30f28dd 100644 --- a/.github/scripts/functional_test.sh +++ b/.github/scripts/functional_test.sh @@ -37,7 +37,7 @@ sudo sh rport-installer.sh -x -s # Verify the client has connected to the local rportd echo "Verifying client is connected to server" -grep "client-listener.*Listening.*$(hostname)" /tmp/rportd.log +grep "client-listener.*Listening.*" /tmp/rportd.log # Execute the update script echo "Executing the update script now" diff --git a/.github/scripts/run_rport_server.ps1 b/.github/scripts/run_rport_server.ps1 index 7abd0dc..d5ed2be 100644 --- a/.github/scripts/run_rport_server.ps1 +++ b/.github/scripts/run_rport_server.ps1 @@ -1,7 +1,7 @@ $ErrorActionPreference = "Stop" mkdir C:\rport Set-Location C:\rport -Invoke-WebRequest "https://download.rport.io/rportd/stable/?arch=Windows_x86_64" -OutFile rportd.zip +Invoke-WebRequest "https://download.openrport.io/rportd/stable/?arch=_x86_64" -OutFile rportd.zip Expand-Archive rportd.zip . ./rportd --version diff --git a/retrieve/templates/linux/functions.sh b/retrieve/templates/linux/functions.sh index 3ced656..989d3ba 100644 --- a/retrieve/templates/linux/functions.sh +++ b/retrieve/templates/linux/functions.sh @@ -155,7 +155,7 @@ has_sudo() { create_sudoers_all() { SUDOERS_FILE=/etc/sudoers.d/rport-all-cmd if [ -e "$SUDOERS_FILE" ]; then - echo "You already have a $SUDOERS_FILE. Not changing." + throw_info "You already have a $SUDOERS_FILE. Not changing." return 1 fi @@ -179,7 +179,7 @@ ${USER} ALL=(ALL) NOPASSWD:ALL create_sudoers_updates() { SUDOERS_FILE=/etc/sudoers.d/rport-update-status if [ -e "$SUDOERS_FILE" ]; then - echo "You already have a $SUDOERS_FILE. Not changing." + throw_info "You already have a $SUDOERS_FILE. Not changing." return 0 fi @@ -264,10 +264,10 @@ update_tacoscript() { curl -LSso tacoscript.tar.gz "https://download.rport.io/tacoscript/${RELEASE}/?arch=Linux_${ARCH}>=$TACO_VERSION" if tar xzf tacoscript.tar.gz 2>/dev/null; then echo "" - echo "Updating Tacoscript from ${TACO_VERSION} to latest ${RELEASE} $(./tacoscript --version | grep -o "Version:.*")" + throw_info "Updating Tacoscript from ${TACO_VERSION} to latest ${RELEASE} $(./tacoscript --version | grep -o "Version:.*")" mv -f /tmp/tacoscript /usr/local/bin/tacoscript else - echo "Nothing to do. Tacoscript is on the latest version ${TACO_VERSION}." + throw_info "Nothing to do. Tacoscript is on the latest version ${TACO_VERSION}." fi } @@ -277,7 +277,7 @@ update_tacoscript() { #---------------------------------------------------------------------------------------------------------------------- install_tacoscript() { if [ -e /usr/local/bin/tacoscript ]; then - echo "Tacoscript already installed. Checking for updates ..." + throw_info "Tacoscript already installed. Checking for updates ..." update_tacoscript return 0 fi @@ -672,4 +672,4 @@ abort_on_rport_subprocess() { throw_hint ' nohup sh -c "curl -s https://pairing.openrport.io/update|sh" >/tmp/rport-update.log 2>&1 &' throw_fatal "You cannot update rport from an rport subprocess." fi -} \ No newline at end of file +} diff --git a/retrieve/templates/linux/update.sh b/retrieve/templates/linux/update.sh index 88f6009..049b155 100644 --- a/retrieve/templates/linux/update.sh +++ b/retrieve/templates/linux/update.sh @@ -37,23 +37,23 @@ current_version() { # RETURNS: #---------------------------------------------------------------------------------------------------------------------- restart_rport() { - if [ -e /etc/init.d/rport ]; then - RESTART_CMD='/etc/init.d/rport restart' - else - RESTART_CMD='systemctl restart rport' - fi - if [ "$1" = "background" ]; then - if command -v at >/dev/null 2>&1; then - echo "$RESTART_CMD" | at now +1 minute - echo "Restart of rport scheduled via atd." + if [ -e /etc/init.d/rport ]; then + RESTART_CMD='/etc/init.d/rport restart' else - nohup sh -c "sleep 10;$RESTART_CMD" >/dev/null 2>&1 & - echo "Restart of rport scheduled via nohup+sleep." + RESTART_CMD='systemctl restart rport' fi - return 0 - fi - throw_info "Restarting RPort using '$RESTART_CMD'" - $RESTART_CMD + if [ "$1" = "background" ]; then + if command -v at >/dev/null 2>&1; then + echo "$RESTART_CMD" | at now +1 minute + throw_info "Restart of rport scheduled via atd." + else + nohup sh -c "sleep 10;$RESTART_CMD" >/dev/null 2>&1 & + throw_info "Restart of rport scheduled via nohup+sleep." + fi + return 0 + fi + throw_info "Restarting RPort using '$RESTART_CMD'" + $RESTART_CMD } #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: update @@ -63,10 +63,11 @@ update() { check_prerequisites cd /tmp download_package + RESTART_IN="background" test -e rport && rm -f rport if tar xzf rport.tar.gz rport 2>/dev/null; then TARGET_VERSION=$(./rport --version | awk '{print $2}') - echo "Updating from ${CURRENT_VERSION} to latest ${RELEASE} $(./rport --version)" + throw_info "Updating from ${CURRENT_VERSION} to latest ${RELEASE} $(./rport --version)" check_scripts check_sudo create_sudoers_updates @@ -76,9 +77,9 @@ update() { enable_file_reception insert_watchdog mv -f /tmp/rport /usr/local/bin/rport - restart_rport + restart_rport $RESTART_IN else - echo "Nothing to do. RPort is on the latest version ${CURRENT_VERSION}." + throw_info "Nothing to do. RPort is on the latest version ${CURRENT_VERSION}." [ "$ENABLE_TACOSCRIPT" -eq 1 ] && install_tacoscript exit 0 fi @@ -140,6 +141,7 @@ check_scripts() { else echo 1>&2 "Please use the switches -x/-d to enable or disable script execution." help + # shellcheck disable=SC2317 # Don't warn about unreachable commands in this function exit 1 fi if ask_yes_no "Do you want to activate script execution?"; then @@ -165,6 +167,7 @@ check_sudo() { else echo 1>&2 "Please use the switches -s/-n to enable or disable sudo rights." help + # shellcheck disable=SC2317 # Don't warn about unreachable commands in this function exit 1 fi if ask_yes_no "Do you want to activate sudo rights for RPort remote script execution?"; then