#!/bin/sh APP=python3.5 REPO="niess/python-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" >> /opt/$APP/remove chmod a+x /opt/$APP/remove # DOWNLOAD THE ARCHIVE mkdir tmp cd ./tmp version=$(curl -Ls https://api.github.com/repos/$REPO/releases | jq '.' | grep x86_64 | grep $APP | grep browser_download_url | grep -i appimage | cut -d '"' -f 4 | head -1) wget $version echo "$version" >> /opt/$APP/version cd .. mv ./tmp/*mage ./$APP chmod a+x /opt/$APP/$APP rmdir ./tmp # LINK ln -s /opt/$APP/$APP /usr/local/bin/$APP # SCRIPT TO UPDATE THE PROGRAM cat >> /opt/$APP/AM-updater << 'EOF' #!/usr/bin/env bash APP=python3.5 REPO="niess/python-appimage" version0=$(cat /opt/$APP/version) version=$(curl -Ls https://api.github.com/repos/$REPO/releases | jq '.' | grep x86_64 | grep $APP | grep browser_download_url | grep -i appimage | cut -d '"' -f 4 | head -1) if [ $version = $version0 ]; then echo "Update not needed!" else notify-send "A new version of $APP is available, please wait" mkdir /opt/$APP/tmp cd /opt/$APP/tmp wget $version if ls . | grep mage; then cd .. if test -f ./tmp/*mage; then rm ./version fi echo $version >> ./version mv --backup=t ./tmp/*mage ./$APP chmod a+x /opt/$APP/$APP rm -R -f ./tmp ./*~ fi notify-send "$APP is updated!" fi EOF chmod a+x /opt/$APP/AM-updater