1
0
mirror of https://bitbucket.org/shim_/docker-rtm.git synced 2018-10-04 01:52:08 +02:00

apply restrictions has to run before looping

This commit is contained in:
shim_ 2016-06-22 22:16:36 +02:00
parent 9c4a18c584
commit 4b5b0baafd

32
init.sh
View File

@ -11,6 +11,22 @@ function report_loop {
done 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 { function fetch_installer {
curl "$RTM_DOWNLOAD_URL$RTM_VERSION.sh" > $INSTALLER curl "$RTM_DOWNLOAD_URL$RTM_VERSION.sh" > $INSTALLER
CHECKSUM=$(sha256sum $INSTALLER) CHECKSUM=$(sha256sum $INSTALLER)
@ -26,6 +42,7 @@ function fetch_installer {
} }
if [[ -d "$BINARYDIR" && -f $BINARY ]]; then if [[ -d "$BINARYDIR" && -f $BINARY ]]; then
apply_restrictions
report_loop report_loop
else else
if [ -f "$INSTALLER" ]; then if [ -f "$INSTALLER" ]; then
@ -34,19 +51,6 @@ else
else else
fetch_installer fetch_installer
fi fi
apply_restrictions
report_loop report_loop
fi 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