From e18b89b0214c423d3a3c118190aab6549e461d7f Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Fri, 12 Sep 2008 04:50:30 -0400 Subject: [PATCH 1/1] initial attempts at user add scripts for FreeBSD packaging. --- packaging/freebsd/pkg-deinstall | 18 +++++ packaging/freebsd/pkg-install | 123 ++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100755 packaging/freebsd/pkg-deinstall create mode 100755 packaging/freebsd/pkg-install diff --git a/packaging/freebsd/pkg-deinstall b/packaging/freebsd/pkg-deinstall new file mode 100755 index 0000000..84217d5 --- /dev/null +++ b/packaging/freebsd/pkg-deinstall @@ -0,0 +1,18 @@ +#!/bin/sh + +# a package removal script for monkeysphere (borrowing from +# monkeysphere's debian/monkeysphere.postrm) + +# Author: Daniel Kahn Gillmor +# Copyright 2008 + +# FIXME: is /var/lib/monkeysphere the right place for this stuff on +# FreeBSD? +VARLIB="/var/lib/monkeysphere" + + +# FIXME: This needs to be filled in! Under what circumstances do we +# want to actually purge all of /var/lib/monkeysphere? + +# (note: FreeBSD does not seem to want the package-specific user to be +# purged at package removal) diff --git a/packaging/freebsd/pkg-install b/packaging/freebsd/pkg-install new file mode 100755 index 0000000..c2af960 --- /dev/null +++ b/packaging/freebsd/pkg-install @@ -0,0 +1,123 @@ +#!/bin/sh + +# an installation script for monkeysphere (borrowing liberally from +# Wnn6's port 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? +VARLIB="/var/lib/monkeysphere" + +check_pw() +{ + if which -s pw; then + : + else + cat < /dev/null` + gid_monkeysphere=`getent group monkeysphere | cut -f3 -d: 2> /dev/null` + if [ X"$id_monkeysphere" = X641 ] && [ X"$gid_monkeysphere" = X641 ];then + exit 0 + else + # add an account 'monkeysphere' to this system + echo "" + echo "You need an account 'monkeysphere' whose ID number is 641, with group 'monkeysphere' (GID 641)" + if yesno "Would you like to create it automatically?" y; then + # We need a command 'pw(8)' + check_pw + pw groupadd monkeysphere -g 641 || failure $? + pw useradd monkeysphere -u 641 -g 641 -h - -d "$VARLIB" \ + -s /bin/sh -c 'monkeysphere authentication user,,,' || failure $? + # FIXME: should we really be using a real shell? Convention + # (/usr/ports/UIDs) seems to indicate /nonexistent is + # preferred + else + echo "Please create it, and try again." + exit 1 + fi + fi + # FIXME: we should create $VARLIB and chown the relevant subdirs + # (see debian/monkeysphere.postinst) + + ;; +esac -- 2.25.1