diff --git a/qmail.spec b/qmail.spec index 93cbfd2..75e521a 100644 --- a/qmail.spec +++ b/qmail.spec @@ -410,76 +410,12 @@ user_check qmailq $qmailq $qmail /var/qmail /bin/false user_check qmailr $qmailr $qmail /var/qmail /bin/false user_check qmails $qmails $qmail /var/qmail /bin/false -%pre -n mini-qmail -# Prior to installing the package, ensure that the qmail users and groups -# exist and have the correct uid and gid information. This ensures that -# uid and gid values match the values which are compiled into the binaries - -# GIDs -nofiles=400 -qmail=401 - -# UIDs -alias=400 -qmaild=401 -qmaill=402 -qmailp=403 -qmailq=404 -qmailr=405 -qmails=406 - -group_check() -{ - if grep "^$1:" /etc/group > /dev/null 2>&1 - then - if [ $(grep "^$1:" /etc/group | /usr/bin/cut -d: -f3) != $2 ] - then - /usr/sbin/groupdel $1 - /usr/sbin/groupadd -g $2 $1 - fi - else - /usr/sbin/groupadd -g $2 $1 - fi -} - -group_check nofiles $nofiles -group_check qmail $qmail - -user_check() -{ - if grep "^$1:" /etc/passwd > /dev/null 2>&1 - then - if [ $(grep "^$1:" /etc/passwd | /usr/bin/cut -d: -f3,4) != "$2:$3" ] - then - /usr/sbin/userdel $1 - /usr/sbin/useradd -u $2 -M -g $3 -d $4 -s $5 $1 - fi - else - /usr/sbin/useradd -u $2 -M -g $3 -d $4 -s $5 $1 - fi -} - -user_check alias $alias $nofiles /var/qmail/alias /bin/false -user_check qmaild $qmaild $nofiles /var/qmail /bin/false -user_check qmaill $qmaill $nofiles /var/qmail /bin/false -user_check qmailp $qmailp $nofiles /var/qmail /bin/false -user_check qmailq $qmailq $qmail /var/qmail /bin/false -user_check qmailr $qmailr $qmail /var/qmail /bin/false -user_check qmails $qmails $qmail /var/qmail /bin/false - - %post dd bs=1024 count=1 if=/dev/zero of=/var/qmail/queue/lock/tcpto &> /dev/null chown qmailr:qmail /var/qmail/queue/lock/tcpto &> /dev/null chmod 644 /var/qmail/queue/lock/tcpto &> /dev/null exit 0 -%post -n mini-qmail -dd bs=1024 count=1 if=/dev/zero of=/var/qmail/queue/lock/tcpto &> /dev/null -chown qmailr:qmail /var/qmail/queue/lock/tcpto &> /dev/null -chmod 644 /var/qmail/queue/lock/tcpto &> /dev/null -exit 0 - %clean rm -rf $RPM_BUILD_ROOT @@ -801,6 +737,70 @@ URL: http://cr.yp.to/qmail/mini.html %description -n mini-qmail A mini-qmail installation doesn't have a mail queue. Instead it gives each new message to a central server through QMQP +%pre -n mini-qmail +# Prior to installing the package, ensure that the qmail users and groups +# exist and have the correct uid and gid information. This ensures that +# uid and gid values match the values which are compiled into the binaries + +# GIDs +nofiles=400 +qmail=401 + +# UIDs +alias=400 +qmaild=401 +qmaill=402 +qmailp=403 +qmailq=404 +qmailr=405 +qmails=406 + +group_check() +{ + if grep "^$1:" /etc/group > /dev/null 2>&1 + then + if [ $(grep "^$1:" /etc/group | /usr/bin/cut -d: -f3) != $2 ] + then + /usr/sbin/groupdel $1 + /usr/sbin/groupadd -g $2 $1 + fi + else + /usr/sbin/groupadd -g $2 $1 + fi +} + +group_check nofiles $nofiles +group_check qmail $qmail + +user_check() +{ + if grep "^$1:" /etc/passwd > /dev/null 2>&1 + then + if [ $(grep "^$1:" /etc/passwd | /usr/bin/cut -d: -f3,4) != "$2:$3" ] + then + /usr/sbin/userdel $1 + /usr/sbin/useradd -u $2 -M -g $3 -d $4 -s $5 $1 + fi + else + /usr/sbin/useradd -u $2 -M -g $3 -d $4 -s $5 $1 + fi +} + +user_check alias $alias $nofiles /var/qmail/alias /bin/false +user_check qmaild $qmaild $nofiles /var/qmail /bin/false +user_check qmaill $qmaill $nofiles /var/qmail /bin/false +user_check qmailp $qmailp $nofiles /var/qmail /bin/false +user_check qmailq $qmailq $qmail /var/qmail /bin/false +user_check qmailr $qmailr $qmail /var/qmail /bin/false +user_check qmails $qmails $qmail /var/qmail /bin/false + +%post -n mini-qmail +dd bs=1024 count=1 if=/dev/zero of=/var/qmail/queue/lock/tcpto &> /dev/null +chown qmailr:qmail /var/qmail/queue/lock/tcpto &> /dev/null +chmod 644 /var/qmail/queue/lock/tcpto &> /dev/null +exit 0 + + %files -n mini-qmail %attr(755,root,qmail) %dir /var/qmail #%attr(2755,alias,qmail) %dir /var/qmail/alias