From 4b5b0baafdf159c3f2ec07e58d8a8cec37f4691b Mon Sep 17 00:00:00 2001 From: shim_ Date: Wed, 22 Jun 2016 22:16:36 +0200 Subject: [PATCH] apply restrictions has to run before looping --- init.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) 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