Ascension Launcher Updater (Bash Script)
-
greetings fellow unix gamer
it is my greatest pleasure to inform you, that the Ascension Launcher Updater (or ALU for short) now inoffically official hit public pre alpha. what does it do? it searches for the latest version of the ascension launcher and downloads it, without the need to open a browser, without the need to log into your account and click to many buttons to even bother. how many packages do you need to add i hear you ask? none. assuming you got 'curl' and 'wget'. which you do. most likely.
the ALU is a simple yet extremely unoptimized bash script, that could be executed on your machine today! gone are the anoying days of the launcher telling you to manualy update. the ALU even sets execution permission and asks you if it should launch the launcher. amazing. but how does it work? simple. put it in the directory where your ascension launcher is located and make sure you did not rename the official launcher. now just run the script in your favorite terminal that knows how to handle bash and you are all set up.
are you afraid of terminals? don't be, they can smell your fear. the ALU is operated by simple yes or no questions, even my cat could operate it without error. and i don't even have a cat.i did some intensive edge case testing, which i think are now all covered. this in turn lead to some serious bloat in redundant code, but you know what? the ALU is already perfect as is, it does not need a switch case. and here it is, get hyped, buckle your pants and most importantly hydrate well, here it is, 299 lines of madness, the one and only, ALUv001.sh:
#!/bin/bash echo "ascension launcher updater v0.0.1" sleep 1 VERSION_MIN=0 VERSION_MAX=999 if [ ! -f current_version.txt ]; then echo "... first launch" sleep .5 read -r -p "set up updater? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then sleep 1 echo "creating 'current_version.txt' file..." touch current_version.txt sleep .5 echo "creating 'old_launchers' directory..." mkdir old_launchers sleep .5 echo "checking for current launcher version..." sleep .5 if [ ! -f ascension-launcher-*.AppImage ]; then echo "[ERR] no launcher found" sleep 1 echo "setting current version to ${VERSION_MIN}..." sleep .5 echo "${VERSION_MIN}" > current_version.txt sleep .5 else VERSION=$( ls ascension-launcher-*.AppImage ) VERSION=${VERSION%.*} VERSION=${VERSION##*-} echo "ascension launcher version ${VERSION} found" sleep 1 echo "printing to file..." echo "${VERSION}" > current_version.txt sleep .5 fi echo "setup complete." sleep 1 else echo "abort..." sleep .5 fi else echo "welcome back!" sleep 1 fi VERSION=$( < current_version.txt ) if (($VERSION > $VERSION_MAX)); then echo "[ERR] launcher version > ${VERSION_MAX}" sleep .5 read -r -p "check again for current version? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then if [ ! -f ascension-launcher-*.AppImage ]; then sleep .5 echo "[ERR] no launcher found" sleep 1 echo "setting current version to ${VERSION_MIN}..." sleep .5 echo "${VERSION_MIN}" > current_version.txt VERSION=$( < current_version.txt ) sleep .5 else VERSION=$( ls ascension-launcher-*.AppImage ) VERSION=${VERSION%.*} VERSION=${VERSION##*-} sleep .5 echo "ascension launcher version ${VERSION} found" sleep 1 echo "printing to file..." echo "${VERSION}" > current_version.txt VERSION=$( < current_version.txt ) sleep .5 fi else sleep .5 echo "setting current version to ${VERSION_MIN}..." sleep .5 echo "${VERSION_MIN}" > current_version.txt VERSION=$( < current_version.txt ) sleep .5 fi else echo "current version appears to be ${VERSION}..." sleep .5 read -r -p "correct? [Y/n] " response if [[ "$response" =~ ^([nN])$ ]]; then sleep .5 echo "assuming irregular value due to unforseen script abortion" VERSION=$((VERSION-1)) echo "${VERSION}" > current_version.txt sleep .5 echo "corrected value to ${VERSION}" sleep 1 fi fi read -r -p "check for new version? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then sleep .5 echo "checking..." STATUS_CODE=$( curl -s -o /dev/null -I -w "%{http_code}" https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage ) STATUS_OK=200 if (( $STATUS_CODE == $STATUS_OK )); then sleep .5 while (( $STATUS_CODE == $STATUS_OK )); do echo "version ${VERSION} accessible" sleep 2 VERSION=$((VERSION+1)) echo "${VERSION}" > current_version.txt STATUS_CODE=$( curl -s -o /dev/null -I -w "%{http_code}" https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage ) echo "..." if (($VERSION > $VERSION_MAX)); then sleep .5 echo "[ERR] launcher version > ${VERSION_MAX}" sleep 1 echo "setting current version to ${VERSION_MIN}..." sleep .5 echo "${VERSION_MIN}" > current_version.txt sleep .5 read -p "press 'enter' to quit..." exit fi done VERSION=$((VERSION-1)) echo "${VERSION}" > current_version.txt echo "latest version found" if [ ! -f ascension-launcher-*.AppImage ]; then sleep 1 read -r -p "download? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then sleep .5 wget https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage sleep .5 echo "complete." sleep .5 echo "setting permission for owner to rx" chmod a=,u=rx ascension-launcher-*.AppImage sleep .5 read -r -p "launch the launcher? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then ./ascension-launcher-*.AppImage fi else sleep .5 read -p "press 'enter' to quit..." exit fi else VERSION_OLD=$( ls ascension-launcher-*.AppImage ) VERSION_OLD=${VERSION_OLD%.*} VERSION_OLD=${VERSION_OLD##*-} if (( $VERSION != $VERSION_OLD )); then sleep 1 echo "moving old launcher..." mv ascension-launcher-*.AppImage old_launchers sleep .5 echo "moved" sleep .5 read -r -p "download new launcher? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then sleep .5 wget https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage sleep .5 echo "complete." sleep .5 echo "setting permission for owner to rx" chmod a=,u=rx ascension-launcher-*.AppImage sleep .5 read -r -p "launch the launcher? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then ./ascension-launcher-*.AppImage fi fi else echo "you appear to be using the latest version" sleep .5 echo "setting permission for owner to rx" chmod a=,u=rx ascension-launcher-*.AppImage sleep .5 read -r -p "launch the launcher? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then ./ascension-launcher-*.AppImage fi fi fi else sleep .5 echo="searching for latest version..." sleep .5 echo="this may take a while, brush your teeth" while (( $STATUS_CODE != $STATUS_OK )); do sleep 2 VERSION=$((VERSION+1)) echo "${VERSION}" > current_version.txt echo "${VERSION}" STATUS_CODE=$( curl -s -o /dev/null -I -w "%{http_code}" https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage ) echo "..." if (($VERSION > $VERSION_MAX)); then sleep .5 echo "[ERR] launcher version > ${VERSION_MAX}" sleep 1 echo "setting current version to ${VERSION_MIN}..." sleep .5 echo "${VERSION_MIN}" > current_version.txt sleep .5 read -p "press 'enter' to quit..." exit fi done while (( $STATUS_CODE == $STATUS_OK )); do echo "version ${VERSION} accessible" sleep 2 VERSION=$((VERSION+1)) echo "${VERSION}" > current_version.txt STATUS_CODE=$( curl -s -o /dev/null -I -w "%{http_code}" https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage ) echo "..." if (($VERSION > $VERSION_MAX)); then sleep .5 echo "[ERR] launcher version > ${VERSION_MAX}" sleep 1 echo "setting current version to ${VERSION_MIN}..." sleep .5 echo "${VERSION_MIN}" > current_version.txt sleep .5 read -p "press 'enter' to quit..." exit fi done VERSION=$((VERSION-1)) echo "${VERSION}" > current_version.txt sleep .5 echo "latest version found" sleep 1 echo "moving old launcher..." mv ascension-launcher-*.AppImage old_launchers sleep .5 echo "moved" sleep .5 read -r -p "download new launcher? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then sleep .5 wget https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage sleep .5 echo "complete." sleep .5 echo "setting permission for owner to rx" chmod a=,u=rx ascension-launcher-*.AppImage sleep .5 read -r -p "launch the launcher? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then ./ascension-launcher-*.AppImage fi fi fi else echo "abort..." sleep .5 fi read -p "press 'enter' to quit..." exit # stay hydrated # # ALU brought to you by x3cutiex3
-
i updatet the script and please be advised that it is now very sexy.
much more refinde, less bloat, less asking for unnecessary confirmations. one might just asume that the whole reason for the old script to exist is to make this new shiny one look even better. without further ado, godhood brought to script:#!/bin/bash echo " + " echo " | ALU " echo " | Ascension Launcher Updater" echo " + " echo " " echo "welcome to the launcher launcher" echo " " VERSION_MIN=0 VERSION_MAX=999 if [ ! -f current_version.txt ]; then echo " " echo "first time launch" echo " " touch current_version.txt mkdir old_launchers if [ ! -f ascension-launcher-*.AppImage ]; then echo "[ERR] no launcher found" echo "${VERSION_MIN}" > current_version.txt echo "[ERR] make sure this script is in the same directory as the ascension launcher" echo "[ERR] make sure you have not renamed the ascension launcher" echo " " echo "[ERR] the script will search for updates starting with version ${VERSION_MIN}" echo "[ERR] this may take a while" echo " " read -r -p "set next starting value manualy? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then echo " " echo "input any value ranging from ${VERSION_MIN} to ${VERSION_MAX}: " read input echo "$input" > current_version.txt echo "new starting value is ${input}" fi else VERSION=$( ls ascension-launcher-*.AppImage ) VERSION=${VERSION%.*} VERSION=${VERSION##*-} echo "${VERSION}" > current_version.txt fi fi VERSION=$( < current_version.txt ) VERSION_OLD=$VERSION STATUS_OK=200 i=true j=true echo "checking for updates..." while [ "$i" = true ]; do while [ "$j" = true ]; do STATUS_CODE=$( curl -s -o /dev/null -I -w "%{http_code}" https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage ) j=false done if (( $STATUS_CODE == $STATUS_OK )); then VERSION=$((VERSION+1)) echo "${VERSION}..." STATUS_CODE=$( curl -s -o /dev/null -I -w "%{http_code}" https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage ) if (( $STATUS_CODE != $STATUS_OK )); then VERSION=$((VERSION-1)) echo "${VERSION}" > current_version.txt echo "${VERSION} appears to be the latest version" i=false fi else VERSION=$((VERSION+1)) echo "${VERSION}..." j=true if (( $VERSION > $VERSION_MAX )); then VERSION=$VERSION_MIN echo "${VERSION}" > current_version.txt echo "[ERR] no launcher found" i=false fi fi done if (( $VERSION != $VERSION_OLD )); then echo "downloading..." mv ascension-launcher-*.AppImage old_launchers wget https://download.ascension-patch.gg/update/ascension-launcher-${VERSION}.AppImage chmod a=,u=rx ascension-launcher-*.AppImage fi if (( $VERSION == $VERSION_MIN )); then echo "[ERR] no version in the range of ${VERSION_OLD} and ${VERSION_MAX} could be found" echo "[ERR] next start will search starting with version ${VERSION_MIN}" echo "[ERR] this may take a while" echo " " read -r -p "set next starting value manualy? [y/N] " response if [[ "$response" =~ ^([yY])$ ]]; then echo " " echo "input any value ranging from ${VERSION_MIN} to ${VERSION_MAX}: " read input echo "$input" > current_version.txt echo "new starting value is ${input}" fi echo " " sleep 2 read -p "press 'enter' to quit..." exit fi echo " " echo "you appear to be up to date" echo "launching the launcher..." echo " " ./ascension-launcher-*.AppImage echo " " echo "see you soon" sleep 2 echo " " read -p "press 'enter' to quit..." exit # stay hydrated # # ALU brought to you by x3cutiex3
If you are unable to sign in, please set your Display Name.