source: zero-lliurex-adobeair/trunk/fuentes/debian/postinst @ 5359

Last change on this file since 5359 was 5359, checked in by daduve, 21 months ago

wip

File size: 2.7 KB
Line 
1#!/bin/sh
2set -e
3
4UPDATED_FILE="/opt/AdobeAirApp/Scratch 2/share/META-INF/AIR/application.xml"
5LAST_ORIG_VERSION="456.0.1"
6LAST_LLIUREX_VERSION="903"
7
8ICON_FILE="/usr/share/mate/applications/edu.media.mit.scratch2editor.desktop"
9
10if [ ! -f "$UPDATED_FILE" ]; then
11        exit 0
12fi
13
14ACTUAL_VERSION=$(grep "<versionNumber>" "$UPDATED_FILE" | cut -d ">" -f2 | cut -d "<" -f1);
15echo "Actual version is $ACTUAL_VERSION"
16
17## Fix bug in initial release xenial
18if [ "$ACTUAL_VERSION" = "456" ] || [ "$ACTUAL_VERSION" = "456.0.1" ] ; then
19        echo "Fixing bug versions"
20        sed -i -e "s%<versionNumber>$ACTUAL_VERSION<\/versionNumber>%<versionNumber>$LAST_LLIUREX_VERSION<\/versionNumber>%g" "$UPDATED_FILE"
21fi
22
23##Me aseguro que el desktop esta como toca
24if [ -f $ICON_FILE ] && [ "$ACTUAL_VERSION" < "904" ]; then
25        echo "Fixing bug in desktop for older versions"
26        sed -i '/Exec/d' $ICON_FILE
27        echo "Exec=env http_proxy='' '/opt/AdobeAirApp'/'Scratch 2'/bin/'Scratch 2'" >> $ICON_FILE
28fi
29
30## Tienes una version anterior la Original de la web, asi que actualizamos
31if [ $(dpkg --compare-versions "$ACTUAL_VERSION" lt "$LAST_ORIG_VERSION") ]; then
32        #echo "Your version is obsolete, we are going to update it. wait please....."
33        #/usr/share/zero-center/zmds/zero-lliurex-adobeair-scratch2.zmd
34        #echo "Your Scratch 2 has been updated by LliureX, enjoy it"
35        echo ""
36        echo "-------------- SCRATCH IS OBSOLOTE-----------------"
37        echo "Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again."
38        echo ""
39        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 &
40        #echo "Your Scratch 2 has been updated by LliureX, enjoy it"   
41        exit 0
42
43## Tienes la ultima version pero mal numerada, no coincide con el control de versiones de LLiureX
44elif [ $(dpkg --compare-versions "$ACTUAL_VERSION" eq "$LAST_ORIG_VERSION") ]; then
45        echo "You have the latest Scratch version"
46        sed -i -e "s%<versionNumber>$LAST_ORIG_VERSION<\/versionNumber>%<versionNumber>$LAST_LLIUREX_VERSION<\/versionNumber>%g" "$UPDATED_FILE"
47        exit 0
48
49## 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
50elif [ $(dpkg --compare-versions "$ACTUAL_VERSION" ne "$LAST_LLIUREX_VERSION") ]; then
51        echo ""
52        echo "-------------- SCRATCH IS OBSOLOTE-----------------"
53        echo "Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again."
54        echo ""
55        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 &
56        exit 0
57fi
58
59echo "Do nothing, you are updated"
60exit 0
61
Note: See TracBrowser for help on using the repository browser.