1
0
mirror of https://bitbucket.org/shim_/docker-rtm.git synced 2018-10-04 01:52:08 +02:00
docker-rtm/init.sh
2016-06-13 22:23:24 +02:00

39 lines
720 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