Changeset 7343


Ignore:
Timestamp:
Jun 5, 2018, 12:15:47 PM (17 months ago)
Author:
jrpelegrina
Message:

Deleted files for the zenity version of the zomando

Location:
zero-lliurex-dni/trunk/fuentes
Files:
5 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • zero-lliurex-dni/trunk/fuentes/debian/changelog

    r5039 r7343  
     1zero-lliurex-dni (0.37) xenial; urgency=medium
     2
     3  * Implemented changes to EPI
     4  * Updated categorization
     5
     6 -- Juan Ramon Pelegrina <juapesai@hotmail.com>  Fri, 27 Apr 2018 11:43:50 +0200
     7
    18zero-lliurex-dni (0.36) xenial; urgency=medium
    29
  • zero-lliurex-dni/trunk/fuentes/debian/control

    r1833 r7343  
    88Package: zero-lliurex-dni
    99Architecture: all
    10 Depends: 
     10Depends:epi-gtk
    1111Description: DNI-e Installer
    1212 Installer for DNI-e under GVA
  • zero-lliurex-dni/trunk/fuentes/zero-lliurex-dni.zlaunchers/zero-lliurex-accv.app

    r507 r7343  
    1111Comment[ca_ES]=Configura el mòdul de l'ACCV al Firefox
    1212Icon=accv
    13 Category=Software
     13Category=Support
    1414ScriptPath=zero-lliurex-accv.zmd
    1515Service=False
  • zero-lliurex-dni/trunk/fuentes/zero-lliurex-dni.zlaunchers/zero-lliurex-accv.zmd

    r5039 r7343  
    11#!/bin/bash
    22
    3 #set -x
    4 
    5 ## Global Variables
    6 ###################
    7 
    8 
    9 USER_NAME=$USER # User name
    10 USER_HOME="" # Home user folder
    11 FF_PROFILE_PATH="" # Absolute path to user firefox profile
    12 TH_PROFILE_PATH="" # Absolute path to user firefox profile
    13 LIBRARY="secmod.db"
    14 ROUTE_LIBRARY="/var/lib/nssdb"
    15 ROUTE_MOZILLA="/usr/lib/firefox/browser/defaults/profile/"
    16 ROUTE_THUNDERBIRD="/usr/lib/thunderbird/defaults/profile/"
    17 ACCV_FILES="/usr/share/accv-files"
    18 ERROR=0
    19 ACCV_LOG="/tmp/accv.log"
    20 ACCV_ERROR="/tmp/.accv_error.log"
    21 
    22 export TEXTDOMAIN="zero-lliurex-dni"
    23 
    24 # MSGS
    25 MSG_CANCEL_LABEL="$(gettext 'Cancel')"
    26 MSG_OK_LABEL="$(gettext 'Install')"
    27 MSG_TITLE="$(gettext 'ACCV CARD READER CONFIGURATOR')"
    28 MSG_LIBRARY_NOT_FOUND="$(gettext 'Library not found:')"
    29 MSG_ERROR_LINK="$(gettext 'is not in your system, impossible to create link.')"
    30 MSG_ERROR_REPOS="$(gettext 'is impossible to install , perhaps you have some problems with repositories.')"
    31 MSG_DRIVER_INFO="$(gettext 'With this assitent you are going to install card drivers\nfrom ACCV to use in Firefox and Thunderbird.')"
    32 MSG_OK_DRIVER="$(gettext 'Card readers accepted:')"
    33 MSG_FAILED_DRIVER="$(gettext 'Unstable card readers:')"
    34 MSG_SOME_PROBLEM_FIREFOX="$(gettext 'Some problem with firefox profile')"
    35 MSG_ONCE_FIREFOX="$(gettext 'Start firefox once at least')"
    36 MSG_SOME_PROBLEM_THUNDER="$(gettext 'Some problem with Thunderbird profile')"
    37 MSG_ONCE_THUNDER="$(gettext 'Start Thunderbird once at least')"
    38 MSG_RUNNING_FIREFOX="$(gettext 'Firefox is running. Stop it!')"
    39 MSG_RUNNING_THUNDER="$(gettext 'Thunderbird is running. Stop it!')"
    40 MSG_NOT_FIREFOX="$(gettext 'Firefox is not installed')"
    41 MSG_NOT_THUNDER="$(gettext 'Thunderbird is not installed')"
    42 MSG_INSTALLING_ACCV_PROGRESS="$(gettext 'Installing ACCV in your computer...')"
    43 MSG_ZENITY_ACCV_FIREFOX_1="$(gettext 'Installing ACCV modules in your system')"
    44 MSG_ZENITY_ACCV_FIREFOX_2="$(gettext 'ACCV modules in Firefox')"
    45 MSG_ZENITY_ACCV_THUNDER_1="$(gettext 'ACCV modules in Thunderbird')"
    46 MSG_FINAL_ACCV_ERROR="$(gettext 'Impossible to install ACCV module, correct the problems and execute this program again please.')"
    47 MSG_FINAL_ACCV_OK="$(gettext 'ACCV modules are installed with success in Firefox and Thunderbird profile,\nfor others users you have to execute this action again on each session,\nOLNY if they are not new users in the system.')"
    48 MSG_CREATING_THUNDER="$(gettext 'We have to create your Thundebird profile, now it will be launched, please close thunderbird and installation continues')"
    49 MSG_CREATING_FIREFOX="$(gettext 'We have to create your Firefox profile, now it will be launched, then please close Firefox and installation continues')"
    50 
    51 
    52 
    53 
    54 
    55 
    56 
    57 
    58 
    59 user_home(){
    60    
    61    USER_HOME=$(getent passwd "$USER_NAME" | cut -d: -f 6)
    62    echo "My USER_HOME is: $USER_HOME" >> $ACCV_LOG
    63 }
    64 
    65 test_running_firefox(){
    66 
    67    is_running=$(ps -aux | grep /usr/lib/firefox/firefox | grep -v grep | wc -l)
    68         if [ $is_running -gt 0 ]; then
    69                 while [ $is_running -gt 0 ] ; do
    70                         zenity --info --text="$MSG_RUNNING_FIREFOX"
    71                         is_running=$(ps -aux | grep /usr/lib/firefox/firefox | grep -v grep | wc -l)
    72                 done
    73         fi
    74         return 0
    75 }
    76 
    77 test_running_thunderbird(){
    78 
    79    is_running=$(ps -fe | grep thunderbird | grep -v grep | wc -l)
    80         if [ $is_running -gt 0 ]; then
    81                 while [ $is_running -gt 0 ] ; do
    82                         zenity --info --title="$MSG_TITLE" --text="$MSG_RUNNING_THUNDER"
    83                         is_running=$(ps -fe | grep thunderbird | grep -v grep | wc -l)
    84                 done
    85         fi
    86         return 0
    87 }
    88 
    89 test_installed_package(){
    90 
    91    TEST=$( dpkg-query -s $1 2> /dev/null| grep Status | cut -d " " -f 4 )
    92         if [ "$TEST" == 'installed' ]; then
    93                 ERROR=0
    94                 echo "$ERROR $1 is installed in your system" > $ACCV_ERROR
    95                 return 0
    96         else
    97                 ERROR=1
    98                 echo "$ERROR test_installed_package" > $ACCV_ERROR
    99                 return 1       
    100         fi
    101 }
    102 
    103 
    104 
    105 ## Firefox functions
    106 ####################
    107 
    108 get_firefox_default_profile(){
    109    
    110    # Getting Mozilla products default profile
    111    # http://kb.mozillazine.org/Profiles.ini_file
    112    #
    113    # Get default profile info
    114    # This script must be capable of dealing with multiple profiles
    115    # and relative or absolute paths, for now ... buff!!
    116    #
    117    # This script get Default path profile if Default=1 or
    118    # get first profile in other case
    119  
    120    TMP_FILE=$(mktemp)
    121    cat $FF_PATH/profiles.ini | awk -F ' *= *' '{ if ($1 ~ /^\[/) section=$1; else if ($1 !~ /^$/) print $1 section "=" "\"" $2 "\"" }' > $TMP_FILE
    122    DEFAULT_EXISTS=$(grep ^Default $TMP_FILE)
    123    if [ -n $DEFAULT_EXISTS ]; then
    124         PROFILE_ID=$(cat $TMP_FILE | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    125    else
    126         PROFILE_ID=$(echo $DEFAULT_EXISTS | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    127    fi
    128    IS_RELATIVE=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^IsRelative | cut -d"=" -f 2 | sed -e 's/\"//g')
    129    TMP_PATH=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^Path | cut -d"=" -f 2 | sed -e 's/\"//g')
    130    if [ $IS_RELATIVE = "0" ]; then
    131       FF_PROFILE_PATH=$TMP_PATH
    132    else
    133       FF_PROFILE_PATH=$FF_PATH/$TMP_PATH
    134    fi
    135    echo "My Firefox Profile is $FF_PROFILE_PATH" >> $ACCV_LOG
    136    rm -f $TMP_FILE
    137 }
    138 
    139 
    140 
    141 ## Thunderbird functions
    142 ####################
    143 
    144 get_thunderbird_default_profile(){
    145    
    146    # Getting Mozilla products default profile
    147    # http://kb.mozillazine.org/Profiles.ini_file
    148    #
    149    # Get default profile info
    150    # This script must be capable of dealing with multiple profiles
    151    # and relative or absolute paths, for now ... buff!!
    152    #
    153    # This script get Default path profile if Default=1 or
    154    # get first profile in other case
    155  
    156    TMP_FILE=$(mktemp)
    157    cat $TH_PATH/profiles.ini | awk -F ' *= *' '{ if ($1 ~ /^\[/) section=$1; else if ($1 !~ /^$/) print $1 section "=" "\"" $2 "\"" }' > $TMP_FILE
    158    DEFAULT_EXISTS=$(grep ^Default $TMP_FILE)
    159    if [ -n $DEFAULT_EXISTS ]; then
    160         PROFILE_ID=$(cat $TMP_FILE | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    161    else
    162         PROFILE_ID=$(echo $DEFAULT_EXISTS | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    163    fi
    164    IS_RELATIVE=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^IsRelative | cut -d"=" -f 2 | sed -e 's/\"//g')
    165    TMP_PATH=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^Path | cut -d"=" -f 2 | sed -e 's/\"//g')
    166    if [ $IS_RELATIVE = "0" ]; then
    167       TH_PROFILE_PATH=$TMP_PATH
    168    else
    169       TH_PROFILE_PATH=$TH_PATH/$TMP_PATH
    170    fi
    171    echo "My Thunderbird Profile is $TH_PROFILE_PATH" >> $ACCV_LOG
    172    rm -f $TMP_FILE
    173 }
    174 
    175 test_firefox_user_profile() {
    176 
    177    if [ -d $FF_PATH ]; then
    178         get_firefox_default_profile
    179         if [ ! -d $FF_PROFILE_PATH ]; then
    180                 zenity --info --title="$MSG_TITLE" --text="$MSG_SOME_PROBLEM_FIREFOX"
    181                 return 1
    182         fi
    183         ERROR=0
    184         echo "$ERROR firefox_user_profile" > $ACCV_ERROR
    185         return 0
    186    else
    187       zenity --info --title="$MSG_TITLE" --text="$MSG_CREATING_FIREFOX"
    188       echo "$MSG_CREATING_FIREFOX" >> $ACCV_LOG
    189         su $USER -c "firefox"
    190         test_running_firefox
    191         get_firefox_default_profile
    192         return 0
    193    fi
    194        
    195 }
    196 
    197 test_thunderbird_user_profile() {
    198 
    199    if [ -d $TH_PATH ]; then
    200         get_thunderbird_default_profile
    201         if [ ! -d $TH_PROFILE_PATH ]; then
    202                 zenity --info --title="$MSG_TITLE" --text="$MSG_SOME_PROBLEM_THUNDER"
    203                 return 1
    204         fi
    205         ERROR=0
    206         echo "$ERROR thunderbird user profile" > $ACCV_ERROR
    207         return 0
    208    else
    209         zenity --info --title="$MSG_TITLE" --text="$MSG_CREATING_THUNDER"
    210         echo "$MSG_CREATING_THUNDER" >> $ACCV_LOG
    211         su $USER -c "thunderbird"
    212         test_running_thunderbird
    213         get_thunderbird_default_profile
    214         return 0
    215    fi
    216        
    217 }
    218 
    219 
    220 remove_accv_module_firefox(){
    221 
    222    #su $USER -c "modutil -disable $FF_MODULE_NAME -force -dbdir $FF_PROFILE_PATH 2>&1"
    223    #su $USER -c "modutil -delete $FF_MODULE_NAME -force -dbdir $FF_PROFILE_PATH 2>&1"
    224         if [ -f $FF_PROFILE_PATH/$LIBRARY ]; then
    225                 rm $FF_PROFILE_PATH/$LIBRARY>> $ACCV_LOG
    226                 echo "Deleting obsolete library in firefox home $FF_PROFILE_PATH/secmod.db" >> $ACCV_LOG
    227         fi
    228 }
    229 
    230 remove_accv_module_thunderbird(){
    231 
    232         if [ -f $TH_PROFILE_PATH/$LIBRARY ]; then
    233                 rm $TH_PROFILE_PATH/$LIBRARY>> $ACCV_LOG
    234                 echo "Deleting obsolete library in thunderbird home $TH_PROFILE_PATH/secmod.db" >> $ACCV_LOG
    235         fi
    236 }
    237 
    238 enable_accv_module_firefox(){
    239 
    240    #su $USER -c "modutil -add $FF_MODULE_NAME -force -libfile $LIBRARY -dbdir $FF_PROFILE_PATH 2>&1"
    241    #su $USER -c "modutil -enable $FF_MODULE_NAME -force -dbdir $FF_PROFILE_PATH 2>&1"
    242         su $USER -c "ln -s $ROUTE_LIBRARY/$LIBRARY $FF_PROFILE_PATH" >> $ACCV_LOG
    243         echo "Creating link to firefox home, from $ROUTE_LIBRARY/$LIBRARY to $FF_PROFILE_PATH/secmod.db" >> $ACCV_LOG
    244                
    245 }
    246 
    247 enable_accv_module_thunderbird(){
    248 
    249         su $USER -c "ln -s $ROUTE_LIBRARY/$LIBRARY $TH_PROFILE_PATH" >> $ACCV_LOG
    250         echo "Creating link to thunderbird home, from $ROUTE_LIBRARY/$LIBRARY to $TH_PROFILE_PATH/secmod.db" >> $ACCV_LOG
    251 }
    252 
    253 do_firefox(){
    254 
    255    test_installed_package firefox
    256    #rgrep 0 $ACCV_ERROR
    257    TESTED=$?
    258    if [ "$TESTED" == "0" ] ; then
    259         test_running_firefox
    260         if [ $? -gt 0 ]; then
    261                 zenity --info --title="$MSG_TITLE" --text="$MSG_RUNNING_FIREFOX"
    262                 ERROR=1
    263                 echo "$ERROR do_firefox" > $ACCV_ERROR
    264                 exit 2
    265         else
    266                 test_firefox_user_profile
    267                 if [ $? == 0 ]; then
    268                         echo "---> PERFIL DE FIREFOX CONOCIDO CONTINUAMOS <---" >> $ACCV_LOG
    269                         remove_accv_module_firefox
    270                         enable_accv_module_firefox
    271                 fi
    272         fi
    273    else
    274       zenity --info --title="$MSG_TITLE" --text="$MSG_NOT_FIREFOX"
    275       ERROR=1
    276         echo "$ERROR do_firefox_else" > $ACCV_ERROR
    277         echo "*** $MSG_NOT_FIREFOX ***" >> $ACCV_LOG
    278       exit 1
    279    fi
    280 }
    281 
    282 do_thunderbird(){
    283 
    284    test_installed_package thunderbird
    285    TESTED=$?
    286    if [ "$TESTED" == "0" ] ; then
    287         test_running_thunderbird
    288         if [ $? -gt 0 ]; then
    289                 zenity --info --title="$MSG_TITLE" --text="$MSG_RUNNING_THUNDER"
    290                  ERROR=1
    291                 echo "$ERROR do_thunderbird" > $ACCV_ERROR
    292                 exit 2
    293         else
    294                 test_thunderbird_user_profile
    295                 if [ $? == 0 ]; then
    296                         echo "---> PERFIL DE THUNDERBIRD CONOCIDO CONTINUAMOS <---" >> $ACCV_LOG
    297                         remove_accv_module_thunderbird
    298                         enable_accv_module_thunderbird
    299                 fi
    300         fi
    301    else
    302       zenity --info --title="$MSG_TITLE" --text="$MSG_NOT_THUNDER"
    303       ERROR=1
    304       echo "$ERROR do_thunderbird_else" > $ACCV_ERROR
    305       echo "*** $MSG_NOT_THUNDER ***" >> $ACCV_LOG
    306       exit 1
    307    fi
    308 }
    309 
    310 
    311 make_link(){
    312 
    313         #Preparo el sistema con la libreria original renombrada
    314         if [ -f  "$ROUTE_LIBRARY/secmod_orig.db" ]; then
    315                 cp $ACCV_FILES/secmod.db /var/lib/nssdb/secmod.db
    316                 echo "$ROUTE_LIBRARY/secmod_orig.db exists in your system only make the COPY again." >> $ACCV_LOG
    317         else
    318                 mv $ROUTE_LIBRARY/$LIBRARY $ROUTE_LIBRARY/secmod_orig.db
    319                 cp $ACCV_FILES/$LIBRARY $ROUTE_LIBRARY/$LIBRARY
    320                 echo "$ROUTE_LIBRARY/secmod_orig.db don't exists in your system, make MOVE and COPY." >> $ACCV_LOG
    321         fi
    322                
    323        
    324         # Compruebo si existe la libreria que necesito.
    325         if [ ! -e $ROUTE_MOZILLA$LIBRARY ]; then
    326                 echo "Library for firefox don't exists in firefox default">> $ACCV_LOG
    327                
    328                 #No existe la libreria compruebo que el directorio donde he de crear el enlace existe, sino lo creo.
    329                 if [ ! -d $ROUTE_MOZILLA ]; then
    330                         echo "Create directory in firefox for ln">> $ACCV_LOG
    331                         mkdir -p  $ROUTE_MOZILLA
    332                 fi
    333                
    334                 #Compruebo que existe la libreria de origen.
    335                 if [ -e $ROUTE_LIBRARY/$LIBRARY ]; then
    336                 echo "Make the ln from original file to mozilla firefox directory">> $ACCV_LOG
    337                         ln -s $ROUTE_LIBRARY/$LIBRARY $ROUTE_MOZILLA$LIBRARY || echo " Link is not done: $ROUTE_MOZILLA$LIBRARY " >> $ACCV_LOG
    338        
    339                 else
    340                         echo " * Warning :  $ROUTE_LIBRARY/$LIBRARY     not found in your system.">> $ACCV_LOG
    341                         echo "">> $ACCV_LOG
    342                         echo "Abort installation">> $ACCV_LOG
    343                         zenity --error --title="$MSG_TITLE" --text="$ROUTE_LIBRARY/$LIBRARY $MSG_ERROR_LINK $MSG_FINAL_ACCV_ERROR"
    344                         exit 1
    345                 fi
    346         else
    347                 echo "Mozilla FIREFOX default preseed has the link" >> $ACCV_LOG
    348         fi
    349         echo "Link for library has created in $ROUTE_MOZILLA$LIBRARY" >> $ACCV_LOG
    350        
    351         # Compruebo si existe la libreria que necesito.
    352         if [ ! -e $ROUTE_THUNDERBIRD$LIBRARY ]; then
    353                 echo "Library don't exists in thunderbird default">> $ACCV_LOG
    354                
    355                 #No existe la libreria compruebo que el directorio donde he de crear el enlace existe, sino lo creo.
    356                 if [ ! -d $ROUTE_THUNDERBIRD ]; then
    357                         echo "Create thunderbird directory for ln">> $ACCV_LOG
    358                         mkdir -p  $ROUTE_THUNDERBIRD
    359                 fi
    360                
    361                 #Compruebo que existe la libreria de origen.
    362                 if [ -e $ROUTE_LIBRARY/$LIBRARY ]; then
    363                 echo "Make the ln from original file to thunderbird directory">> $ACCV_LOG
    364                         ln -s $ROUTE_LIBRARY/$LIBRARY $ROUTE_THUNDERBIRD$LIBRARY || echo " Link is not done: $ROUTE_THUNDERBIRD$LIBRARY " >> $ACCV_LOG
    365        
    366                 else
    367                         echo " * Warning :  $ROUTE_LIBRARY/$LIBRARY     not found in your system.">> $ACCV_LOG
    368                         echo "">> $ACCV_LOG
    369                         echo "Abort installation">> $ACCV_LOG
    370                         zenity --error --title="$MSG_TITLE" --text="$ROUTE_LIBRARY/$LIBRARY $MSG_ERROR_LINK $MSG_FINAL_ACCV_ERROR"
    371                         exit 1
    372                 fi
    373         else
    374                 echo "Mozilla THUNDERBIRD default preseed has the link" >> $ACCV_LOG
    375         fi
    376         echo "Link for THUNDERBIRD library has created in $ROUTE_MOZILLA$LIBRARY" >> $ACCV_LOG
    377        
    378 
    379 }
    380 
    381 
    382 #funcion de error en caso de no poder instalar un deb
    383 check_install(){
    384         if [ $1 != 0 ] ; then
    385                 zenity --error --title="$MSG_TITLE" --text="$2 $MSG_ERROR_REPOS $MSG_FINAL_ACCV_ERROR"
    386                 ERROR=1
    387                 echo "$ERROR check_install" > $ACCV_ERROR
    388                 exit 1
    389         fi
    390 }
    391 
    392 #############################################
    393 ##############MAIN PROGRAM####################
    394 #############################################
    395 
    396 #####################################################
    397 echo "#####################################################" >> $ACCV_LOG
    398 echo "Start smartcard installation at "`date` > $ACCV_LOG
    399 echo "#####################################################" >> $ACCV_LOG
    400 echo " " >> $ACCV_LOG
    401 ERROR=0
    402 echo "$ERROR inicializacion" > $ACCV_ERROR
    403 
    404 zenity --question --title="$MSG_TITLE" --text "<span foreground='blue' font='12'>$MSG_DRIVER_INFO</span>\n\n<span foreground='red' font='10'>$MSG_OK_DRIVER</span>\n\n<i>- Identive SCR3310v2</i>\n<i>- Identive Cloud 2700R</i>\n<i>- Omnikey Cardman 3021 y 3121</i>\n\n<span foreground='red' font='10'>$MSG_FAILED_DRIVER</span>\n\n<i>- Teclado Cherry G83-6644</i>" --ok-label="$MSG_OK_LABEL" --cancel-label="$MSG_CANCEL_LABEL"
    405 [ $? == '0' ] || exit 1
    406 USER_HOME=$(pwd)
    407 USER=$(who | awk '{print $1;}')
    408 
    409 touch /tmp/kk.txt
    410 #instalo paquetes necesarios de los repositorios segun la arquitectura.
    411 
    412 if ( (uname -a | grep -i "x86_64" > /dev/null) ); then
    413        
    414         #echo "Es 64 bits"
    415         zero-installer install libccid >> $ACCV_LOG
    416         check_install $? "libccid" >> $ACCV_LOG
    417         zero-installer install pcscd >> $ACCV_LOG
    418         check_install $? "pcscd" >> $ACCV_LOG
    419         zero-installer install libpcsclite1 >> $ACCV_LOG
    420         check_install $? "libpcsclite1" >> $ACCV_LOG
    421         zero-installer install libwxbase2.8-0 >> $ACCV_LOG
    422         check_install $? "libwxbase2.8-0" >> $ACCV_LOG
    423         zero-installer install libwxgtk2.8-0 >> $ACCV_LOG
    424         check_install $? "libwxgtk2.8-0" >> $ACCV_LOG
    425         zero-installer install safesignidentityclient >> $ACCV_LOG
    426         check_install $? "safesignidentityclient" >> $ACCV_LOG
    427 
    428 else
    429 
    430         #echo "Es 32 bits"
    431         zero-installer install libccid >> $ACCV_LOG
    432         check_install $? "libccid" >> $ACCV_LOG
    433         zero-installer install pcscd >> $ACCV_LOG
    434         check_install $? "pcscd" >> $ACCV_LOG
    435         zero-installer install libpcsclite1 >> $ACCV_LOG
    436         check_install $? "libpcsclite1" >> $ACCV_LOG
    437         zero-installer install libtiff4 >> $ACCV_LOG
    438         check_install $? "libtiff4" >> $ACCV_LOG
    439         zero-installer install libwxbase2.8 >> $ACCV_LOG
    440         check_install $? "libwxbase2.8" >> $ACCV_LOG
    441         zero-installer install libwxgtk2.8 >> $ACCV_LOG
    442         check_install $? "libwxgtk2.8-0" >> $ACCV_LOG
    443         zero-installer install safesignidentityclient >> $ACCV_LOG
    444         check_install $? "safesignidentityclient" >> $ACCV_LOG
    445 
    446 
    447 fi
    448 
    449 # Si falla la instalacion de algun paquete se habrá abortado la instalación
    450 (
    451 ## Get user home folder
    452 #######################
    453 user_home
    454 #echo "$USER_HOME"
    455 #Configuració SafeSign
    456 [ -d $USER_HOME/.safesign ] || su - $USER -c "mkdir ~/.safesign" >> $ACCV_LOG
    457 su - $USER -c "cp $ACCV_FILES/registry ~/.safesign" >>  $ACCV_LOG
    458 
    459 # Make link
    460 make_link
    461 #
    462 echo "# $MSG_ZENITY_ACCV_FIREFOX_1" ; sleep 1
    463 echo "20"
    464 echo "# $MSG_ZENITY_ACCV_FIREFOX_2" ; FF_MODULE_NAME="ACCV_GYD_PKCS_11"
    465 echo "40"
    466 echo "# $MSG_ZENITY_ACCV_FIREFOX_2"; FF_PATH="$USER_HOME/.mozilla/firefox"
    467 do_firefox
    468 echo "60"
    469 if [ $(rgrep 1 $ACCV_ERROR) ] ; then 
    470         zenity --error --title="$MSG_TITLE" --text="$MSG_FINAL_ERROR" 
    471         exit 1
    472 fi
    473 echo "# $MSG_ZENITY_ACCV_THUNDER_1";TH_MODULE_NAME="ACCV_GYD_PKCS_11"
    474 echo "80"
    475 echo "# $MSG_ZENITY_ACCV_THUNDER_1";TH_PATH="$USER_HOME/.thunderbird"
    476 do_thunderbird
    477 echo "100"
    478 ) |
    479 zenity --progress \
    480  --title="$MSG_TITLE" \
    481   --text="$MSG_INSTALLING_ACCV_PROGRESS" \
    482   --percentage=0 \
    483   --auto-close \
    484    --width=500 \
    485   --auto-kill
    486  
    487 #capturo el error a ver si todo fue bien o fallo algo
    488 ERROR=$(cat $ACCV_ERROR)
    489 
    490 if [ $(rgrep 1 $ACCV_ERROR) ] ; then 
    491         zenity --error --title="$MSG_TITLE" --text="$MSG_FINAL_ERROR"
    492         echo "" >> $ACCV_LOG
    493         echo "$MSG_FINAL_ERROR" >> $ACCV_LOG
    494         exit 1
    495   else
    496         zenity --info --title="$MSG_TITLE" --text="$MSG_FINAL_ACCV_OK"
    497         echo "" >> $ACCV_LOG
    498         echo "$MSG_FINAL_ACCV_OK" >> $ACCV_LOG
    499 fi
     3epi-gtk /usr/share/zero-lliurex-dni/accv.epi
    5004
    5015exit 0
  • zero-lliurex-dni/trunk/fuentes/zero-lliurex-dni.zlaunchers/zero-lliurex-dni.app

    r507 r7343  
    1111Comment[ca_ES]=Configura el mòdul del DNI-e al Firefox
    1212Icon=dnie
    13 Category=Software
     13Category=Support
    1414ScriptPath=zero-lliurex-dni.zmd
    1515Service=False
  • zero-lliurex-dni/trunk/fuentes/zero-lliurex-dni.zlaunchers/zero-lliurex-dni.zmd

    r5019 r7343  
    11#!/bin/bash
    22
    3 #set -x
    4 
    5 ## Global Variables
    6 ###################
    7 
    8 export TEXTDOMAIN="zero-lliurex-dni"
    9 
    10 USER_NAME=$USER # User name
    11 USER_HOME="" # Home user folder
    12 FF_PROFILE_PATH="" # Absolute path to user firefox profile
    13 TH_PROFILE_PATH="" # Absolute path to user firefox profile
    14 LIBRARY="/usr/lib/libpkcs11-dnie.so"
    15 OLD_LIBRARY="/usr/lib/opensc-pkcs11.so /usr/lib/libpkcs11-dnie.so"
    16 ERROR=0
    17 
    18 
    19 
    20 # MSGS
    21 MSG_LIBRARY_NOT_FOUND="$(gettext 'Library not found:')"
    22 MSG_SOME_PROBLEM_FIREFOX="$(gettext 'Some problem with firefox profile')"
    23 MSG_ONCE_FIREFOX="$(gettext 'Start firefox once at least')"
    24 MSG_SOME_PROBLEM_THUNDER="$(gettext 'Some problem with Thunderbird profile')"
    25 MSG_ONCE_THUNDER="$(gettext 'Start Thunderbird once at least')"
    26 MSG_RUNNING_FIREFOX="$(gettext 'Firefox is running. Stop it!')"
    27 MSG_RUNNING_THUNDER="$(gettext 'Thunderbird is running. Stop it!')"
    28 MSG_NOT_FIREFOX="$(gettext 'Firefox is not installed')"
    29 MSG_NOT_THUNDER="$(gettext 'Thunderbird is not installed')"
    30 MSG_INSTALLING_PROGRESS="$(gettext 'Installing DNIe in your computer...')"
    31 MSG_ZENITY_FIREFOX_1="$(gettext 'Installing DNIe modules in your system')"
    32 MSG_ZENITY_FIREFOX_2="$(gettext 'DNIe modules in Firefox')"
    33 MSG_ZENITY_THUNDER_1="$(gettext 'DNIe modules in Thunderbird')"
    34 MSG_FINAL_ERROR="$(gettext 'Impossible to install DNIe module, correct the problems and execute this program again please.')"
    35 MSG_FINAL_OK="$(gettext 'DNIe modules are installed with success in Firefox and Thunderbird profile, for others users you have to execute this action again on each session.')"
    36 MSG_CREATING_THUNDER="$(gettext 'We have to create your Thunderbird profile, now it will be launched, then please close Thunderbird and installation continues')"
    37 
    38 #instalo paquetes necesarios de los repositorios
    39 
    40 zero-installer install libpkcs11-dnie
    41 # Si falla la instalacion del paquete se aborat el resto y da error
    42 if [ $? != 0 ] ; then
    43   zenity --error --text="Impossible to install libpkcs11-dnie problems with repos. $MSG_FINAL_ERROR"
    44   exit 1
    45 fi
    46 
    47 
    48 #inicializo variable de error en un archivo de tmp ya que se produce una subshell en el zenity
    49 
    50 echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    51 
    52 user_home(){
    53    
    54   USER_HOME=$(getent passwd "$USER_NAME" | cut -d: -f 6)
    55 
    56 }
    57 
    58 test_libpkcs11_dnie(){
    59 
    60   if [ ! -f $LIBRARY ]; then
    61     zenity --info --text="$MSG_LIBRARY_NOT_FOUND $LIBRARY"
    62     exit 1
    63     ERROR=1
    64     echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    65   fi
    66 
    67 }
    68 
    69 
    70 init_secmod_firefox(){
    71 
    72   if [ -f "$FF_PROFILE_PATH/secmod.db" ]; then
    73     rm $FF_PROFILE_PATH/secmod.db
    74   fi
    75 
    76 }
    77 
    78 
    79 init_secmod_thunderbird(){
    80 
    81   if [ -f "$TH_PROFILE_PATH/secmod.db" ]; then
    82     rm $TH_PROFILE_PATH/secmod.db
    83   fi
    84 
    85 }
    86 
    87 test_running_firefox(){
    88 
    89   is_running=$(ps -fe | grep /usr/lib/firefox/firefox | grep -v grep | wc -l)
    90   if [ $is_running -gt 0 ]; then
    91     return 1
    92   else
    93     return 0
    94   fi
    95 
    96 }
    97 
    98 test_running_thunderbird(){
    99 
    100   is_running=$(ps -fe | grep thunderbird | grep -v grep | wc -l)
    101   if [ $is_running -gt 0 ]; then
    102     while [ $is_running -gt 0 ] ; do
    103       zenity --info --text="$MSG_RUNNING_THUNDER"
    104       is_running=$(ps -fe | grep thunderbird | grep -v grep | wc -l)
    105     done
    106   fi
    107   return 0
    108        
    109 }
    110 
    111 test_installed_package(){
    112 
    113   dpkg -s $1
    114   iRESULT=$?
    115   if [ $iRESULT -eq 1 ]; then
    116     return 0
    117   else
    118     return 1
    119   fi
    120 
    121 }
    122 
    123 ## Firefox functions
    124 ####################
    125 
    126 get_firefox_default_profile(){
    127    
    128    # Getting Mozilla products default profile
    129    # http://kb.mozillazine.org/Profiles.ini_file
    130    #
    131    # Get default profile info
    132    # This script must be capable of dealing with multiple profiles
    133    # and relative or absolute paths, for now ... buff!!
    134    #
    135    # This script get Default path profile if Default=1 or
    136    # get first profile in other case
    137  
    138   TMP_FILE=$(mktemp)
    139   cat $FF_PATH/profiles.ini | awk -F ' *= *' '{ if ($1 ~ /^\[/) section=$1; else if ($1 !~ /^$/) print $1 section "=" "\"" $2 "\"" }' > $TMP_FILE
    140   DEFAULT_EXISTS=$(grep ^Default $TMP_FILE)
    141   if [ -n $DEFAULT_EXISTS ]; then
    142     PROFILE_ID=$(cat $TMP_FILE | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    143   else
    144     PROFILE_ID=$(echo $DEFAULT_EXISTS | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    145   fi
    146   IS_RELATIVE=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^IsRelative | cut -d"=" -f 2 | sed -e 's/\"//g')
    147   TMP_PATH=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^Path | cut -d"=" -f 2 | sed -e 's/\"//g')
    148   if [ $IS_RELATIVE = "0" ]; then
    149     FF_PROFILE_PATH=$TMP_PATH
    150   else
    151     FF_PROFILE_PATH=$FF_PATH/$TMP_PATH
    152   fi
    153   rm -f $TMP_FILE
    154 
    155 }
    156 
    157 get_thunderbird_default_profile(){
    158    
    159    # Getting Mozilla products default profile
    160    # http://kb.mozillazine.org/Profiles.ini_file
    161    #
    162    # Get default profile info
    163    # This script must be capable of dealing with multiple profiles
    164    # and relative or absolute paths, for now ... buff!!
    165    #
    166    # This script get Default path profile if Default=1 or
    167    # get first profile in other case
    168  
    169   TMP_FILE=$(mktemp)
    170   cat $TH_PATH/profiles.ini | awk -F ' *= *' '{ if ($1 ~ /^\[/) section=$1; else if ($1 !~ /^$/) print $1 section "=" "\"" $2 "\"" }' > $TMP_FILE
    171   DEFAULT_EXISTS=$(grep ^Default $TMP_FILE)
    172   if [ -n $DEFAULT_EXISTS ]; then
    173     PROFILE_ID=$(cat $TMP_FILE | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    174   else
    175     PROFILE_ID=$(echo $DEFAULT_EXISTS | grep -m 1 Profile[0-9] | cut -d"[" -f 2 | cut -d"]" -f 1 )
    176   fi
    177   IS_RELATIVE=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^IsRelative | cut -d"=" -f 2 | sed -e 's/\"//g')
    178   TMP_PATH=$(cat $TMP_FILE | grep $PROFILE_ID | grep ^Path | cut -d"=" -f 2 | sed -e 's/\"//g')
    179   if [ $IS_RELATIVE = "0" ]; then
    180     TH_PROFILE_PATH=$TMP_PATH
    181   else
    182     TH_PROFILE_PATH=$TH_PATH/$TMP_PATH
    183   fi
    184   rm -f $TMP_FILE
    185 
    186 }
    187 
    188 test_firefox_user_profile() {
    189 
    190   if [ -d $FF_PATH ]; then
    191     get_firefox_default_profile
    192     if [ ! -d $FF_PROFILE_PATH ]; then
    193       zenity --info --text="$MSG_SOME_PROBLEM_FIREFOX"
    194       ERROR=1
    195       echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    196       return 0
    197     fi
    198     return 1
    199   else
    200     zenity --info --text="$MSG_ONCE_FIREFOX"
    201     ERROR=1
    202     echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    203     exit 3
    204   fi
    205        
    206 }
    207 
    208 test_thunderbird_user_profile() {
    209 
    210   if [ -d $TH_PATH ]; then
    211     get_thunderbird_default_profile
    212     if [ ! -d $TH_PROFILE_PATH ]; then
    213       zenity --info --text="$MSG_SOME_PROBLEM_THUNDER"
    214       ERROR=1
    215       echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    216       return 0
    217     fi
    218     return 1
    219   else
    220     zenity --info --text="$MSG_CREATING_THUNDER"
    221     su $USER -c "thunderbird"
    222     test_running_thunderbird
    223     get_thunderbird_default_profile
    224   fi
    225        
    226 }
    227 
    228 test_firefox_dni_module(){
    229 
    230   if [ -z $FF_MODULE_EXISTS ]; then
    231     return 1
    232   fi
    233   return 0
    234 
    235 }
    236 
    237 test_thunderbird_dni_module(){
    238 
    239   if [ -z $TH_MODULE_EXISTS ]; then
    240     return 1
    241   fi
    242   return 0
    243 
    244 }
    245 
    246 remove_dni_module_firefox(){
    247 
    248    su $USER -c "modutil -disable $FF_MODULE_NAME -force -dbdir $FF_PROFILE_PATH 2>&1"
    249    su $USER -c "modutil -delete $FF_MODULE_NAME -force -dbdir $FF_PROFILE_PATH 2>&1"
    250 }
    251 
    252 remove_dni_module_thunderbird(){
    253 
    254    su $USER -c "modutil -disable $TH_MODULE_NAME -force -dbdir $TH_PROFILE_PATH 2>&1"
    255    su $USER -c "modutil -delete $TH_MODULE_NAME -force -dbdir $TH_PROFILE_PATH 2>&1"
    256 }
    257 
    258 enable_dni_module_firefox(){
    259 
    260    su $USER -c "modutil -add $FF_MODULE_NAME -force -libfile $LIBRARY -dbdir $FF_PROFILE_PATH 2>&1"
    261    su $USER -c "modutil -enable $FF_MODULE_NAME -force -dbdir $FF_PROFILE_PATH 2>&1"
    262 }
    263 
    264 enable_dni_module_thunderbird(){
    265 
    266    su $USER -c "modutil -add $TH_MODULE_NAME -force -libfile $LIBRARY -dbdir $TH_PROFILE_PATH 2>&1"
    267    su $USER -c "modutil -enable $TH_MODULE_NAME -force -dbdir $TH_PROFILE_PATH 2>&1"
    268 }
    269 
    270 do_firefox(){
    271 
    272   test_installed_package "firefox"
    273   if [ $? ]; then
    274     test_running_firefox
    275     if [ $? -gt 0 ]; then
    276       ERROR=1
    277       echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    278       zenity --info --text="$MSG_RUNNING_FIREFOX"
    279       exit 2
    280     else
    281       test_firefox_user_profile
    282       test_ff_up=$?
    283       echo "--->"$test_ff_up"<---"
    284       if [ $? ]; then
    285         init_secmod_firefox
    286         remove_dni_module_firefox
    287         enable_dni_module_firefox
    288       fi
    289     fi
    290   else
    291     ERROR=1
    292     echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    293     zenity --info --text="$MSG_NOT_FIREFOX"
    294     exit 1
    295   fi
    296 
    297 }
    298 
    299 do_thunderbird(){
    300 
    301   test_installed_package "thunderbird"
    302   if [ $? ]; then
    303     test_running_thunderbird # and waits to close
    304     test_thunderbird_user_profile # and create if doesnt exist
    305     test_th_up=$?
    306     echo "--->"$test_th_up"<---"
    307     if [ $? ]; then
    308       init_secmod_thunderbird
    309       remove_dni_module_thunderbird
    310       enable_dni_module_thunderbird
    311     fi
    312   else
    313     zenity --info --text="$MSG_NOT_THUNDER"
    314     ERROR=1
    315     echo "$ERROR" > /tmp/zero-lliurex-dni.tmp
    316     exit 1
    317   fi
    318 }
    319 
    320 ## Get user home folder
    321 #######################
    322 
    323 
    324 ## Test if dni library exists
    325 #############################
    326 
    327 
    328 # firefox
    329 (
    330 test_libpkcs11_dnie
    331 user_home
    332 echo "# $MSG_ZENITY_FIREFOX_1" ; sleep 1
    333 echo "20"
    334 echo "# $MSG_ZENITY_FIREFOX_2" ; FF_MODULE_NAME="DNI_E"
    335 echo "40"
    336 echo "# $MSG_ZENITY_FIREFOX_2"; FF_PATH="$USER_HOME/.mozilla/firefox"
    337 do_firefox
    338 echo "60"
    339 echo "# $MSG_ZENITY_THUNDER_1";TH_MODULE_NAME="DNI_E"
    340 echo "80"
    341 echo "# $MSG_ZENITY_THUNDER_1";TH_PATH="$USER_HOME/.thunderbird"
    342 do_thunderbird
    343 echo "100"
    344 ) |
    345 zenity --progress \
    346   --title="ZERO-LLIUREX-DNIe" \
    347   --text="$MSG_INSTALLING_PROGRESS" \
    348   --percentage=0 \
    349   --auto-close \
    350    --width=500 \
    351   --auto-kill
    352  
    353 #capturo el error a ver si todo fue bien o fallo algo
    354 ERROR=$(cat /tmp/zero-lliurex-dni.tmp)
    355 
    356 if [ $ERROR != 0 ] ; then 
    357   zenity --error --text="$MSG_FINAL_ERROR" 
    358   exit 1
    359 else
    360   zenity --info --text="$MSG_FINAL_OK"
    361 fi
    362 exit 0
     3epi-gtk /usr/share/zero-lliurex-dni/dnie.epi
Note: See TracChangeset for help on using the changeset viewer.