aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorgarga <garga@FreeBSD.org>2008-01-22 01:49:27 +0800
committergarga <garga@FreeBSD.org>2008-01-22 01:49:27 +0800
commitb1fed2dcb565039a3ea4050943dca0cf93d04507 (patch)
tree6102d38c66d9f763d0463657a27cf3943eefa225 /mail
parent073db3f105b05bba01cfbe38aff428b1d8dbb854 (diff)
downloadfreebsd-ports-gnome-b1fed2dcb565039a3ea4050943dca0cf93d04507.tar.gz
freebsd-ports-gnome-b1fed2dcb565039a3ea4050943dca0cf93d04507.tar.zst
freebsd-ports-gnome-b1fed2dcb565039a3ea4050943dca0cf93d04507.zip
- Convert pkg-install from csh to sh, since it's the default on ports
Reviewed by: miwi
Diffstat (limited to 'mail')
-rw-r--r--mail/qmail/Makefile5
-rw-r--r--mail/qmail/files/pkg-install.in190
2 files changed, 82 insertions, 113 deletions
diff --git a/mail/qmail/Makefile b/mail/qmail/Makefile
index d3f6679d0bd3..6c2577ef45c3 100644
--- a/mail/qmail/Makefile
+++ b/mail/qmail/Makefile
@@ -250,7 +250,6 @@ PKGMESSAGE?= ${WRKDIR}/pkg-message-${PKGMESSAGE_SUFFIX}
SUB_FILES+= pkg-message
.endif
-CSH?= /bin/csh
WRKDIR_doc= ${WRKDIR}/doc
PORTDOCS= *
@@ -666,7 +665,7 @@ post-patch:
do-configure:
@${SED} -e 's,%%RCDLINK%%,${RCDLINK},g; s,%%LOCALBASE%%,${LOCALBASE},g' \
${FILESDIR}/pkg-install.in > ${WRKDIR}/pkg-install
- @${SETENV} PKG_PREFIX="${PREFIX}" ${CSH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ @${SETENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
@${ECHO_CMD} "${CC} ${CFLAGS}" > ${WRKSRC}/conf-cc
@${ECHO_CMD} ${PREFIX} > ${WRKSRC}/conf-qmail
.if defined(WITH_BIG_CONCURRENCY_PATCH) \
@@ -730,7 +729,7 @@ do-install:
.for script in ${SCRIPTS}
${INSTALL_SCRIPT} ${WRKDIR}/scripts/${script} ${PREFIX}/scripts
.endfor
- @${SETENV} PKG_PREFIX="${PREFIX}" ${CSH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+ @${SETENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
@${ECHO_CMD}
@${CAT} ${PKGMESSAGE}
@${ECHO_CMD}
diff --git a/mail/qmail/files/pkg-install.in b/mail/qmail/files/pkg-install.in
index bae0f277a8cd..5971cd5a0928 100644
--- a/mail/qmail/files/pkg-install.in
+++ b/mail/qmail/files/pkg-install.in
@@ -1,114 +1,84 @@
-#!/bin/csh -f
+#!/bin/sh
#
# $FreeBSD$
#
-# Author : Marcos Tischer Vallim
-# E-Mail : tischer@gmail.com
-# Date : Tue Mar 22 00:40:45 BRT 2005
-
-set path = ( /bin /sbin /usr/bin /usr/sbin )
-
-if ($uid != 0) then
- echo "It is necessary to add missing qmail users/groups at";
- echo "this stage. Please either add them manually or retry";
- echo "as root.";
- exit 1;
-endif
-
-if (! -x `which pw`) then
- echo "This system looks like a pre-2.2 version of FreeBSD. We see that it";
- echo "is missing the "pw" utility. We need this utility. Please get and";
- echo "install it, and try again. You can get the source from:";
- echo "";
- echo " ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz";
- echo "";
- echo "No pw";
- exit 1;
-endif
-
-switch ($argv[2])
-
-case "PRE-INSTALL":
- set groups = (qmail qnofiles);
- set gids = (82 81);
- set users = (alias qmaild qmaill qmailp qmailq qmailr qmails);
- set users_g = (qnofiles qnofiles qnofiles qnofiles qmail qmail qmail);
- set uids = (81 82 83 84 85 86 87);
-
-
- set k = 1;
- foreach group ($groups)
- pw groupshow $group >& /dev/null;
-
- if ($status) then
- pw groupadd $group -g $gids[$k];
-
- if ($status) then
- echo "Failed to add group '$group' as gid '$gids[$k]'";
- exit 1;
- endif
- endif
-
- set chkgid = (`pw groupshow $group | sed -e "s,:, ,g"`);
- if ($chkgid[3] != $gids[$k]) then
- echo "Group '$group' should have gid '$gids[$k]'";
- exit 1;
- endif
-
- @ k++;
- end
-
- set k = 1;
- foreach user ($users)
- pw usershow $user >& /dev/null;
-
- if ($status) then
- if ($user == "alias") then
- set home = ${PKG_PREFIX}/alias;
- else
- set home = ${PKG_PREFIX};
- endif
-
- pw useradd $user -g $users_g[$k] -d $home -s /nonexistent -u $uids[$k];
-
- if ($status) then
- echo "Failed to add user '$user' as uid '$uids[$k]'";
- exit 1;
- endif
- endif
-
- set chkuid = (`pw usershow $user | sed -e "s,:, ,g"`);
- if ($chkuid[3] != $uids[$k]) then
- echo "User '$user' should have uid '$uids[$k]'";
- exit 1;
- endif
-
- @ k++;
- end
-
- breaksw;
-
-case "POST-INSTALL":
- ${PKG_PREFIX}/configure/install x;
-
- if ( ! `filetest -e ${PKG_PREFIX}/control/me` ) then
- cd ${PKG_PREFIX}/configure && ./config;
- endif
-
- %%RCDLINK%%ln -s ${PKG_PREFIX}/rc %%LOCALBASE%%/etc/rc.d/qmail.sh;
-
- touch ${PKG_PREFIX}/alias/.qmail-{postmaster,root,mailer-daemon};
-
- if ($status) then
- echo "Failed to create files :";
- echo " ${PKG_PREFIX}/alias/.qmail-postmaster";
- echo " ${PKG_PREFIX}/alias/.qmail-root";
- echo " ${PKG_PREFIX}/alias/.qmail-mailer-daemon";
- exit 1;
- endif
-
- breaksw;
-endsw
-
-exit 0;
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+PREFIX=${PKG_PREFIX:-%%PREFIX%%}
+UID=`id -u ${USER}`
+
+addGroup() {
+ NGROUP=$1
+ NGID=$2
+
+ if ! pw groupshow ${NGROUP} >/dev/null 2>&1; then
+ if ! pw groupadd ${NGROUP} -g ${NGID} >/dev/null 2>&1; then
+ echo "Failed to add group '${NGROUP}' as gid '${NGID}'"
+ exit 1
+ fi
+ fi
+
+ CHECKGID=`pw groupshow ${NGROUP} 2>/dev/null | cut -d: -f3`
+ if [ "${CHECKGID}" != "${NGID}" ]; then
+ echo "Group '$NGROUP' should have gid '$NGID'"
+ exit 1
+ fi
+}
+
+addUser() {
+ NUSER=$1
+ NUID=$2
+ NGROUP=$3
+ NHOME=${4:-${PREFIX}}
+
+ if ! pw usershow ${NUSER} >/dev/null 2>&1; then
+ if ! pw useradd ${NUSER} -g ${NGROUP} -d ${NHOME} -s /nonexistent -u ${NUID} >/dev/null 2>&1; then
+ echo "Failed to add user '${NUSER}' as uid '${NUID}'"
+ exit 1
+ fi
+ fi
+
+ CHECKUID=`pw usershow ${NUSER} 2>/dev/null | cut -d: -f3`
+ if [ "${CHECKUID}" != "${NUID}" ]; then
+ echo "User '$NUSER' should have uid '$NUID'"
+ exit 1
+ fi
+}
+
+if [ "$UID" != "0" ]; then
+ echo "It is necessary to add missing qmail users/groups at"
+ echo "this stage. Please either add them manually or retry"
+ echo "as root."
+ exit 1
+fi
+
+if [ "$2" = "PRE-INSTALL" ]; then
+ addGroup qmail 82
+ addGroup qnofiles 81
+
+ addUser alias 81 qnofiles ${PREFIX}/alias
+ addUser qmaild 82 qnofiles
+ addUser qmaill 83 qnofiles
+ addUser qmailp 84 qnofiles
+ addUser qmailq 85 qmail
+ addUser qmailr 86 qmail
+ addUser qmails 87 qmail
+
+elif [ "$2" = "POST-INSTALL" ]; then
+ ${PREFIX}/configure/install x
+
+ [ -e ${PREFIX}/control/me ] || (cd ${PREFIX}/configure && ./config)
+
+ %%RCDLINK%%ln -s ${PREFIX}/rc %%LOCALBASE%%/etc/rc.d/qmail.sh
+
+ if ! touch ${PREFIX}/alias/.qmail-{postmaster,root,mailer-daemon}; then
+ echo "Failed to create files :"
+ echo " ${PREFIX}/alias/.qmail-postmaster"
+ echo " ${PREFIX}/alias/.qmail-root"
+ echo " ${PREFIX}/alias/.qmail-mailer-daemon"
+ exit 1
+ fi
+fi
+
+exit 0