Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo
- if [ $(uname -m) = x86_64 ]; then
- INSTALL_PATH=~/hybrid64
- ARCH=64bit
- else
- INSTALL_PATH=~/hybrid
- ARCH=32bit
- fi
- WORK_PATH=/media/ramdisk
- HOME=http://www.selur.de
- OPT=NONE
- function CLEAN()
- {
- echo -ne "\nCleaning up... "
- cd $WORK_PATH
- rm -rf hybrid_tmp
- echo "done."
- exit $1
- }
- echo $ARCH" architecture found."
- if [ $# -gt 0 ]; then
- if [ $1 = CHECK ] || [ $1 = check ]; then OPT=CHECK
- elif [ $1 = FORCE ] || [ $1 = force ]; then OPT=FORCE
- else
- echo -e "Unknown option: '"$1"' Try again! ;)\n"
- exit 1
- fi
- fi
- mkdir $WORK_PATH/hybrid_tmp
- cd $WORK_PATH/hybrid_tmp
- echo -n "Checking Hybrid version... "
- if wget -q $HOME/changelog; then
- STRING=$(grep -m 1 '<ul><li><strong>rev ' changelog)
- LATEST_VERS=${STRING#*rev}
- LATEST_VERS=${LATEST_VERS%:</strong>*}
- if [ -d $INSTALL_PATH ]; then
- echo "Latest version: "$LATEST_VERS
- if INSTALLED_VERS=$(cat $INSTALL_PATH/version 2>/dev/null); then
- echo -e " Current installed version: "$INSTALLED_VERS"\n"
- if [ $LATEST_VERS = $INSTALLED_VERS ]; then
- echo -n "Installed version is already the latest"
- if [ $OPT = CHECK ]; then
- echo " - no update necessary."
- CLEAN 0
- fi
- if [ $OPT = FORCE ]; then echo ", but FORCE option was called. Updating anyway."
- else
- read -p " - update anyway (y/N)? " YN
- case $YN in
- [Yy]*)
- echo "Starting update..."
- ;;
- *)
- echo "Nothing changed."
- CLEAN 0
- ;;
- esac
- fi
- else
- echo -n "New version available - "
- if [ $OPT = CHECK ]; then
- echo "update recommended!"
- CLEAN 0
- fi
- echo "starting update."
- OPT=NEW
- fi
- else
- echo "No information about installed version found."
- OPT=NEW
- fi
- else
- echo "no Hybrid folder found - creating new directory and installing latest version."
- mkdir $INSTALL_PATH
- OPT=NEW
- fi
- else
- echo "Could not find release information - no download possible :("
- CLEAN 1
- fi
- if wget -q $HOME/downloads; then
- STRING=$(grep -m 1 ">Hybrid Linux"$ARCH downloads)
- LINK=${STRING#*>Hybrid\ Linux$ARCH:\ <a\ href=\"}
- LINK=${LINK%\">Qt\ 5.2*}
- echo -e "Downloading latest Hybrid package...\n"
- if wget $HOME$LINK; then
- echo -n "Unpacking & installing Hybrid binary... "
- unzip Hybrid*.zip
- chmod +x Hybrid
- upx -d Hybrid &>/dev/null
- cd $INSTALL_PATH
- if [ -f Hybrid~ ]; then rm -f Hybrid~; fi
- if [ -f Hybrid ]; then mv Hybrid Hybrid~; fi
- if upx --lzma --ultra-brute $WORK_PATH/hybrid_tmp/Hybrid -o Hybrid; then
- if [ $OPT = NEW ]; then echo $LATEST_VERS >version; fi
- fi
- CLEAN 0
- else
- echo "Unable to download Hybrid binary package. Try again later or contact developer!"
- CLEAN 1
- fi
- else
- echo "Unable to access download page - no download possible :("
- CLEAN 1
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement