#!/bin/bash
#
# [Type]
# post_mount_command
#
# [Description]
# This script creates a Firefox session inside the stash

# Some distributions need this, e.g. openSUSE
cp "$HOME/.Xauthority" "$MOUNT_DIR" 2>/dev/null >/dev/null

export HOME="$MOUNT_DIR"
for i in "firefox" "firefox-trunk"; do
	if which $i >/dev/null; then
		$i -no-remote
		ret=$?
		break;
	fi
done

# Only unmount if Firefox exited normally
if [ "$ret" -eq "0" ]; then
	gnome-encfs-manager unmount "$MOUNT_DIR"
fi
