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

Last change on this file since 5358 was 5358, checked in by daduve, 19 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 ]; then
25        sed -i '/Exec/d' $ICON_FILE
26        echo "Exec=env http_proxy='' '/opt/AdobeAirApp'/'Scratch 2'/bin/'Scratch 2'" >> $ICON_FILE
27fi
28
29## Tienes una version anterior la Original de la web, asi que actualizamos
30if [ $(dpkg --compare-versions "$ACTUAL_VERSION" lt "$LAST_ORIG_VERSION") ]; then
31        #echo "Your version is obsolete, we are going to update it. wait please....."
32        #/usr/share/zero-center/zmds/zero-lliurex-adobeair-scratch2.zmd
33        #echo "Your Scratch 2 has been updated by LliureX, enjoy it"
34        echo ""
35        echo "-------------- SCRATCH IS OBSOLOTE-----------------"
36        echo "Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again."
37        echo ""
38        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 &
39        #echo "Your Scratch 2 has been updated by LliureX, enjoy it"   
40        exit 0
41
42## Tienes la ultima version pero mal numerada, no coincide con el control de versiones de LLiureX
43elif [ $(dpkg --compare-versions "$ACTUAL_VERSION" eq "$LAST_ORIG_VERSION") ]; then
44        echo "You have the latest Scratch version"
45        sed -i -e "s%<versionNumber>$LAST_ORIG_VERSION<\/versionNumber>%<versionNumber>$LAST_LLIUREX_VERSION<\/versionNumber>%g" "$UPDATED_FILE"
46        exit 0
47
48## 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
49elif [ $(dpkg --compare-versions "$ACTUAL_VERSION" ne "$LAST_LLIUREX_VERSION") ]; then
50        echo ""
51        echo "-------------- SCRATCH IS OBSOLOTE-----------------"
52        echo "Your Scratch version is obsolete, please update it from Zero-Center, and press Scratch button again."
53        echo ""
54        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 &
55        exit 0
56fi
57
58echo "Do nothing, you are updated"
59exit 0
60
Note: See TracBrowser for help on using the repository browser.