Created
April 12, 2013 09:23
-
-
Save wakita/5370791 to your computer and use it in GitHub Desktop.
encfs を使って,暗号化フォルダを使用するために作ったシェルスクリプトです.暗号化して使いたい空のフォルダで "touch .encrypted" をしてから,"naisho" コマンドを実行すると暗号化フォルダを作成するとともに,復号された復号フォルダに移動します.復号フォルダでもう一度 "naisho" コマンドを実行すると,復号フォルダは消え,暗号化されたフォルダに移動します.
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
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