- Convert pkg-install from csh to sh, since it's the default on ports

Reviewed by:	miwi
This commit is contained in:
Renato Botelho 2008-01-21 17:49:27 +00:00
parent d02e6124fd
commit 1a8f8ec40b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=205988
2 changed files with 67 additions and 98 deletions

View file

@ -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}

View file

@ -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
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
set path = ( /bin /sbin /usr/bin /usr/sbin )
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
UID=`id -u ${USER}`
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
addGroup() {
NGROUP=$1
NGID=$2
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
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
switch ($argv[2])
CHECKGID=`pw groupshow ${NGROUP} 2>/dev/null | cut -d: -f3`
if [ "${CHECKGID}" != "${NGID}" ]; then
echo "Group '$NGROUP' should have gid '$NGID'"
exit 1
fi
}
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);
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
set k = 1;
foreach group ($groups)
pw groupshow $group >& /dev/null;
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 ($status) then
pw groupadd $group -g $gids[$k];
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 ($status) then
echo "Failed to add group '$group' as gid '$gids[$k]'";
exit 1;
endif
endif
if [ "$2" = "PRE-INSTALL" ]; then
addGroup qmail 82
addGroup qnofiles 81
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
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
@ k++;
end
elif [ "$2" = "POST-INSTALL" ]; then
${PREFIX}/configure/install x
set k = 1;
foreach user ($users)
pw usershow $user >& /dev/null;
[ -e ${PREFIX}/control/me ] || (cd ${PREFIX}/configure && ./config)
if ($status) then
if ($user == "alias") then
set home = ${PKG_PREFIX}/alias;
else
set home = ${PKG_PREFIX};
endif
%%RCDLINK%%ln -s ${PREFIX}/rc %%LOCALBASE%%/etc/rc.d/qmail.sh
pw useradd $user -g $users_g[$k] -d $home -s /nonexistent -u $uids[$k];
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
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;
exit 0