Pages : 1
#1 Le 03/01/2008, à 21:15
- PLEG54
Zenity et Feisty...
Bonjour à toutes et tous !
Du temps que j'y pense, Bonne année !!!
Bon, voiçi le problème qui me préoccupe :
Je me suis confectionné il y a quelques temps un petit script utilisant zenity, qui me permet de monter, démonter & lister les volumes crypté avec truecrypt. Il suffit de faire un clic-droit sur le container crypté, et le script fait le reste, avec en prime quelques indications pratiques.
A ce moment, j'étais sous Dapper 6.06LTS, et cela fonctionnait très bien (voir les copies d'écran en annexe...)
http://leguen.philippe.free.fr/download … t_menu.png
http://leguen.philippe.free.fr/download … t_list.png
http://leguen.philippe.free.fr/download … l-list.png
Aujourd'hui, j'ai migré vers Feisty 7.04, et depuis, le script ne fonctionne plus. Il accepte bien les différents paramètres que je lui donne, mais n'exécute plus les commandes !
Il n'affiche plus non plus l'icà´ne de truecrypt en haut à gauche des boà®tes de dialogue.
Je m'interroge... j'ai passé beaucoup de temps à essayer de le faire fonctionner à nouveau, mais sans résultat.
J'ai bien sûr scruté les forums, mais rien concernant ce problème précis.
#!/bin/sh (j'ai aussi essayé avec /bin/bash)
#
# Written by Philippe LE GUEN
#
# Encoding UTF-8
#
#
#
# Ver 1.0 Date Sun Apr 29 12:27:05 2007
# Dependency : Zenity ;-)
#
# L'idée de ce script m'est venue du fait qu'il y existe 2 cas possibles pour lequel un script de
# montage/démontage est pratique :
# 1) soit en lançant directement le script, et en y renseignant les différents paramètres,
# comme par exemple :
# file or device path = /home/roger/coffre
# 2) soit en cliquant droit sur le fichier ou device à monter
#
# Set some script variables
gui=`which zenity`
the_file=$1
if [ "$?" = 0 ]; then
if [ "$NAUTILUS_SCRIPT_CURRENT_URI" == "x-nautilus-desktop:///" ]; then
files_path=`$HOME"/Desktop"`
else
files_path=`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed -e 's/^file:\/\///; s/%20/\ /g'`
fi
else
FILE=`$gui --title "zenity Choisissez un Fichier / Device..." --file-selection `
if test -z $FILE
then
exit;
fi
fi
# Déclaration des variables
title="Truecrypt.sh v1.0"
icon="/usr/share/pixmaps/truecrypt.png"
mount_vol=`sudo truecrypt -l | grep "$the_file" | cut -f2 -d " "`
load_vol_ok="montage du volume effectué avec succès"
unload_vol_ok="démontage du volume effectué avec succès"
#
# Déclaration des fonctions
mounting() {
$gui --title "$title" --window-icon="$icon" --question --text " * montage du volume $the_file..." --width 200 --height 25
num_container=`$gui --title "$title" --window-icon="$icon" --entry --text "N° du container /media/TCvol[0-9] à monter :" --width 200 --height 250`
if test -z $num_container; then
exit;
fi
# SUDOPROMPT=`$gui --title "$title" --window-icon="$icon" --entry --text "Mot de passe de sudo:" --hide-text --width 200 --height 25`
# if test -z $SUDOPROMPT
# then
# exit;
# fi
MDP=`$gui --title "$title" --window-icon="$icon" --entry --text "Mot de passe du container Truecrypt :" --hide-text --width 200 --height 25`
if test -z $MDP
then
exit;
fi
truecrypt -p "$MDP" -M "gid=0,uid=1000,umask=007" "$the_file" /media/TCvol"$num_container"
$gui --title "$title" --window-icon="$icon" --info --text "$load_vol_ok" --width 300 --height 25
# Enregistrement des points de montages dans un fichier, destiné à être relu quand on veut,
# par exemple lors de l'appel de la fonction volumes_list().
# Ce fichier est supprimé lors de l'appel de la fonction unload_all()
mount_point="$the_file ---> /media/TCvol$num_container"
echo "$mount_point" >> ~/.truecrypt/truecrypt_sh.conf
exit;
}
umounting() {
$gui --title "$title" --window-icon="$icon" --question --text " * démontage du volume $the_file..." --width 300 --height 25
sudo truecrypt -d $the_file
$gui --title "$title" --window-icon="$icon" --info --text "$unload_vol_ok" --width 200 --height 25
exit;
}
volumes_list() {
# déclaration des variables
truelist=`sudo truecrypt -l`
listdev=`ls /dev/mapper | grep truecrypt`
listmnt=`df -hl | grep TCvol`
#
if [ "$listdev" = "" ]; then
type_box="--error"
list_text=" * aucun volume disponible ... "
list_mnt=" "
width="200"
height="25"
else
type_box="--info"
list_text=" * liste des volumes cryptés disponibles ... "
title_mount=" * liste des points de montages ... "
list_mount=`cat < ~/.truecrypt_sh.conf`
list_mnt=" * liste des volumes montés ... "
list_mnt1=" Tail. Occ. Disp. %Occ. Monté sur"
width="400"
height="450"
fi
$gui --title "$title" --window-icon="$icon" "$type_box" --text "$list_text\n\n$truelist\n\n\n$title_mount\n\n$list_mount\n\n\n$list_mnt\n$list_mnt1\n\n$listmnt" --width="$width" --height="$height"
exit;
}
unload_all() {
#all_list=`sudo truecrypt -d`
request=$gui --title "$title" --window-icon="$icon" --question --text " * démontage de tous les volumes ?" --width 200 --height 25
if [ -z "$request" ]
then
sudo truecrypt -d
$gui --title "$title" --warning --text "tous les volumes sont démontes !" --width 200 --height 25
else
$gui --title "$title" --warning --text "abandon..." --width 200 --height 25
fi
rm ~/.truecrypt_sh.conf
exit;
}
change_passwd() {
all_list=`sudo truecrypt -C`
$gui --title "$title" --window-icon="$icon" --info --text " * démontage de tous les volumes ..." --text="$all_list" --width 200 --height 25
exit;
}
# Sélection du mode de fonctionnement du script
select_choice=`$gui --title "$title" --window-icon="$icon" --list --radiolist --column "" --column "Choisissez votre fonction :" \
FALSE Monter\ un\ volume FALSE Démonter\ un\ volume FALSE Lister\ les\ volumes FALSE Démonter\ tous\ les\ volumes --width 200 --height 250`
cancel_select=$?
if [ "$select_choice" = "Monter un volume" ]; then
mounting
fi
if [ "$select_choice" = "Démonter un volume" ]; then
umounting
fi
if [ "$select_choice" = "Lister les volumes" ]; then
volumes_list
fi
if [ "$select_choice" = "Démonter tous les volumes" ]; then
unload_all
fi
#if [ "$select_choice" = "Modifier un password" ]; then
# change_passwd
#fi
exit
C'est un script sans prétentions, mais qui me facilite bien la vie...;)
J'ai vérifié les droits des répertoires & fichiers, tout semble correct...
Quelqu'un a-t'il déjà rencontré un problème similaire ?
Je vous remercie par avance de bien vouloir vous pencher sur mon problème...
Cordialement, PLEG54
SONY VAIO SVE1711X1EB : Intel Core i7-3612QM CPU @ 2.10GHz + RAM 8Go DDR2 + SSD Samsung EVO 850 250Go + HDD 750Go + NAS SYNOLOGY DS212J + Onduleur APC Back-Up ES 700G + Ubuntu 16.04 LTS
Hors ligne
Pages : 1