mirror of
https://bitbucket.org/shim_/docker-rtm.git
synced 2018-10-04 01:52:08 +02:00
53 lines
955 B
Bash
Executable File
53 lines
955 B
Bash
Executable File
#!/bin/bash
|
|
|
|
BINARYDIR=/usr/local/rtm
|
|
BINARY=$BINARYDIR/bin/rtm
|
|
INSTALLER="/cache/install-$RTM_VERSION.sh"
|
|
|
|
function report_loop {
|
|
while true; do
|
|
$BINARY > /dev/null
|
|
sleep $RTM_REPORT_INTERVAL
|
|
done
|
|
}
|
|
|
|
function fetch_installer {
|
|
curl "$RTM_DOWNLOAD_URL$RTM_VERSION.sh" > $INSTALLER
|
|
CHECKSUM=$(sha256sum $INSTALLER)
|
|
if [ "$CHECKSUM" == "$RTM_INSTALLER_CHECKSUM $INSTALLER" ]; then
|
|
sed -i 's/df -li/df -i/g' $INSTALLER
|
|
sed -i 's/df -l/df/g' $INSTALLER
|
|
chmod +x $INSTALLER
|
|
$INSTALLER
|
|
else
|
|
echo Checksum mismatch!
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
if [[ -d "$BINARYDIR" && -f $BINARY ]]; then
|
|
report_loop
|
|
else
|
|
if [ -f "$INSTALLER" ]; then
|
|
chmod +x $INSTALLER
|
|
$INSTALLER
|
|
else
|
|
fetch_installer
|
|
fi
|
|
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
|