#!/bin/sh

WIKI=$1
USER=$2

if [ ! "$WIKI" ]; then
    echo "Please specify a Wiki directory." 1>&2
    exit 1
fi

if [ ! "$USER" ]; then
    echo "Please specify a Web username." 1>&2
    exit 1
fi

# Initialise and configure ACLs on the gpg "homedir".

if [ ! -e "$WIKI/gnupg" ]; then
    mkdir $WIKI/gnupg
fi

chmod go-rwx $WIKI/gnupg
setfacl -m u:$USER:rwx $WIKI/gnupg
setfacl -m m:rwx $WIKI/gnupg
setfacl -m d:u:$USER:rwx $WIKI/gnupg
setfacl -m d:m:rwx $WIKI/gnupg
setfacl -m m:rw $WIKI/gnupg/*
