#!/bin/sh set -e UPDATED_FILE="/opt/AdobeAirApp/Scratch 2/share/META-INF/AIR/application.xml" LAST_ORIG_VERSION="458" LAST_LLIUREX_VERSION="905" ICON_FILE="/usr/share/mate/applications/edu.media.mit.scratch2editor.desktop" if [ ! -f "$UPDATED_FILE" ]; then exit 0 fi ACTUAL_VERSION=$(grep "" "$UPDATED_FILE" | cut -d ">" -f2 | cut -d "<" -f1); echo "Actual version is $ACTUAL_VERSION" ## Fix bug in initial release xenial if [ "$ACTUAL_VERSION" = "458" ] || [ "$ACTUAL_VERSION" = "458.0.1" ] ; then echo "Fixing bug versions" sed -i -e "s%$ACTUAL_VERSION<\/versionNumber>%$LAST_LLIUREX_VERSION<\/versionNumber>%g" "$UPDATED_FILE" fi ##Me aseguro que el desktop esta como toca if [ -f $ICON_FILE ] && [ $ACTUAL_VERSION -lt 904 ]; then echo "Fixing bug in desktop for older versions" sed -i '/Exec/d' $ICON_FILE echo "Exec=env http_proxy='' '/opt/AdobeAirApp'/'Scratch 2'/bin/'Scratch 2'" >> $ICON_FILE fi ## Tienes una version anterior la Original de la web, asi que actualizamos if [ $(dpkg --compare-versions "$ACTUAL_VERSION" lt "$LAST_ORIG_VERSION") ]; then #echo "Your version is obsolete, we are going to update it. wait please....." #/usr/share/zero-center/zmds/zero-lliurex-adobeair-scratch2.zmd #echo "Your Scratch 2 has been updated by LliureX, enjoy it" echo "" echo "-------------- SCRATCH IS OBSOLOTE-----------------" echo "Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again." echo "" zenity --info --title="Zero-installer-Scratch" --text="Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again." > /dev/null 2>&1 & #echo "Your Scratch 2 has been updated by LliureX, enjoy it" exit 0 ## Tienes la ultima version pero mal numerada, no coincide con el control de versiones de LLiureX elif [ $(dpkg --compare-versions "$ACTUAL_VERSION" eq "$LAST_ORIG_VERSION") ]; then echo "You have the latest Scratch version" sed -i -e "s%$LAST_ORIG_VERSION<\/versionNumber>%$LAST_LLIUREX_VERSION<\/versionNumber>%g" "$UPDATED_FILE" exit 0 ## Si llegamos aqui es que tienes una version superior a las de la web de SCRATCH pero anterior a la LAST_LLIUREX_VERSION por lo que hemos de actualizarte elif [ $(dpkg --compare-versions "$ACTUAL_VERSION" ne "$LAST_LLIUREX_VERSION") ]; then echo "" echo "-------------- SCRATCH IS OBSOLOTE-----------------" echo "Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again." echo "" zenity --info --title="Zero-installer-Scratch" --text="Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again." > /dev/null 2>&1 & exit 0 fi echo "Do nothing, you are updated" exit 0