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

Last change on this file since 5756 was 5756, checked in by jrpelegrina, 3 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
19current_version="google-earth-stable_current_amd64.deb"
20url="http://dl.google.com/dl/earth/client/current/"
21temp="/tmp/google_temp.deb"
22path_name="/tmp"
23file_name="google_temp.deb"
24PACKAGE_NAME="google-earth-pro-stable"
25GEARTH_REPO_FILE="/etc/apt/sources.list.d/google-earth.list"
26OLD_PACKAGE_NAME="google-earth-stable"
27
28zero-center add-pulsating-color zero-lliurex-gearth
29
30#COMPROBAMOS CONEXION A INTERNET
31
32zero-testnet
33if [ $? -eq 0 ]
34        then
35                zenity --info --text="$MSG_BAJAR" > /dev/null 2>&1
36                #axel -o $temp $url$current_version
37                zero-lliurex-axel -u $url$current_version $path_name $file_name
38        else
39                zenity --error --text="$MSG_NO_INTERNET" > /dev/null 2>&1
40                zero-center remove-pulsating-color zero-lliurex-gearth
41                exit 1
42fi
43
44#DESCARGAMOS FICHERO BIN (.BIN)
45flag=0
46
47# COMPROBAMOS SI EL FICHERO SE HA DESCARGADO
48if [ ! -f $temp ]; then
49                zenity --info --text="$MSG_CANCELLED" >/dev/null 2>&1
50                zero-center remove-pulsating-color zero-lliurex-gearth
51                exit 1
52fi     
53       
54
55
56lliurex-version | grep server
57#ES IMPORTANTE EXPORTAR EL PROXY PORQUE GOOGLE EARTH NO NECESITA EN SUS CONEXIONES A LA RED
58if [ $? -eq 0 ]; then
59        flag=1
60else
61        host proxy
62        if [ $? -ne 0 ]; then
63                flag=1
64        fi
65fi
66
67if [ $flag -eq 0 ]; then
68         export http_proxy="proxy:3128"
69fi
70
71
72# PREGUNTAR SI LO QUIERE GUARDAR
73if zenity --question --text="$MSG_COPIAR" > /dev/null 2>&1; then
74        RUTA=$(zenity --file-selection --directory  --text="$MSG_GUARDAR" )
75        if [ ! -z $RUTA ];then
76                cp $temp $RUTA
77        fi     
78fi
79# PREGUNTAR SI LO QUIERE INSTALAR
80if zenity --question --text="$MSG_INSTALAR" > /dev/null 2>&1; then
81        #llamada antigua:
82        #dpkg -i $temp
83        zero-installer -d $temp
84        zenity --info --text="$MSG_INSTALL_COMPLETA" > /dev/null 2>&1
85else
86        zenity --info --text="$MSG_DESCARGA_COMPLETA" > /dev/null 2>&1
87fi
88
89#LIMPIA Y DA ESPLENDOR
90rm -f $temp
91
92old_desktop_path="/usr/share/mate/applications/google-earth.desktop"
93new_desktop_path="/usr/share/mate/applications/google-earth-pro.desktop"
94
95#Comprueba que el paquete se instalo correctamente
96i="$PACKAGE_NAME"
97TEST=$( dpkg-query -s $i 2> /dev/null| grep Status | cut -d " " -f 4 )
98                if [ "$TEST" != 'installed' ]; then
99                        zenity --info --title="Zero-installer" --text="$PACKAGE_NAME $MSG_INSTALL_ERROR" > /dev/null 2>&1 &
100                        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
101                        zero-center remove-pulsating-color zero-lliurex-gearth
102                        zero-center set-non-configured zero-lliurex-gearth
103                        exit 1         
104                else
105                        #Elimino el desktop para utilizar el proporcionado por lliurex-desktops-keeper
106                        if [ -f $old_desktop_path ]; then
107                                rm -f $old_desktop_path
108                        fi     
109
110                        if [ -f $new_desktop_path ]; then
111                                rm -f $new_desktop_path
112                        fi     
113                fi
114               
115                if [ -f $GEARTH_REPO_FILE ]; then
116                        rm -f $GEARTH_REPO_FILE
117                fi
118               
119TEST_OLD=$( dpkg-query -s $OLD_PACKAGE_NAME 2> /dev/null| grep Status | cut -d " " -f 4 )
120
121if [ "$TEST_OLD" == 'installed' ]; then 
122        zenity --info --title="Zero-installer" --text="$MSG_REMOVE_OLD" > /dev/null 2>&1
123        zero-installer remove $OLD_PACKAGE_NAME
124fi
125
126zero-center remove-pulsating-color zero-lliurex-gearth
127zero-center set-configured zero-lliurex-gearth
128
129
130exit 0
Note: See TracBrowser for help on using the repository browser.