Skip to content

Instantly share code, notes, and snippets.

@wrzlbrmft
Last active June 17, 2016 14:11
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 wrzlbrmft/07a9b788e43cf7a1a14d5d5581d90c03 to your computer and use it in GitHub Desktop.
Save wrzlbrmft/07a9b788e43cf7a1a14d5d5581d90c03 to your computer and use it in GitHub Desktop.
Mounts and unmounts EncFS by taking folder name out of script's file name.
#!/usr/bin/env bash
# to be used as symlink, e.g. ./foobar-mount.sh -> ~/bin/_enc-mount.sh
# will mount encrypted dir ./.foobar to mount point ./foobar
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_FILE="$(basename "${BASH_SOURCE[0]}")"
SCRIPT_NAME="${SCRIPT_FILE%.*}"
ENC="${SCRIPT_NAME%-*}"
encfs "$SCRIPT_PATH/.$ENC" "$SCRIPT_PATH/$ENC"
#!/usr/bin/env bash
# to be used as symlink, e.g. ./foobar-umount.sh -> ~/bin/_enc-umount.sh
# will unmount encrypted dir ./.foobar from mount point ./foobar
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_FILE="$(basename "${BASH_SOURCE[0]}")"
SCRIPT_NAME="${SCRIPT_FILE%.*}"
ENC="${SCRIPT_NAME%-*}"
fusermount -u "$SCRIPT_PATH/$ENC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment