mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
- Convert pkg-install from csh to sh, since it's the default on ports
Reviewed by: miwi
This commit is contained in:
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
|
@ -250,7 +250,6 @@ PKGMESSAGE?= ${WRKDIR}/pkg-message-${PKGMESSAGE_SUFFIX}
|
||||||
SUB_FILES+= pkg-message
|
SUB_FILES+= pkg-message
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
CSH?= /bin/csh
|
|
||||||
WRKDIR_doc= ${WRKDIR}/doc
|
WRKDIR_doc= ${WRKDIR}/doc
|
||||||
|
|
||||||
PORTDOCS= *
|
PORTDOCS= *
|
||||||
|
@ -666,7 +665,7 @@ post-patch:
|
||||||
do-configure:
|
do-configure:
|
||||||
@${SED} -e 's,%%RCDLINK%%,${RCDLINK},g; s,%%LOCALBASE%%,${LOCALBASE},g' \
|
@${SED} -e 's,%%RCDLINK%%,${RCDLINK},g; s,%%LOCALBASE%%,${LOCALBASE},g' \
|
||||||
${FILESDIR}/pkg-install.in > ${WRKDIR}/pkg-install
|
${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} "${CC} ${CFLAGS}" > ${WRKSRC}/conf-cc
|
||||||
@${ECHO_CMD} ${PREFIX} > ${WRKSRC}/conf-qmail
|
@${ECHO_CMD} ${PREFIX} > ${WRKSRC}/conf-qmail
|
||||||
.if defined(WITH_BIG_CONCURRENCY_PATCH) \
|
.if defined(WITH_BIG_CONCURRENCY_PATCH) \
|
||||||
|
@ -730,7 +729,7 @@ do-install:
|
||||||
.for script in ${SCRIPTS}
|
.for script in ${SCRIPTS}
|
||||||
${INSTALL_SCRIPT} ${WRKDIR}/scripts/${script} ${PREFIX}/scripts
|
${INSTALL_SCRIPT} ${WRKDIR}/scripts/${script} ${PREFIX}/scripts
|
||||||
.endfor
|
.endfor
|
||||||
@${SETENV} PKG_PREFIX="${PREFIX}" ${CSH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
@${SETENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||||
@${ECHO_CMD}
|
@${ECHO_CMD}
|
||||||
@${CAT} ${PKGMESSAGE}
|
@${CAT} ${PKGMESSAGE}
|
||||||
@${ECHO_CMD}
|
@${ECHO_CMD}
|
||||||
|
|
|
@ -1,114 +1,84 @@
|
||||||
#!/bin/csh -f
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
#
|
#
|
||||||
|
|
||||||
# Author : Marcos Tischer Vallim
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||||
# E-Mail : tischer@gmail.com
|
|
||||||
# Date : Tue Mar 22 00:40:45 BRT 2005
|
|
||||||
|
|
||||||
set path = ( /bin /sbin /usr/bin /usr/sbin )
|
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
|
||||||
|
UID=`id -u ${USER}`
|
||||||
|
|
||||||
if ($uid != 0) then
|
addGroup() {
|
||||||
echo "It is necessary to add missing qmail users/groups at";
|
NGROUP=$1
|
||||||
echo "this stage. Please either add them manually or retry";
|
NGID=$2
|
||||||
echo "as root.";
|
|
||||||
exit 1;
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (! -x `which pw`) then
|
if ! pw groupshow ${NGROUP} >/dev/null 2>&1; then
|
||||||
echo "This system looks like a pre-2.2 version of FreeBSD. We see that it";
|
if ! pw groupadd ${NGROUP} -g ${NGID} >/dev/null 2>&1; then
|
||||||
echo "is missing the "pw" utility. We need this utility. Please get and";
|
echo "Failed to add group '${NGROUP}' as gid '${NGID}'"
|
||||||
echo "install it, and try again. You can get the source from:";
|
exit 1
|
||||||
echo "";
|
fi
|
||||||
echo " ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz";
|
fi
|
||||||
echo "";
|
|
||||||
echo "No pw";
|
|
||||||
exit 1;
|
|
||||||
endif
|
|
||||||
|
|
||||||
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":
|
addUser() {
|
||||||
set groups = (qmail qnofiles);
|
NUSER=$1
|
||||||
set gids = (82 81);
|
NUID=$2
|
||||||
set users = (alias qmaild qmaill qmailp qmailq qmailr qmails);
|
NGROUP=$3
|
||||||
set users_g = (qnofiles qnofiles qnofiles qnofiles qmail qmail qmail);
|
NHOME=${4:-${PREFIX}}
|
||||||
set uids = (81 82 83 84 85 86 87);
|
|
||||||
|
|
||||||
|
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;
|
CHECKUID=`pw usershow ${NUSER} 2>/dev/null | cut -d: -f3`
|
||||||
foreach group ($groups)
|
if [ "${CHECKUID}" != "${NUID}" ]; then
|
||||||
pw groupshow $group >& /dev/null;
|
echo "User '$NUSER' should have uid '$NUID'"
|
||||||
|
exit 1
|
||||||
if ($status) then
|
fi
|
||||||
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;
|
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
|
||||||
|
|
||||||
case "POST-INSTALL":
|
if [ "$2" = "PRE-INSTALL" ]; then
|
||||||
${PKG_PREFIX}/configure/install x;
|
addGroup qmail 82
|
||||||
|
addGroup qnofiles 81
|
||||||
|
|
||||||
if ( ! `filetest -e ${PKG_PREFIX}/control/me` ) then
|
addUser alias 81 qnofiles ${PREFIX}/alias
|
||||||
cd ${PKG_PREFIX}/configure && ./config;
|
addUser qmaild 82 qnofiles
|
||||||
endif
|
addUser qmaill 83 qnofiles
|
||||||
|
addUser qmailp 84 qnofiles
|
||||||
|
addUser qmailq 85 qmail
|
||||||
|
addUser qmailr 86 qmail
|
||||||
|
addUser qmails 87 qmail
|
||||||
|
|
||||||
%%RCDLINK%%ln -s ${PKG_PREFIX}/rc %%LOCALBASE%%/etc/rc.d/qmail.sh;
|
elif [ "$2" = "POST-INSTALL" ]; then
|
||||||
|
${PREFIX}/configure/install x
|
||||||
|
|
||||||
touch ${PKG_PREFIX}/alias/.qmail-{postmaster,root,mailer-daemon};
|
[ -e ${PREFIX}/control/me ] || (cd ${PREFIX}/configure && ./config)
|
||||||
|
|
||||||
if ($status) then
|
%%RCDLINK%%ln -s ${PREFIX}/rc %%LOCALBASE%%/etc/rc.d/qmail.sh
|
||||||
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;
|
if ! touch ${PREFIX}/alias/.qmail-{postmaster,root,mailer-daemon}; then
|
||||||
endsw
|
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;
|
exit 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue