Skip to content

Instantly share code, notes, and snippets.

@wakita
Created April 12, 2013 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wakita/5370791 to your computer and use it in GitHub Desktop.
Save wakita/5370791 to your computer and use it in GitHub Desktop.
encfs を使って,暗号化フォルダを使用するために作ったシェルスクリプトです.暗号化して使いたい空のフォルダで "touch .encrypted" をしてから,"naisho" コマンドを実行すると暗号化フォルダを作成するとともに,復号された復号フォルダに移動します.復号フォルダでもう一度 "naisho" コマンドを実行すると,復号フォルダは消え,暗号化されたフォルダに移動します.
naisho() {
if [ -f .encrypted ]; then
encrypted=`pwd`
name=`basename $encrypted`
decrypted=$HOME/.volumes/$name
mounted=`mount | grep $decrypted`
if [ ! "$mounted" ]; then
mkdir -p $decrypted
encfs --standard -ovolname=$name $encrypted $decrypted
cd $decrypted
fi
elif [[ "$decrypted" != "" && `pwd` == $decrypted/* ]]; then
cd $encrypted
umount $decrypted
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment