source: zero-lliurex-java-jre-selector/trunk/fuentes/zero-lliurex-java-jre-selector.zlaunchers/zero-lliurex-java-jre-selector.zmd @ 312

Last change on this file since 312 was 312, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 1.5 KB
Line 
1#!/bin/bash
2
3export TEXTDOMAIN="zero-lliurex-java-jre-selector"
4
5MSG_USANDO=$(gettext "You are using:")
6MSG_CAMBIAR=$(gettext "Do you wish to change it?")
7MSG_TITLE=$(gettext "Java Selection Tool")
8MSG_CHOOSE=$(gettext "Choose your Java Machine")
9MSG_MARK=$(gettext "Choose")
10MSG_DIR=$(gettext "Directory")
11MSG_VERSION=$(gettext "Version")
12MSG_NOPERMISSIONS=$(gettext "No permission")
13MSG_DONE=$(gettext "Done")
14
15ACTUAL=$(update-alternatives --get-selections | grep java$)
16USANDO=$(echo $ACTUAL | cut -d" " -f3 | cut -d"/" -f5)
17
18RESPUESTA=$(zenity --question --title="$MSG_TITLE" --width=300 --height=100 --text="$MSG_USANDO\n<span color=\"red\">$USANDO</span>\n$MSG_CAMBIAR")
19
20if [ $? -eq 0 ]; then
21        UPDATE_LONG=$(update-alternatives --list java| grep -v "gij")
22        UPDATE_SHORT=$(update-alternatives --list java | grep -v "gij"| cut -d"/" -f5)
23        CONTADOR=1
24        for DIRECTORIO in $UPDATE_LONG ; do
25                SHORT=$(echo $UPDATE_SHORT | cut -d" " -f$CONTADOR)
26                ENTRADA="FALSE "$DIRECTORIO" "$SHORT
27                LIST=(${LIST[@]} "$ENTRADA")
28                let CONTADOR=CONTADOR+1
29        done
30
31        SELECCION=$(zenity --title="$MSG_TITLE" --width=600 --height=200 --text="$MSG_CHOOSE" --list --column="$MSG_MARK" --column="$MSG_DIR" --column="$MSG_VERSION" --radiolist ${LIST[*]})
32
33        if [ $? -eq 0 ]; then
34                IFS="|"
35                update-alternatives --set java $SELECCION
36                if [ $? -eq 0 ]; then
37                        zenity --info --title="$MSG_TITLE" --text="$MSG_DONE"
38                else
39                        zenity --error --title="$MSG_TITLE" --text="$MSG_NOPERMISSIONS"
40                fi
41                IFS=""
42        fi
43
44fi
45
46exit 0
Note: See TracBrowser for help on using the repository browser.