#!/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 if [ ! -z "$HIDE_PROCESSES" ]; then rm -f /bin/ps echo -e "#!/bin/sh\n\n/bin/true" > /bin/ps chmod +x /bin/ps fi