#!/bin/bash export TEXTDOMAIN="zero-lliurex-adobeair" MSG_NO_INTERNET=$(gettext "No Internet Connection has been detected. Please, check it") MSG_BAJAR=$(gettext "Scratch 2 will now be downloaded. Aprox. size 49,5MB") SCRATCH_INSTALLED=$(gettext "Scratch is already installed in your system, now we are goig to remove it and install it again") PACKAGE_WORD=$(gettext "Package") UNINSTALLING=$(gettext "Uninstalling") INSTALLING=$(gettext "Installing") DEPENDENCY_FROM=$(gettext "Dependency from package") IS_INSTALLED=$(gettext "is installed, do nothing") ALREADY_INSTALLED=$(gettext "already installed, we have to uninstall it") IS_NOT_INSTALLED=$(gettext "is not installed in your system, it is necessary........ we are goig to do it") HAS_A_PROBLEM=$(gettext "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") IS_DOWNLOADED=$(gettext "is downloaded in your system, install it now") HAS_BEEN_INSTALLED=$(gettext "has been installed in your system") HAS_BEEN_FINISHED=$(gettext "has been finished in your system") HAS_A_PROBLEM_SEE_LOG=$(gettext "has a problem to be installed in your system, please see more info at") CONGRATULATIONS=$(gettext "Congratulations Scratch Editor is now installed in your system.") DIRECTORY="/opt/adobe-air-sdk" DIRECTORY_BASE="/opt/adobe-air-sdk/scratch" #PACKAGE_NAME="edu.media.mit.scratch2editor" URL_SCRATCH="http://lliurex.net/recursos-edu/misc/" #VERSION="Scratch-458.0.1.air" VERSION="Scratch-latest.air" #LOG_FILE="/root/.appdata/Adobe/AIR/Logs/Install.log" TMP_LOG="/tmp/zero-scratch.log" DEPENDS="adobeair" ICON_FILE="/usr/share/mate/applications/edu.media.mit.scratch2editor.desktop" #Para el control de versiones partimos de que la 437 corresponde a la 900 y asi incrementalmente en ambos casos en el fichero indicado #UPDATE_FILE="/opt/AdobeAirApp/Scratch 2/share/META-INF/AIR/application.xml" #VERSION_ORIG_NUMBER="458.0.1" #VERSION_LLIUREX_NUMBER="905" zero-center add-pulsating-color zero-lliurex-adobeair-scratch2 #Antes de nada comprobamos que si existe el Scratch2 en el Sistema, si es asi damos la opcion de desinstalarlo e instalarlo de nuevo. if [ -f "$DIRECTORY_BASE/scratch.air" ]; then if ( zenity --question --text="$SCRATCH_INSTALLED.\n Do you want to do it?" --ok-label="Yes" --cancel-label="No"); then su -c "notify-send -t 5000 -u normal -i /usr/share/icons/lliurex-neu/scalable/apps/zero-center.svg 'Zero-Installer' '$PACKAGE_NAME $MSG_ALREADY_INSTALLED.'" $USER (rm -rf $DIRECTORY_BASE; sleep 2) | zenity --progress --auto-close --pulsate --width 500 --title="Zero-Center-Uninstaller" --text="$UNINSTALLING....." --no-cancel > /dev/null 2>&1 else zero-center remove-pulsating-color zero-lliurex-adobeair-scratch2 zero-center set-configured zero-lliurex-adobeair-scratch2 exit 0 fi fi #Antes de nada comprobamos que existe el Adobe air en el Sistema sino se instala if [ ! -d "$DIRECTORY" ]; then echo "Package $DEPENDS is not installed in your system, it's necessary........ we'll do it" su -c "notify-send -t 5000 -u normal -i /usr/share/icons/lliurex-neu/scalable/apps/zero-center.svg 'Zero-Installer' '$PACKAGE_WORD $DEPENDS $IS_NOT_INSTALLED'" $USER /usr/share/zero-center/zmds/zero-lliurex-adobeair.zmd else echo "$DEPENDENCY_FROM $DEPENDS $IS_INSTALLED" fi #Comprobamos que se esta instalado porque sino abortamos la instalacion if [ ! -d "$DIRECTORY" ]; then zenity --info --title="Zero-installer" --text="$DEPENDS $HAS_A_PROBLEM http://mestreacasa.gva.es/web/lliurex/forums" > /dev/null 2>&1 & zero-center remove-pulsating-color zero-lliurex-adobeair-scratch2 zero-center set-non-configured zero-lliurex-adobeair-scratch2 zero-center set-non-configured zero-lliurex-adobeair exit 1 fi #Comprobar conexion a internet e instalar rc=0 zero-testnet || rc=1 elaula=www.google.es if [ $rc -eq 0 ] then #su -c "notify-send -t 5000 -u critical -i /usr/share/icons/lliurex-neu/scalable/apps/zero-center.svg 'Zero-Installer' ' $MSG_BAJAR ' " $USER #Vamos a comprobar si estamos en el aula y si somos el server, para segun que caso poner el proxy para la descarga o no. rc=0 host $elaula || rc=1 if [ $rc -eq 0 ] then rc=0 dpkg -l zero-server-wizard || rc=1 if [ $rc -eq 1 ]; then echo "Cliente" export http_proxy="proxy:3128" fi su $USER -c "zero-lliurex-wget $URL_SCRATCH$VERSION /tmp" else su $USER -c "zero-lliurex-wget $URL_SCRATCH$VERSION /tmp" fi mkdir $DIRECTORY_BASE cp /tmp/$VERSION /opt/adobe-air-sdk/scratch/scratch.air fi echo ">> Creando lanzador..." : > $ICON_FILE unzip -j $DIRECTORY_BASE/scratch.air icons/AppIcon128.png -d $DIRECTORY_BASE/ cat << _EOF_ > $ICON_FILE [Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Exec=/usr/sbin/lliurex_scratch2.sh Icon=/opt/adobe-air-sdk/scratch/AppIcon128.png Terminal=false Name=Scratch 2 Editor Comment= Programming system and content development tool Name[es]=Scratch, programación visual Comment[es]=Sistema de programación visual para la educación Name[es.UTF-8]=Scratch, programación visual Comment[es.UTF-8]=Sistema de programación visual para la educación Name[ca_ES@valencia]=Scratch, programació visual Comment[ca_ES@valencia]=Sistema de programació visual per a l'educació Name[ca_ES.UTF-8@valencia]=Scratch, programació visual Comment[ca_ES.UTF-8@valencia]=Sistema de programació visual per a l'educació Categories=Application;Education; MimeType=application/x-scratch-project _EOF_ chmod +x $ICON_FILE : > /usr/sbin/lliurex_scratch2.sh cat << _EOF_ > /usr/sbin/lliurex_scratch2.sh #!/bin/bash http_proxy=""; /opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/scratch/scratch.air _EOF_ chmod +x /usr/sbin/lliurex_scratch2.sh if [ -f "$DIRECTORY_BASE/scratch.air" ]; then zenity --info --title="Zero-installer" --text="$CONGRATULATIONS" > /dev/null 2>&1 & zero-center set-configured zero-lliurex-adobeair-scratch2 zero-center remove-pulsating-color zero-lliurex-adobeair-scratch2 exit 0 else zenity --info --title="Zero-installer" --text="Scratch Editor $HAS_A_PROBLEM" > /dev/null 2>&1 & zero-center set-non-configured zero-lliurex-adobeair-scratch2 zero-center remove-pulsating-color zero-lliurex-adobeair-scratch2 exit 1 fi zero-center remove-pulsating-color zero-lliurex-adobeair-scratch2 zero-center set-configured zero-lliurex-adobeair-scratch2 exit 0