3 # an installation script for monkeysphere (borrowing liberally from
4 # postgresql and mysql pkg-install scripts, and from monkeysphere's
5 # debian/monkeysphere.postinst)
7 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
10 # FIXME: is /var/lib/monkeysphere the right place for this stuff on
13 # PostgreSQL puts its data in /usr/local/pgsql/data
15 # MySQL puts its data in /var/db/mysql
17 VARLIB="/var/monkeysphere"
25 SHELL=/usr/local/bin/bash
27 if pw group show "${GROUP}" 2>/dev/null; then
28 echo "You already have a group \"${GROUP}\", so I will use it."
30 if pw groupadd ${GROUP} -g ${GID}; then
31 echo "Added group \"${GROUP}\"."
33 echo "Adding group \"${GROUP}\" failed..."
38 if oldshell=`pw user show "${USER}" 2>/dev/null`; then
39 if [ x"$oldshell" != x"$SHELL" ]; then
40 echo "You already have a \"${USER}\" user, but its shell is '$oldshell'."
41 echo "This package requires that \"${USER}\"'s shell be '$SHELL'."
42 echo "You should fix this by hand and then re-install the package."
43 echo " hint: pw usermod '$USER' -s '$SHELL'"
46 echo "You already have a user \"${USER}\" with the proper shell, so I will use it."
48 if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
49 -d "$VARLIB" -s /usr/local/bin/bash -c "monkeysphere authentication user,,,"
51 echo "Added user \"${USER}\"."
53 echo "Adding user \"${USER}\" failed..."
58 ## set up the cache directories:
60 install -d -o root -g monkeysphere -m 750 "$VARLIB"/gnupg-host
61 cat <<EOF > "$VARLIB"/gnupg-host/gpg.conf
62 list-options show-uid-validity
65 install -d -o monkeysphere -g monkeysphere -m 700 "$VARLIB"/gnupg-authentication
66 # install authentication gpg.conf
67 cat <<EOF > "$VARLIB"/gnupg-authentication/gpg.conf
68 list-options show-uid-validity
69 primary-keyring $VARLIB/gnupg-authentication/pubring.gpg
70 keyring $VARLIB/gnupg-host/pubring.gpg
72 chown monkeysphere:monkeysphere "$VARLIB"/gnupg-authentication/gpg.conf
74 monkeysphere-server diagnostics