#!/usr/bin/env bash APP=wine REPO="mmtrt/WINE_AppImage" # CREATE THE FOLDER mkdir /opt/$APP cd /opt/$APP # ADD THE REMOVER echo '#!/bin/sh' >> /opt/$APP/remove echo "rm -R -f /usr/share/applications/AM-$APP.desktop /opt/$APP /usr/local/bin/$APP /usr/local/bin/wine64" >> /opt/$APP/remove chmod a+x /opt/$APP/remove # DOWNLOAD THE ARCHIVE mkdir tmp cd ./tmp printf "%s\n" "$(curl -Ls https://api.github.com/repos/$REPO/releases | jq '.' \ | grep browser_download_url | cut -d '"' -f 4)" | tr ' ' '\n' | grep -i appimage | grep -v zsync >> ./wine-args printf "Select a URL from this menu (read carefully) or press CTRL+C to abort:\n-----------------------------------------------------------------------\n"; sleep 1; select version in $(cat ./wine-args | sort -u | uniq); do test -n "$version" && break; echo ">>> Invalid Selection"; done wget $version cd .. mv ./tmp/*mage ./$APP chmod a+x /opt/$APP/$APP cd ./tmp wget https://github.com/ivan-hc/AppImageUpdate/releases/download/continuous/appimageupdatetool-x86_64.AppImage cd .. mv ./tmp/appimageupdatetool-x86_64.AppImage ./updater chmod a+x ./updater rm -R -f ./tmp # LINK ln -s /opt/$APP/$APP /usr/local/bin/$APP ln -s /opt/$APP/$APP /usr/local/bin/wine64 # SCRIPT TO UPDATE THE PROGRAM cat >> /opt/$APP/AM-updater << 'EOF' #!/bin/sh APP=wine cd /opt/$APP ./updater -O ./$APP chmod a+x /opt/$APP/$APP rm -R -f /opt/$APP/*zs-old && rm -R -f /opt/$APP/*.part EOF chmod a+x /opt/$APP/AM-updater # ROLLBACK SCRIPT cat >> /opt/$APP/$APP-rollback << 'EOF' #!/usr/bin/env bash APP=wine REPO="mmtrt/WINE_AppImage" printf "%s\n" "$(curl -Ls https://api.github.com/repos/$REPO/releases | jq '.' \ | grep browser_download_url | cut -d '"' -f 4)" | tr ' ' '\n' | grep -i appimage | grep -v zsync >> "./rollback-args" && echo -e "-----------------------------------------------------------------------\nYou have chosen to roll back $APP.\nRollback will be done from https://github.com/$REPO\n-----------------------------------------------------------------------" printf "Select a URL from this menu (read carefully) or press CTRL+C to abort:\n-----------------------------------------------------------------------\n"; sleep 1; select version in $(cat "./rollback-args"); do test -n "$version" && break; echo ">>> Invalid Selection"; done cd /opt/$APP mkdir tmp cd tmp wget $version cd .. mv ./tmp/*mage ./$APP chmod a+x /opt/$APP/$APP rm -f ./rollback-args echo -e "\nROLLBACK SUCCESSFUL!" exit EOF chmod a+x /opt/$APP/$APP-rollback