#!/bin/sh
# This script mounts a user's confidential private folder, and ensures that
# the permissions on the underlying encrypted directories are
# private, and readable/writable/executable.
#
# Original by Michael Halcrow, IBM
# Extracted to a stand-alone script by Dustin Kirkland <kirkland@canonical.com>

PRIVATE_DIR="Private"
if [ -f "$HOME/.ecryptfs/auto-mount" -a -f "$HOME/.ecryptfs/$PRIVATE_DIR.sig" ]; then
	if ! egrep -qs "$HOME/[\.]{0,1}$PRIVATE_DIR " /proc/mounts; then
		chmod 500 "$HOME/$PRIVATE_DIR"
		chmod 700 "$HOME/.$PRIVATE_DIR"
		mount.ecryptfs_private
	fi
fi

ecryptfs-zombie-kill
