aboutsummaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorDavid W. Chapman Jr. <dwcjr@FreeBSD.org>2002-05-24 02:03:34 +0000
committerDavid W. Chapman Jr. <dwcjr@FreeBSD.org>2002-05-24 02:03:34 +0000
commitde268dd4d8680d3dcf87962df2f50b154ca5e690 (patch)
treefe14fb19d07dd7f675f8585c4637cea1861be7f0 /mail
parent8445fae9d3f4c245aedb00467ff2ee06b4649e79 (diff)
downloadports-de268dd4d8680d3dcf87962df2f50b154ca5e690.tar.gz
ports-de268dd4d8680d3dcf87962df2f50b154ca5e690.zip
Make this port add shell to cyrus user
PR: 38435 Submitted by: Scot W. Hetzel <hetzels@westbend.net>
Notes
Notes: svn path=/head/; revision=59842
Diffstat (limited to 'mail')
-rw-r--r--mail/cyrus/Makefile1
-rw-r--r--mail/cyrus/pkg-deinstall23
-rw-r--r--mail/cyrus/pkg-install60
3 files changed, 33 insertions, 51 deletions
diff --git a/mail/cyrus/Makefile b/mail/cyrus/Makefile
index 379a6ff825e8..61e0cbdd2fc8 100644
--- a/mail/cyrus/Makefile
+++ b/mail/cyrus/Makefile
@@ -39,7 +39,6 @@ post-configure:
pre-install:
@ ${CP} ${WRKSRC}/man/quota.8 ${WRKSRC}/man/cyrquota.8
- @${PKGINSTALL} ${PKGNAME} PRE-INSTALL
DOCS= README acl-extension anoncvs bugs changes copyrights install \
mailing-list overview quota-extension server-design
diff --git a/mail/cyrus/pkg-deinstall b/mail/cyrus/pkg-deinstall
index db951d391314..73dcce32e5bc 100644
--- a/mail/cyrus/pkg-deinstall
+++ b/mail/cyrus/pkg-deinstall
@@ -35,6 +35,28 @@ cyrus_conf() {
fi
}
+#
+# Modify the 'cyrus' user created from the cyrus-sasl port
+#
+
+modify_cyrus_user() {
+ USER=cyrus
+ PW=/usr/sbin/pw
+ if [ -x /sbin/nologin ]; then
+ shell=/sbin/nologin
+ else
+ shell=/nonexistent
+ fi
+ uhome=/nonexistent
+
+ if ! ${PW} mod user ${USER} -d "${uhome}" -s "${shell}" \ ; then
+ e=$?
+ echo "*** Failed to update user \`${USER}'."
+ exit ${e}
+ fi
+ echo "*** Updated user \`${USER}'."
+}
+
case $2 in
DEINSTALL)
cd ${PKG_PREFIX}
@@ -42,6 +64,7 @@ case $2 in
checkfile ${PKG_PREFIX}/etc/imapd.conf
;;
POST-DEINSTALL)
+ modify_cyrus_user
;;
esac
diff --git a/mail/cyrus/pkg-install b/mail/cyrus/pkg-install
index 8f935faef8de..160094d79206 100644
--- a/mail/cyrus/pkg-install
+++ b/mail/cyrus/pkg-install
@@ -7,61 +7,21 @@ PKG_BATCH=${BATCH:=NO}
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
#
-# create 'cyrus' user and group before installing
+# Modify the 'cyrus' user created from the cyrus-sasl port
#
-create() {
- if [ ! -x /usr/sbin/pw ]; then
- echo "*** Please add a user and a group named \`cyrus' before installing this package."
- exit 69
- fi
-
- if ! pw show group cyrus -q >/dev/null; then
- gid=60
- while pw show group -g ${gid} -q >/dev/null; do
- gid=`expr ${gid} + 1`
- done
- if ! pw add group cyrus -g ${gid}; then
- e=$?
- echo "*** Failed to add group \`cyrus'. Please add it manually."
- exit ${e}
- fi
- echo "*** Added group \`cyrus' (id ${gid})"
- else
- gid=`pw show group cyrus 2>/dev/null | cut -d: -f3`
- fi
+modify_cyrus_user() {
+ USER=cyrus
+ PW=/usr/sbin/pw
+ shell=/bin/csh
+ uhome=${PKG_PREFIX}/cyrus
- if [ -x /sbin/nologin ]; then
- shell=/sbin/nologin
- else
- shell=/nonexistent
- fi
- if ! pw show user cyrus -q >/dev/null; then
- uid=60
- while pw show user -u ${uid} -q >/dev/null; do
- uid=`expr ${uid} + 1`
- done
- if ! pw add user cyrus -u ${uid} -g ${gid} -d "/nonexistent" \
- -c "the cyrus mail server" -s "${shell}" -p "*" \
- ; then
- e=$?
- echo "*** Failed to add user \`cyrus'. Please add it manually."
- exit ${e}
- fi
- echo "*** Added user \`cyrus' (id ${uid})"
- else
- if ! pw mod user cyrus -g ${gid} -d "/nonexistent" \
- -c "the cyrus mail server" -s "${shell}" -p "*" \
- ; then
+ if ! ${PW} mod user ${USER} -d "${uhome}" -s "${shell}" \ ; then
e=$?
- echo "*** Failed to update user \`cyrus'."
+ echo "*** Failed to update user \`${USER}'."
exit ${e}
- fi
- echo "*** Updated user \`cyrus'."
- fi
- if ! pw group mod cyrus -m daemon; then
- echo "*** can't add user \`daemon' to group \`cyrus'"
fi
+ echo "*** Updated user \`${USER}'."
}
@@ -90,10 +50,10 @@ cyrus_conf() {
case $2 in
PRE-INSTALL)
- create
;;
POST-INSTALL)
+ modify_cyrus_user
cd ${PKG_PREFIX}
cyrus_conf
checkfile ${PKG_PREFIX}/etc/imapd.conf