mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
- Rewrite pkg-install using switch case for PRE-INSTALL and POST-INSTALL
parameters, and, use this parameters to call PKGINSTALL on Makefile. - Remove some redundant things from Makefile and use it only on pkg-install. - Move pkg-install to files/pkg-install.in because i'm using some %%MACROS%% on this. PR: ports/80911 Submitted by: maintainer
This commit is contained in:
parent
26aa6f026e
commit
0695fe3817
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=135452
3 changed files with 123 additions and 142 deletions
|
@ -197,8 +197,11 @@ PLIST_SUB+= TLS="@comment "
|
||||||
|
|
||||||
SUB_FILES+= pkg-message${PKGMESSAGE_SUFFIX} mailer.conf.sample \
|
SUB_FILES+= pkg-message${PKGMESSAGE_SUFFIX} mailer.conf.sample \
|
||||||
bootfiles.sed enable-qmail
|
bootfiles.sed enable-qmail
|
||||||
|
PKGINSTALL?= ${WRKDIR}/pkg-install
|
||||||
PKGMESSAGE?= ${WRKDIR}/pkg-message${PKGMESSAGE_SUFFIX}
|
PKGMESSAGE?= ${WRKDIR}/pkg-message${PKGMESSAGE_SUFFIX}
|
||||||
|
|
||||||
|
CSH?= /bin/csh
|
||||||
|
|
||||||
DOCFILES+= ${WRKSRC}/BLURB ${WRKSRC}/BLURB2 ${WRKSRC}/BLURB3 \
|
DOCFILES+= ${WRKSRC}/BLURB ${WRKSRC}/BLURB2 ${WRKSRC}/BLURB3 \
|
||||||
${WRKSRC}/BLURB4 ${WRKSRC}/INTERNALS ${WRKSRC}/SECURITY \
|
${WRKSRC}/BLURB4 ${WRKSRC}/INTERNALS ${WRKSRC}/SECURITY \
|
||||||
${WRKSRC}/THOUGHTS ${FILESDIR}/PORT_NOTES \
|
${WRKSRC}/THOUGHTS ${FILESDIR}/PORT_NOTES \
|
||||||
|
@ -304,8 +307,10 @@ WITH_BIG_CONCURRENCY_PATCH_CONCURRENCY_LIMIT?= 509
|
||||||
|
|
||||||
.if defined(WITH_RCDLINK)
|
.if defined(WITH_RCDLINK)
|
||||||
PLIST_SUB+= RCDLINK=""
|
PLIST_SUB+= RCDLINK=""
|
||||||
|
RCDLINK=
|
||||||
.else
|
.else
|
||||||
PLIST_SUB+= RCDLINK="@comment "
|
PLIST_SUB+= RCDLINK="@comment "
|
||||||
|
RCDLINK= \#
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
# Fill SELECTED_OPTIONS with options to write conf-spamcontrol
|
# Fill SELECTED_OPTIONS with options to write conf-spamcontrol
|
||||||
|
@ -448,12 +453,10 @@ post-patch:
|
||||||
/"doc"/d; /"boot","/d' \
|
/"doc"/d; /"boot","/d' \
|
||||||
${WRKSRC}/hier.c
|
${WRKSRC}/hier.c
|
||||||
|
|
||||||
# If you want to change the qmail users, they must be changed in both
|
|
||||||
# work/*/conf-users and pkg/INSTALL.
|
|
||||||
|
|
||||||
do-configure:
|
do-configure:
|
||||||
@# Create/Check the necessary groups/users
|
@${SED} -e 's,%%RCDLINK%%,${RCDLINK2},g; s,%%LOCALBASE%%,${LOCALBASE},g' \
|
||||||
@PKG_PREFIX=${PREFIX} ${PKGINSTALL}
|
${FILESDIR}/pkg-install.in > ${WRKDIR}/pkg-install
|
||||||
|
@${SETENV} PKG_PREFIX="${PREFIX}" ${CSH} ${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) \
|
||||||
|
@ -473,8 +476,6 @@ do-install:
|
||||||
${SED} -f ${WRKDIR}/bootfiles.sed ${FILESDIR}/$i > ${WRKDIR}/${i} ; \
|
${SED} -f ${WRKDIR}/bootfiles.sed ${FILESDIR}/$i > ${WRKDIR}/${i} ; \
|
||||||
fi
|
fi
|
||||||
.endfor
|
.endfor
|
||||||
@# Check again, just in case (ideally should error if not found)
|
|
||||||
@PKG_PREFIX=${PREFIX} ${PKGINSTALL}
|
|
||||||
@${MKDIR} ${DOCSDIR} ${PREFIX}/configure
|
@${MKDIR} ${DOCSDIR} ${PREFIX}/configure
|
||||||
@cd ${WRKSRC} ; ./install
|
@cd ${WRKSRC} ; ./install
|
||||||
${INSTALL_PROGRAM} ${CONFIGUREPROGS} ${PREFIX}/configure
|
${INSTALL_PROGRAM} ${CONFIGUREPROGS} ${PREFIX}/configure
|
||||||
|
@ -504,17 +505,7 @@ do-install:
|
||||||
@cd ${WRKSRC} && ${CAT} `${CAT} SYSDEPS` \
|
@cd ${WRKSRC} && ${CAT} `${CAT} SYSDEPS` \
|
||||||
> ${DOCSDIR}/SYSDEPS
|
> ${DOCSDIR}/SYSDEPS
|
||||||
.endif
|
.endif
|
||||||
.for i in root postmaster mailer-daemon
|
@${SETENV} PKG_PREFIX="${PREFIX}" ${CSH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||||
@${TOUCH} ${PREFIX}/alias/.qmail-${i}
|
|
||||||
.endfor
|
|
||||||
@# This is not part of qmail proper, hence the 2nd class citizenship
|
|
||||||
@if [ ! -e ${PREFIX}/control/me ]; then \
|
|
||||||
cd ${PREFIX}/configure ; ./config ; \
|
|
||||||
fi
|
|
||||||
.if !defined(WITHOUT_RCDLINK)
|
|
||||||
@${MKDIR} ${LOCALBASE}/etc/rc.d
|
|
||||||
@${LN} -sf ${PREFIX}/rc ${LOCALBASE}/etc/rc.d/qmail.sh
|
|
||||||
.endif
|
|
||||||
@${ECHO_CMD}
|
@${ECHO_CMD}
|
||||||
@${CAT} ${PKGMESSAGE}
|
@${CAT} ${PKGMESSAGE}
|
||||||
@${ECHO_CMD}
|
@${ECHO_CMD}
|
||||||
|
|
114
mail/qmail/files/pkg-install.in
Normal file
114
mail/qmail/files/pkg-install.in
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
#!/bin/csh -f
|
||||||
|
#
|
||||||
|
# $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;
|
|
@ -1,124 +0,0 @@
|
||||||
#!/bin/csh -f
|
|
||||||
#
|
|
||||||
# $FreeBSD$
|
|
||||||
#
|
|
||||||
|
|
||||||
# Author : Marcos Tischer Vallim
|
|
||||||
# E-Mail : tischer@gmail.com
|
|
||||||
# Date : Tue Mar 22 00:40:45 BRT 2005
|
|
||||||
|
|
||||||
# Variables
|
|
||||||
set pw = '/usr/sbin/pw';
|
|
||||||
set touch = '/usr/bin/touch';
|
|
||||||
set sed = '/usr/bin/sed';
|
|
||||||
set null = '/dev/null';
|
|
||||||
|
|
||||||
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 "$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
|
|
||||||
|
|
||||||
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 doguid = 0;
|
|
||||||
|
|
||||||
if ($#argv) then
|
|
||||||
if ($argv[1] == "POST-INSTALL") then
|
|
||||||
${PKG_PREFIX}/configure/install x;
|
|
||||||
if ( ! `filetest -e ${PKG_PREFIX}/control/me` ) then
|
|
||||||
cd ${PKG_PREFIX}/configure && ./config;
|
|
||||||
endif
|
|
||||||
|
|
||||||
$touch "${PKG_PREFIX}/alias/.{qmail-postmaster,qmail-root,qmail-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
|
|
||||||
|
|
||||||
exit 0;
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ($argv[1] == "PRE-INSTALL") then
|
|
||||||
set doguid = 1;
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (${?PACKAGE_BUILDING}) then
|
|
||||||
set doguid = 1;
|
|
||||||
endif
|
|
||||||
|
|
||||||
set k = 1;
|
|
||||||
foreach group ($groups)
|
|
||||||
$pw groupshow $group >& $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
|
|
||||||
|
|
||||||
if ($doguid) then
|
|
||||||
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
|
|
||||||
endif
|
|
||||||
|
|
||||||
@ k = $k + 1;
|
|
||||||
end
|
|
||||||
|
|
||||||
set k = 1;
|
|
||||||
foreach user ($users)
|
|
||||||
$pw usershow $user >& $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
|
|
||||||
|
|
||||||
if ($doguid) then
|
|
||||||
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
|
|
||||||
endif
|
|
||||||
|
|
||||||
@ k = $k + 1;
|
|
||||||
end
|
|
||||||
|
|
||||||
exit 0;
|
|
Loading…
Add table
Reference in a new issue