#!/bin/bash # Licence: GNU # Author: michal@roxor.pl trueCryptDeb="truecrypt_4.3a-0_i386.deb" trueCryptVolume="michal.tcr" trueCryptMountPoint="TrueCrypt/Volume" mediaDir=$(echo $0|sed 's/autorun//') txtProgName="Bezpieczny Dysk TrueCrypt" txtNoTrueCrypt="TrueCrypt nie jest zainstalowany. Zignorować instalację na obcym sprzęcie?" txtEnterPassword="Wprowadź hasło do wolumenu TrueCrypt" passWord="" askPassword () { case "$1" in "kde") passWord=`kdialog --title "${txtProgName}" --password "${txtEnterPassword}"` ;; "gnome") passWord=`zenity --entry --text="${txtEnterPassword}" --hide-text` ;; "bash") echo -n "${txtProgName}";read passWord ;; esac } infoNoTrueCrypt () { case "$1" in "kde") installTC=`kdialog --title "${txtProgName}" --warningyesno "${txtNoTrueCrypt}";echo $?` ;; "gnome") installTC=`zenity --question --text="${txtNoTrueCrypt}";echo $?` ;; "bash") until [ "${installTC}" == "1" ] || [ "${installTC}" == 0 ] do echo -n "${txtNoTrueCrypt} [0 - tak, 1 - nie]";read installTC done ;; esac } installTrueCrypt () { case "$1" in "kde") gdebi-kde ${mediaDir}TrueCrypt/${trueCryptDeb} ;; "gnome") gdebi-gtk ${mediaDir}TrueCrypt/${trueCryptDeb} ;; "bash") sudo dpkg -i ${mediaDir}TrueCrypt/${trueCryptDeb} ;; esac } if [ "`pidof kwin`" != "" ]; then # KDE wm="kde" elif [ "`pidof gnome-settings-daemon`" != "" ]; then # Gnome wm="gnome" else # Shell wm="shell" fi if [ `which truecrypt 2>&1 >/dev/null;echo $?` -eq 1 ]; then infoNoTrueCrypt $wm if [ "${installTC}" == "1" ]; then installTrueCrypt $wm else exit fi if [ `which truecrypt 2>&1 >/dev/null;echo $?` -eq 1 ]; then exit fi fi if [ "`mount|grep "${mediaDir}${trueCryptMountPoint}"`" != "" ]; then truecrypt -d ${mediaDir}TrueCrypt/Volume else askPassword $wm if [ "${passWord}" != "" ]; then truecrypt ${mediaDir}${trueCryptVolume} ${mediaDir}${trueCryptMountPoint} --password=${passWord} fi fi