mirror of
https://git.freebsd.org/ports.git
synced 2025-07-14 15:59:18 -04:00
114 lines
2.5 KiB
Tcsh
114 lines
2.5 KiB
Tcsh
#!/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;
|