diff --git a/init.sh b/init.sh index a6792bd..9c81232 100755 --- a/init.sh +++ b/init.sh @@ -11,6 +11,22 @@ function report_loop { done } +function disable_command { + rm -f $1 + echo -e '#!/bin/sh\n\n/bin/true' > $1 + chmod +x $1 +} + +function apply_restrictions { + if [ ! -z "$HIDE_PROCESSES" ]; then + disable_command "/bin/ps" + fi + + if [ ! -z "$HIDE_CONNECTIONS" ]; then + disable_command "/bin/netstat" + fi +} + function fetch_installer { curl "$RTM_DOWNLOAD_URL$RTM_VERSION.sh" > $INSTALLER CHECKSUM=$(sha256sum $INSTALLER) @@ -26,6 +42,7 @@ function fetch_installer { } if [[ -d "$BINARYDIR" && -f $BINARY ]]; then + apply_restrictions report_loop else if [ -f "$INSTALLER" ]; then @@ -34,19 +51,6 @@ else else fetch_installer fi + apply_restrictions report_loop fi - -function disable_command { - rm -f $1 - echo -e '#!/bin/sh\n\n/bin/true' > $1 - chmod +x $1 -} - -if [ ! -z "$HIDE_PROCESSES" ]; then - disable_command "/bin/ps" -fi - -if [ ! -z "$HIDE_CONNECTIONS" ]; then - disable_command "/bin/netstat" -fi