#!/bin/bash PACKAGE="mp-installer_78.tar.xz" SUM="0aab6f9192257e0340070f15fd708bec1d8783101c230127bc605a525b6ca2e8" WORKDIR=${PWD}; check_package() { if [[ ! -e $WORKDIR/$PACKAGE ]]; then echo -e "\033[32mDownloading file...\033[0m"; curl -sS --connect-timeout 30 -O https://people.ipfire.org/~mlorenz/mp/${PACKAGE}; echo -e "\033[32mFile download success...\033[0m"; else echo "$PACKAGE local found..."; fi; echo -e "\033[1;36mCheck the SHA256 sum now...\033[0m"; CHECK=$(sha256sum "$WORKDIR/${PACKAGE}"| awk '{print $1}'); if [[ "${SUM}" = "${CHECK}" ]]; then echo "Check SHA256 sum of file: ${PACKAGE}"; echo -e "SHA256 sum is \033[32m${CHECK}\033[0m \033[92mOK\033[0m "; echo "SHA256 sum is correct! Continuing installer..."; echo " "; else echo -e "SHA256 sum should be \033[92m${CHECK}\033[0m"; echo -e "SHA256 sum is \033[91m${SUM}\033[0m and is not correct\033[0m "; echo -e "\033[1;31mShit happens :-( the SHA256 sum is incorrect, intstaller stopped!\033[0m"; echo; exit 1; fi; echo -en "\033[32mUnpack files now...\033[0m"; tar xf $WORKDIR/${PACKAGE}; rm -f $WORKDIR/${PACKAGE}; unset SUM PACKAGE CHECK; echo -e "\033[92mdone...\033[0m"; } clear; echo -e "\033[1;36m--------------------------------------------------------------------------------\033[0m"; echo -e "\033[1;36m- This is the Mail Gateway file tester and downloader -\033[0m"; echo -e "\033[1;36m--------------------------------------------------------------------------------\033[0m"; echo " "; PLATFORM=$(uname -m); if [[ $PLATFORM == armv5tel || $PLATFORM == armv5tejl || $PLATFORM == armv6l || $PLATFORM == armv7l ]]; then echo -e "\033[91mInstallation only on Intel platforms. ARM based systems are not supported!\033[0m"; unset PLATFORM; exit 0; fi; check_package; if [[ -e $WORKDIR/mpstart.sh ]]; then chmod +x $WORKDIR/mpstart.sh echo -e "\033[32mStarting installer now...\033[0m"; $WORKDIR/mpstart.sh 2>&1 |tee $WORKDIR/install.log; rm -f $WORKDIR/mpstart.sh; else echo "mpstart.sh not found! quit installer!" fi; unset WORKDIR; exit 0; #End of start.sh