Last active
November 28, 2015 19:41
-
-
Save renaudcerrato/316c330c704067e54def to your computer and use it in GitHub Desktop.
GUI script for easy encfs mounting.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
ensure_installed() { | |
command -v $1 >/dev/null 2>&1 || { echo -e >&2 "$1 not found.\nTry: sudo apt-get install $1.\nAborting."; exit 1; } | |
} | |
CFGDIR=$HOME/.encfs | |
CFGFILE=.mountsettings | |
ensure_installed encfs | |
ensure_installed zenity | |
if [ -f $CFGDIR/$CFGFILE ]; then | |
. $CFGDIR/$CFGFILE | |
fi | |
SRCDIR=`zenity --file-selection --directory --title="Please select your encfs folder" --filename="$SRCDIR"` | |
if [ ! -f $SRCDIR/.encfs6.xml ]; then | |
zenity --question --title="EncFS" --text="The source folder doesn't seems to contains any EncFS filesystem. Do you really want to create an EncFS filesystem in $SRCDIR ?" | |
fi | |
DSTDIR=`zenity --file-selection --directory --title="Please choose your destination folder (mount point) " --filename="$DSTDIR"` | |
set +e | |
RESULT=`encfs -o nonempty "$SRCDIR" "$DSTDIR" --extpass="zenity --password --title='EncFS'"` | |
if [ $? -ne 0 ]; then | |
zenity --error --text="$RESULT" | |
else | |
notify-send "EncFS" "<b>$DSTDIR</b> mounted successfully." | |
mkdir -p $CFGDIR | |
echo "SRCDIR=$SRCDIR" > $CFGDIR/$CFGFILE | |
echo "DSTDIR=$DSTDIR" >> $CFGDIR/$CFGFILE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment