3 # an installation script for monkeysphere (borrowing liberally from
4 # Wnn6's port and from monkeysphere's debian/monkeysphere.postinst)
6 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
9 # FIXME: is /var/lib/monkeysphere the right place for this stuff on
11 VARLIB="/var/lib/monkeysphere"
20 This system looks like a pre-2.2 version of FreeBSD. We see that it
21 is missing the "pw" utility. We need this utility. Please get and
22 install it, and try again. You can get the source from:
24 ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz
32 local question default answer
36 if [ -z "${PACKAGE_BUILDING}" ]; then
37 read -p "${question} (y/n) [${default}]? " answer
39 if [ x${answer} = x ]; then
46 local dflt question answer
51 answer=$(ask "${question}" "${dflt}")
56 echo "Please answer yes or no."
61 local retval badgroups badusers
63 badgroups=`getent group monkeysphere 641`
64 badusers=`getent passwd monkeysphere 641`
66 if [ X"$badgroups" != X ]; then
73 if [ X"$badusers" != X ]; then
74 badusers="Conflicting user(s):
81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
82 This port or package assumes that the ID number of 'monkeysphere' will
83 be 641. But this system has:
87 Please correct these conflict(s) and try again.
88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96 # make sure that the correct user and group are present:
97 id_monkeysphere=`id -u monkeysphere 2> /dev/null`
98 gid_monkeysphere=`getent group monkeysphere | cut -f3 -d: 2> /dev/null`
99 if [ X"$id_monkeysphere" = X641 ] && [ X"$gid_monkeysphere" = X641 ];then
102 # add an account 'monkeysphere' to this system
104 echo "You need an account 'monkeysphere' whose ID number is 641, with group 'monkeysphere' (GID 641)"
105 if yesno "Would you like to create it automatically?" y; then
106 # We need a command 'pw(8)'
108 pw groupadd monkeysphere -g 641 || failure $?
109 pw useradd monkeysphere -u 641 -g 641 -h - -d "$VARLIB" \
110 -s /bin/sh -c 'monkeysphere authentication user,,,' || failure $?
111 # FIXME: should we really be using a real shell? Convention
112 # (/usr/ports/UIDs) seems to indicate /nonexistent is
115 echo "Please create it, and try again."
119 # FIXME: we should create $VARLIB and chown the relevant subdirs
120 # (see debian/monkeysphere.postinst)