Fix bug in gpg.conf generation.
[monkeysphere.git] / debian / monkeysphere.postinst
1 #!/bin/sh -e
2
3 # postinst script for monkeysphere
4
5 # Author: Jameson Rollins <jrollins@fifthhorseman.net>
6 # (c) 2008
7
8 VARLIB="/var/lib/monkeysphere"
9
10 if ! getent passwd monkeysphere >/dev/null ; then
11     echo "adding monkeysphere user..."
12     adduser --quiet --system --no-create-home --group \
13         --home '/var/lib/monkeysphere' \
14         --shell '/bin/sh' \
15         --gecos 'monkeysphere authentication user,,,' \
16         monkeysphere
17 fi
18
19 # install host gnupg home directory
20 install --owner root --group monkeysphere --mode 750 -d "$VARLIB"/gnupg-host
21 # install host gpg.conf
22 cat <<EOF > "$VARLIB"/gnupg-host/gpg.conf
23 list-options show-uid-validity
24 EOF
25
26 # install authentication gnupg home directory
27 install --owner monkeysphere --group monkeysphere --mode 700 -d "$VARLIB"/gnupg-authentication
28 # install authentication gpg.conf
29 cat <<EOF > "$VARLIB"/gnupg-authentication/gpg.conf
30 list-options show-uid-validity
31 primary-keyring $VARLIB/gnupg-authentication/pubring.gpg
32 keyring $VARLIB/gnupg-host/pubring.gpg
33 EOF
34 chown monkeysphere:monkeysphere "$VARLIB"/gnupg-authentication/gpg.conf