source: zero-lliurex-adobeair/trunk/fuentes/zero-lliurex-adobeair.zlaunchers/zero-lliurex-air-installer.zmd @ 6632

Last change on this file since 6632 was 6632, checked in by daduve, 20 months ago

New path to AdobeAir? from official repository

File size: 4.6 KB
Line 
1#!/bin/bash
2
3ICON_FILE="/usr/share/mate/applications/edu.media.mit.scratch2editor.desktop"
4DIRECTORY="/opt/adobe-air-sdk"
5
6if [ $EUID -ne 0 ]; then
7   echo "Debes ejecutarlo como root (o mediante sudo)" 1>&2
8   exit 1
9fi
10
11function adobe_install {
12        echo ">> Eliminando versiones anteriores..."
13        apt-get -y --purge remove adobeair
14        rm -rf /opt/adobe-air-sdk
15        rm $ICON_FILE
16
17        CHKBITS=`uname -m`
18        if [ $CHKBITS = "x86_64" ]; then
19            echo ">> Instalando dependencias 32bit..."
20            apt-get -q update
21            apt-get -q -y install libgtk2.0-0:i386 libstdc++6:i386 libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libqt4-qt3support:i386 libgnome-keyring0:i386 libnss-mdns:i386 libnss3:i386
22        fi
23
24        echo ">> Enlazando librerías de Gnome..."
25        ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
26        ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0
27
28        echo ">> Descargando Adobe Air SDK..."
29        #zero-lliurex-wget http://lliurex.net/recursos-edu/misc/AdobeAIRSDK.tbz2 /tmp
30        zero-lliurex-wget http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRSDK.tbz2
31        #wget -q http://lliurex.net/recursos-edu/misc/AdobeAIRSDK.tbz2
32        mkdir /opt/adobe-air-sdk
33        tar jxf /tmp/AdobeAIRSDK.tbz2 -C /opt/adobe-air-sdk
34
35        echo ">> Descargando Air runtime/SDK desde Archlinux..."
36        #wget -q http://lliurex.net/recursos-edu/misc/adobe-air.tar.gz
37        zero-lliurex-wget http://lliurex.net/recursos-edu/misc/adobe-air.tar.gz /tmp
38        tar xvf /tmp/adobe-air.tar.gz -C /opt/adobe-air-sdk
39        chmod +x /opt/adobe-air-sdk/adobe-air/adobe-air
40
41        echo ">> Ya tenemos el AdobeAir instalado, felicidades..."
42}
43
44function select_file {
45  FILE="$(zenity --file-selection --filename /home/ --title='Select AIR File to install in AdobeAir')"
46  case $? in
47           0)
48                  air_install;;
49           1)
50                  zenity --question \
51                         --title="Word counter" \
52                         --text="No file selected. Do you want to select one?" \
53                         && select_file || exit;;
54          -1)
55                  echo "An unexpected error has occurred."; exit;;
56  esac
57}
58
59function select_icon {
60    ICON_ROUTE="/usr/share/icons/adobeair_icon"
61        if [ ! -d "$ICON_ROUTE" ]; then
62                mkdir -p $ICON_ROUTE
63        fi
64 
65  ICON="$(zenity --file-selection --filename /usr/share/icons/ --title='Select icon to your new App')"
66  case $? in
67           0)
68                cp $ICON $ICON_ROUTE/$ICON; echo "You have selected this Icon: $ICON_ROUTE/$ICON";;
69           1)
70                  zenity --question \
71                         --title="Word counter" \
72                         --text="No file selected. Do you want to select one?" \
73                         && select_icon || $( echo "No desktop created, please execute it again and select one icon"; exit );;
74          -1)
75                  echo "An unexpected error has occurred."; exit;;
76  esac
77}
78
79
80
81function air_install {
82
83        if [ ! -d "$DIRECTORY" ]; then
84                echo "Abort installation, you do not have installed AdobeAIr."
85                exit 1
86        fi
87        echo "You have selected this Air file: $FILE"
88        filename=$(basename $FILE)
89        extension="${filename##*.}"
90        filename_only="${filename%.*}"
91        echo "The extension is $extension"
92        if [ "$extension" == "air" ]; then
93                echo "Is an AIR file, install it..."
94                if [ -d /opt/adobe-air-sdk/$filename_only ]; then
95                        rm -rf /opt/adobe-air-sdk/$filename_only
96                fi
97                mkdir /opt/adobe-air-sdk/$filename_only
98                cp $FILE /opt/adobe-air-sdk/$filename_only/$filename
99                echo "You have installed new AIR file in /opt/adobe-air-sdk/$filename_only/$filename"
100                select_icon
101                NEW_ICON_FILE="/usr/share/applications/$filename_only.desktop"
102               
103cat << _EOF_ > $NEW_ICON_FILE
104[Desktop Entry]
105Encoding=UTF-8
106Version=1.0
107Type=Application
108Exec=/opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/$filename_only/$filename
109Icon=$ICON
110Terminal=false
111Name=$filename_only
112Comment=Application from AdobeAir $filename_only
113MimeType=application/x-scratch-project
114Categories=Application;Education;Development;ComputerScience;
115_EOF_
116chmod +x $NEW_ICON_FILE
117        echo "--------------------------------------------------------------"
118        echo "Congratulations your app can be launched from $NEW_ICON_FILE"
119          zenity --info --title="LliureX Air Installer" --text="Your new Air application can be launched from $NEW_ICON_FILE site in Main Menu -> Education"
120       
121        else
122                echo "Sorry your file is not AIR file, abort installation."
123                exit 1
124        fi
125       
126}
127
128function select_function {
129        ans=$(zenity  --list  --text "Select function" --radiolist  --column "Pick" --column "Option" FALSE AdobeAir TRUE "Select Air file")
130        if [ "$ans" == "" ]; then
131                exit 1
132        else
133                if [ "$ans" == "AdobeAir" ]; then
134                        adobe_install
135                else
136                        select_file
137                fi
138        fi
139}
140
141select_function
Note: See TracBrowser for help on using the repository browser.