#!/bin/sh # an installation script for monkeysphere (borrowing liberally from # postgresql and mysql pkg-install scripts, and from monkeysphere's # debian/monkeysphere.postinst) # Author: Daniel Kahn Gillmor # Copyright 2008 # FIXME: is /var/lib/monkeysphere the right place for this stuff on # FreeBSD? # PostgreSQL puts its data in /usr/local/pgsql/data # MySQL puts its data in /var/db/mysql VARLIB="/var/monkeysphere" case $2 in POST-INSTALL) USER=monkeysphere GROUP=${USER} UID=641 GID=${UID} if pw group show "${GROUP}" 2>/dev/null; then echo "You already have a group \"${GROUP}\", so I will use it." else if pw groupadd ${GROUP} -g ${GID}; then echo "Added group \"${GROUP}\"." else echo "Adding group \"${GROUP}\" failed..." exit 1 fi fi if pw user show "${USER}" 2>/dev/null; then echo "You already have a user \"${USER}\", so I will use it." else if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ -d "$VARLIB" -s /sbin/sh -c "monkeysphere authentication user,,," then echo "Added user \"${USER}\"." else echo "Adding user \"${USER}\" failed..." exit 1 fi fi ## set up the cache directories: install --owner root --group monkeysphere --mode 750 -d "$VARLIB"/gnupg-host cat < "$VARLIB"/gnupg-host/gpg.conf list-options show-uid-validity EOF install --owner monkeysphere --group monkeysphere --mode 700 -d "$VARLIB"/gnupg-authentication # install authentication gpg.conf cat < "$VARLIB"/gnupg-authentication/gpg.conf list-options show-uid-validity primary-keyring $VARLIB/gnupg-authentication/pubring.gpg keyring $VARLIB/gnupg-host/pubring.gpg EOF chown monkeysphere:monkeysphere "$VARLIB"/gnupg-authentication/gpg.conf ;; esac