source: zero-lliurex-gearth/trunk/fuentes/zero-lliurex-gearth.i386.zmd @ 5756

Last change on this file since 5756 was 5756, checked in by jrpelegrina, 2 years ago

WIP in changes

File size: 4.4 KB
Line 
1#!/bin/bash
2
3export TEXTDOMAIN="zero-lliurex-gearth"
4
5MSG_BAJAR=$(gettext "Google Earth will now be installed. Aprox. size 50MB")
6MSG_NO_INTERNET=$(gettext "No Internet Connection has been detected. Please, check it")
7MSG_MINUTOS=$(gettext "This operation can take a few minutes. Please wait")
8MSG_BAJANDO_FICHEROS=$(gettext "Necessary files are being downloaded")
9MSG_GENERANDO_PAQUETE=$(gettext "Google Earth package is being built up")
10MSG_COPIAR=$(gettext "Would you like to save a copy of *.deb for a future installation")
11MSG_GUARDAR=$(gettext "Choose a directory for saving the file copy")
12MSG_INSTALAR=$(gettext "Would you like to install Google Earth in this PC?")
13MSG_INSTALL_COMPLETA=$(gettext "Installation has been completed. You can access Google Earth throught Applications/Internet.")
14MSG_DESCARGA_COMPLETA=$(gettext "Google Earth has been successfully downloaded")
15MSG_INSTALL_ERROR=$(gettext "is not installed in your system, please retry again and test if you have acess to repositories in net, or contact with Lliurex Team at http://mestreacasa.gva.es/web/lliurex/forums")
16MSG_CANCELLED=$(gettext "Your dowloading has been cancel. Google Earth will not be installed in your system ")
17MSG_REMOVE_OLD=$(gettext "Previous version of Google Earth will be uninstalled")
18
19
20current_version="google-earth-stable_current_i386.deb"
21url="http://dl.google.com/dl/earth/client/current/"
22temp="/tmp/google_temp.deb"
23path_name="/tmp"
24file_name="google_temp.deb"
25PACKAGE_NAME="google-earth-pro-stable"
26GEARTH_REPO_FILE="/etc/apt/sources.list.d/google-earth.list"
27OLD_PACKAGE_NAME="google-earth-stable"
28
29
30
31zero-center add-pulsating-color zero-lliurex-gearth
32
33#COMPROBAMOS CONEXION A INTERNET
34
35zero-testnet
36if [ $? -eq 0 ]
37        then
38                zenity --info --text="$MSG_BAJAR" > /dev/null 2>&1
39                #axel -o $temp $url$current_version
40                zero-lliurex-axel -u $url$current_version $path_name $file_name
41        else
42                zenity --error --text="$MSG_NO_INTERNET" > /dev/null 2>&1
43                zero-center remove-pulsating-color zero-lliurex-gearth
44                exit 1
45fi
46
47#DESCARGAMOS FICHERO BIN (.BIN)
48flag=0
49
50# COMPROBAMOS SI EL FICHERO SE HA DESCARGADO
51if [ ! -f $temp ]; then
52                zenity --info --text="$MSG_CANCELLED" >/dev/null 2>&1
53                zero-center remove-pulsating-color zero-lliurex-gearth
54                exit 1
55fi     
56
57lliurex-version | grep server
58#ES IMPORTANTE EXPORTAR EL PROXY PORQUE GOOGLE EARTH NO NECESITA EN SUS CONEXIONES A LA RED
59if [ $? -eq 0 ]; then
60        flag=1
61else
62        host proxy
63        if [ $? -ne 0 ]; then
64                flag=1
65        fi
66fi
67
68if [ $flag -eq 0 ]; then
69         export http_proxy="proxy:3128"
70fi
71
72
73# PREGUNTAR SI LO QUIERE GUARDAR
74if zenity --question --text="$MSG_COPIAR" > /dev/null 2>&1; then
75        RUTA=$(zenity --file-selection --directory  --text="$MSG_GUARDAR" )
76        if [ ! -z $RUTA ];then
77                cp $temp $RUTA
78        fi     
79       
80fi
81# PREGUNTAR SI LO QUIERE INSTALAR
82if zenity --question --text="$MSG_INSTALAR" > /dev/null 2>&1; then
83        #llamada antigua:
84        #dpkg -i $temp
85        zero-installer -d $temp
86        zenity --info --text="$MSG_INSTALL_COMPLETA" > /dev/null 2>&1
87else
88        zenity --info --text="$MSG_DESCARGA_COMPLETA" > /dev/null 2>&1
89fi
90
91#LIMPIA Y DA ESPLENDOR
92rm -f $temp
93old_desktop_path="/usr/share/mate/applications/google-earth.desktop"
94new_desktop_path="/usr/share/mate/applications/google-earth-pro.desktop"
95
96#Comprueba que el paquete se instalo correctamente
97i="$PACKAGE_NAME"
98TEST=$( dpkg-query -s $i 2> /dev/null| grep Status | cut -d " " -f 4 )
99                if [ "$TEST" != 'installed' ]; then
100                        zenity --info --title="Zero-installer" --text="$PACKAGE_NAME $MSG_INSTALL_ERROR" > /dev/null 2>&1 &
101                        su -c "notify-send -t 2000 -u critical -i /usr/share/icons/lliurex-neu/scalable/apps/zero-center.svg 'Zero-Installer' '$PACKAGE_NAME $MSG_INSTALL_ERROR'" $USER
102                        zero-center remove-pulsating-color zero-lliurex-gearth
103                        zero-center set-non-configured zero-lliurex-gearth
104                        exit 1         
105                                       
106                else
107                        #Elimino el desktop para utilizar el proporcionado por lliurex-desktops-keeper
108                        if [ -f $old_desktop_path ]; then
109                                rm -f $old_desktop_path
110                        fi
111                        if [ -f $new_desktop_path ]; then
112                                rm -f $new_desktop_path
113                        fi             
114                fi
115
116                if [ -f $GEARTH_REPO_FILE ]; then
117                        rm -f $GEARTH_REPO_FILE
118                fi
119
120TEST_OLD=$( dpkg-query -s $OLD_PACKAGE_NAME 2> /dev/null| grep Status | cut -d " " -f 4 )
121
122if [ "$TEST_OLD" == 'installed' ]; then 
123        zenity --info --title="Zero-installer" --text="$MSG_REMOVE_OLD" > /dev/null 2>&1
124        zero-installer remove $OLD_PACKAGE_NAME
125fi
126
127
128zero-center remove-pulsating-color zero-lliurex-gearth
129zero-center set-configured zero-lliurex-gearth
130
131
132exit 0
Note: See TracBrowser for help on using the repository browser.