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

Last change on this file since 6427 was 6427, checked in by daduve, 22 months ago

New Air Installer

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        #wget -q http://lliurex.net/recursos-edu/misc/AdobeAIRSDK.tbz2
31        mkdir /opt/adobe-air-sdk
32        tar jxf /tmp/AdobeAIRSDK.tbz2 -C /opt/adobe-air-sdk
33
34        echo ">> Descargando Air runtime/SDK desde Archlinux..."
35        #wget -q http://lliurex.net/recursos-edu/misc/adobe-air.tar.gz
36        zero-lliurex-wget http://lliurex.net/recursos-edu/misc/adobe-air.tar.gz /tmp
37        tar xvf /tmp/adobe-air.tar.gz -C /opt/adobe-air-sdk
38        chmod +x /opt/adobe-air-sdk/adobe-air/adobe-air
39
40        echo ">> Ya tenemos el AdobeAir instalado, felicidades..."
41}
42
43function select_file {
44  FILE="$(zenity --file-selection --filename /home/ --title='Select AIR File to install in AdobeAir')"
45  case $? in
46           0)
47                  air_install;;
48           1)
49                  zenity --question \
50                         --title="Word counter" \
51                         --text="No file selected. Do you want to select one?" \
52                         && select_file || exit;;
53          -1)
54                  echo "An unexpected error has occurred."; exit;;
55  esac
56}
57
58function select_icon {
59    ICON_ROUTE="/usr/share/icons/adobeair_icon"
60        if [ ! -d "$ICON_ROUTE" ]; then
61                mkdir -p $ICON_ROUTE
62        fi
63 
64  ICON="$(zenity --file-selection --filename /usr/share/icons/ --title='Select icon to your new App')"
65  case $? in
66           0)
67                cp $ICON $ICON_ROUTE/$ICON; echo "You have selected this Icon: $ICON_ROUTE/$ICON";;
68           1)
69                  zenity --question \
70                         --title="Word counter" \
71                         --text="No file selected. Do you want to select one?" \
72                         && select_icon || $( echo "No desktop created, please execute it again and select one icon"; exit );;
73          -1)
74                  echo "An unexpected error has occurred."; exit;;
75  esac
76}
77
78
79
80function air_install {
81
82        if [ ! -d "$DIRECTORY" ]; then
83                echo "Abort installation, you do not have installed AdobeAIr."
84                exit 1
85        fi
86        echo "You have selected this Air file: $FILE"
87        filename=$(basename $FILE)
88        extension="${filename##*.}"
89        filename_only="${filename%.*}"
90        echo "The extension is $extension"
91        if [ "$extension" == "air" ]; then
92                echo "Is an AIR file, install it..."
93                if [ -d /opt/adobe-air-sdk/$filename_only ]; then
94                        rm -rf /opt/adobe-air-sdk/$filename_only
95                fi
96                mkdir /opt/adobe-air-sdk/$filename_only
97                cp $FILE /opt/adobe-air-sdk/$filename_only/$filename
98                echo "You have installed new AIR file in /opt/adobe-air-sdk/$filename_only/$filename"
99                select_icon
100                NEW_ICON_FILE="/usr/share/applications/$filename_only.desktop"
101               
102cat << _EOF_ > $NEW_ICON_FILE
103[Desktop Entry]
104Encoding=UTF-8
105Version=1.0
106Type=Application
107Exec=/opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/$filename_only/$filename
108Icon=$ICON
109Terminal=false
110Name=$filename_only
111Comment=Application from AdobeAir $filename_only
112MimeType=application/x-scratch-project
113Categories=Application;Education;Development;ComputerScience;
114_EOF_
115chmod +x $NEW_ICON_FILE
116        echo "--------------------------------------------------------------"
117        echo "Congratulations your app can be launched from $NEW_ICON_FILE"
118          zenity --info --title="LliureX Air Installer" --text="Your new Air application can be launched from $NEW_ICON_FILE site in Main Menu -> Education"
119       
120        else
121                echo "Sorry your file is not AIR file, abort installation."
122                exit 1
123        fi
124       
125}
126
127function select_function {
128        ans=$(zenity  --list  --text "Select function" --radiolist  --column "Pick" --column "Option" FALSE AdobeAir TRUE "Select Air file")
129        if [ "$ans" == "" ]; then
130                exit 1
131        else
132                if [ "$ans" == "AdobeAir" ]; then
133                        adobe_install
134                else
135                        select_file
136                fi
137        fi
138}
139
140select_function
Note: See TracBrowser for help on using the repository browser.