source: zero-lliurex-adobeair/trunk/fuentes/zero-lliurex-adobeair.install-files/usr/share/zero-lliurex-adobeair/scratch2_script @ 7757

Last change on this file since 7757 was 7757, checked in by hectorgh, 13 months ago

fixing reinstallation of scratch2

  • Property svn:executable set to *
File size: 5.2 KB
Line 
1#!/bin/bash
2
3ACTION="$1"
4PKG="$2"
5APP_PATH="/var/cache/epi-downloads/"
6PACKAGE_NAME="edu.media.mit.scratch2editor"
7DEPENDS="adobeair"
8VERSION="Scratch-latest.air"
9LOG_FILE="/root/.appdata/Adobe/AIR/Logs/Install.log"
10ICON_FILE="/opt/AdobeAirApp/Scratch 2/share/META-INF/AIR/edu.media.mit.scratch2editor.desktop"
11MATE_ICON_FILE="/usr/share/mate/applications/"
12DESKTOP="edu.media.mit.scratch2editor.desktop"
13
14
15#Para el control de versiones partimos de que la 437 corresponde a la 900 y asi incrementalmente en ambos casos en el fichero indicado.
16UPDATE_FILE="/opt/AdobeAirApp/Scratch 2/share/META-INF/AIR/application.xml"
17VERSION_ORIG_NUMBER="458.0.1"
18VERSION_LLIUREX_NUMBER="905"
19
20
21case $ACTION in
22
23        getStatus)
24                case $PKG in
25                        scratch2)
26
27                                TEST=$( dpkg-query -s $PACKAGE_NAME 2> /dev/null| grep Status | cut -d " " -f 4 )
28                                if [ "$TEST" == 'installed' ]; then
29                                        echo "0"
30                                else
31                                        echo "1"
32                                fi
33                        ;;
34                esac   
35                                               
36
37        ;;
38
39        installPackage)
40               
41                TEST=$( dpkg-query -s $DEPENDS 2> /dev/null| grep Status | cut -d " " -f 4 )
42                if [ "$TEST" != 'installed' ]; then
43                        echo "Your package $DEPENDS has a problem to be installed in your system, and Scratch need it for install it, please retry again or contact with Lliurex Team at http://mestreacasa.gva.es/web/lliurex/forums"
44                        exit 1
45                fi
46               
47                if [ ! -f  $APP_PATH$VERSION ]; then
48                        echo "Your package $VERSION has a problem to download from lliurex.net, please retry again or contact with Lliurex Team at http://mestreacasa.gva.es/web/lliurex/forums" 
49                        exit 1
50                fi
51               
52                echo "The package $VERSION in downloaded, now it's installing in your system, please wait......."
53                chmod +x $APP_PATH$VERSION
54                if [ -d "/opt/AdobeAirApp/Scratch 2" ];then
55                        rm -rf "/opt/AdobeAirApp/Scratch 2" || true
56                fi
57                /usr/bin/Adobe\ AIR\ Application\ Installer -silent -eulaAccepted -location /opt/AdobeAirApp $APP_PATH$VERSION
58                if [ "$?" = "0" ]; then
59                        echo "Your package $VERSION has been installed in your system"
60                else
61                        echo "Your package $VERSION has a problem to be installed in your system, please retry again or contact with Lliurex Team at http://mestreacasa.gva.es/web/lliurex/forums"
62                        exit 1
63                fi
64        ;;
65
66        postInstall)
67               
68
69echo ">> Modify update file..."
70#Modificamos el fichero de la actualizacion para que no chequee en el arranque
71sed -i -e "s%<versionNumber>$VERSION_ORIG_NUMBER<\/versionNumber>%<versionNumber>$VERSION_LLIUREX_NUMBER<\/versionNumber>%g" "$UPDATE_FILE"
72if [ "$?" = "0" ]; then
73                echo "File version is updated."
74        else
75                echo "`printf "\e[32mError to update file version, this is not very important, but you can have any problem to use it."``echo -e "\033[0m"`"
76        fi
77echo ">> Generating Desktop..."
78#El desktop que se genera lo modificamos para que aparezca en la categoria de educación.
79sed -i -e 's/Categories=Utility;/Categories=Application;Education;/g' "$ICON_FILE"
80if [ "$?" = "0" ]; then
81                echo "Congratulations desktop has been modified with LliureX parameters."
82        else
83                echo "`printf "\e[32mError to modify Desktop, this is not very important, but you can have any problem to use it."``echo -e "\033[0m"`"
84        fi
85sed -i -e 's/GenericName=Scratch\ 2\ Editor/GenericName=Scratch\ 2\ Editor/g' "$ICON_FILE"
86sed -i -e 's/Name=Scratch\ 2\ Editor/Name=Scratch\ 2\ Editor/g' "$ICON_FILE"
87sed -i -e 's/Comment=<>/Comment=Scratch\ 2\ Editor/g' "$ICON_FILE"
88#Y le añadimos los Comentarios y traducciones, aunque antes las eliminamos si existian para que no esten duplicadas en el fichero
89#Eliminacion
90sed -i "/ca_ES/d" "$ICON_FILE"
91sed -i "/\[es\]/d" "$ICON_FILE"
92sed -i "/qcv_ES/d" "$ICON_FILE"
93sed -i "/Exec/d" "$ICON_FILE"
94if [ -f /usr/share/icons/Vibrancy-Colors/apps/scalable/scratch.svg ]; then
95        sed -i "/Icon=/d" "$ICON_FILE"
96        echo "Icon=/usr/share/icons/Vibrancy-Colors/apps/scalable/scratch2editor.svg" >> "$ICON_FILE"
97fi
98#Añadido
99echo "Exec=env http_proxy=\"\" '/opt/AdobeAirApp'/'Scratch 2'/bin/'Scratch 2'" >> "$ICON_FILE"
100echo "Name[ca_ES@valencia]=Scratch 2 Editor local" >> "$ICON_FILE"
101echo "Comment[ca_ES@valencia]=Editor local de programació visual per a l'educació" >> "$ICON_FILE"
102echo "Name[ca_ES.UTF-8@valencia]=Scratch 2 Editor local" >> "$ICON_FILE"
103echo "Comment[ca_ES.UTF-8@valencia]=Editor local de programació visual per a l'educació" >> "$ICON_FILE"
104echo "Name[es]=Scratch 2 Editor local" >> "$ICON_FILE"
105echo "Comment[es]=Editor local de programación visual para la educación" >> "$ICON_FILE"
106echo "Name[es.UTF-8]=Scratch 2 Editor local" >> "$ICON_FILE"
107echo "Comment[es.UTF-8]=Editor local de programación visual para la educación" >> "$ICON_FILE"
108echo "Name[qcv_ES]=Scratch 2 Editor local" >> "$ICON_FILE"
109echo "Comment[qcv_ES]=Editor local de programació visual per a l'educació" >> "$ICON_FILE"
110
111echo "Copy new desktop....."
112cp "$ICON_FILE" "$MATE_ICON_FILE"
113       
114               
115        ;;     
116
117        remove)
118                echo "Removing files..."
119
120                apt-get remove -y $PACKAGE_NAME
121                if [ "$?" = "0" ]; then
122                        echo "$PACKAGE_NAME has been remove from your system."
123                        ls $MATE_ICON_FILE$DESKTOP && rm $MATE_ICON_FILE$DESKTOP
124                        exit 0
125                else
126                        echo "`printf "\e[32mError to remove $PACKAGE_NAME from your system, retry again or contact with Lliurex Team at http://mestreacasa.gva.es/web/lliurex/forums"``echo -e "\033[0m"`"
127                        exit 1
128                fi
129        ;;
130       
131               
132esac
133echo "$PACKAGE_NAME has been installed in your system."
134exit
Note: See TracBrowser for help on using the repository browser.