Skip to content

Commit

Permalink
Add USERS/GROUPS support and remove PERL dependency
Browse files Browse the repository at this point in the history
Submitted By:	Baptiste Daroussin <bapt@FreeBSD.org>
PR:		ports/157206
  • Loading branch information
bdrewery committed Jun 23, 2012
1 parent 502b379 commit 0b3461e
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 124 deletions.
14 changes: 9 additions & 5 deletions Makefile
Expand Up @@ -29,7 +29,9 @@ CONFLICTS= vpopmail-devel-5.*

GNU_CONFIGURE= YES
USE_GMAKE= YES
USE_PERL5= YES

USERS= vpopmail
GROUPS= vchkpw

VCFGDIR?= ${WRKDIR}/vcfg
VCFGFILES?= inc_deps lib_deps tcp.smtp
Expand All @@ -39,7 +41,9 @@ CONFIGURE_ENV+= VCFGDIR="${VCFGDIR}" \
CONFIGURE_ARGS= --enable-qmaildir=${QMAIL_PREFIX} \
--enable-tcprules-prog=${LOCALBASE}/bin/tcprules \
--enable-tcpserver-file=${PREFIX}/vpopmail/etc/tcp.smtp \
--enable-non-root-build
--enable-non-root-build \
--enable-vpopuser=${USERS} \
--enable-vpopgroup=${GROUPS}

#
# User-configurable variables
Expand Down Expand Up @@ -92,8 +96,6 @@ CONFIGURE_ARGS= --enable-qmaildir=${QMAIL_PREFIX} \
# WITH_SQL_LOG_REMOVE_DELETED - remove log entries for deleted users/domains
# QMAIL_PREFIX - location of qmail directory
# PREFIX - installation area for vpopmail (see comment below)
# VCHKPW_GID - the group ID of the new vchkpw group (89)
# VPOPMAIL_UID - the user ID of the new vpopmail user (89)
#
# PostgreSQL database configuration options
#
Expand Down Expand Up @@ -365,7 +367,9 @@ DOCS= README README.activedirectory README.filelocking \
#

pre-configure:
@PKG_PREFIX=${PREFIX} ${PERL5} ${PKGINSTALL}
${AWK} -F: '/^${USERS}:/ { print $$3 }' ${UID_FILES} > ${WRKSRC}/vpopmail.uid
${AWK} -F: '/^${USERS}:/ { sub(/\/usr\/local/, "${PREFIX}", $$9); print $$9 }' ${UID_FILES} > ${WRKSRC}/vpopmail.dir
${AWK} -F: '/^${GROUPS}:/ { print $$3 }' ${GID_FILES} > ${WRKSRC}/vpopmail.gid
.if defined(WITH_PGSQL)
.if defined(WITH_PGSQL_DB)
${REINPLACE_CMD} -E -e "s/(#define DB.*)vpopmail(.*)/\1${WITH_PGSQL_DB}\2/" ${WRKSRC}/vpgsql.h
Expand Down
124 changes: 114 additions & 10 deletions files/patch-configure
Expand Up @@ -6,14 +6,17 @@ Description: Configure for the FreeBSD ports build system.
Pass the correct compiler and linker flags to the cdb build.
FreeBSD does not need -R $libdir (a.k.a. --rpath) - the MySQL client
library is added to ldconfig's search path in its own startup script.
No need to check for uid/gid.
Forwarded: not-needed
Author: Peter Pentchev <roam@FreeBSD.org>,
Alex Dupre <ale@FreeBSD.org>,
Renato Botelho <garga@FreeBSD.org>
Last-Update: 2010-09-13
Renato Botelho <garga@FreeBSD.org>,
Baptiste Daroussin <bapt@FreeBSD.org>

--- a/configure
+++ b/configure
Last-Update: 2012-06-23

--- configure.orig 2010-11-08 16:02:52.000000000 +0100
+++ configure 2011-05-20 12:21:34.314930656 +0200
@@ -1403,6 +1403,8 @@
--enable-onchange-script Enable onchange script. See README.onchange for more info.
--enable-spamassassin Enable spamassassin. See README.spamassassin for more info.
Expand All @@ -23,7 +26,108 @@ Last-Update: 2010-09-13
--enable-maildrop Enable maildrop. See README.maildrop for more info.
--enable-maildrop-prog=PATH Full path to maildrop program /usr/{local/}bin/maildrop.
--enable-domainquotas Enable non-system domain quotas. See README.quotas for more info.
@@ -5785,27 +5787,6 @@
@@ -5663,100 +5665,6 @@

fi

-
-
-cat >>confdefs.h <<_ACEOF
-#define VPOPGROUP "$vpopgroup"
-_ACEOF
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether password file entry for the vpopmail user exists" >&5
-$as_echo_n "checking whether password file entry for the vpopmail user exists... " >&6; }
-if test "$cross_compiling" = yes; then :
- as_fn_error "Could not compile and run even a trivial ANSI C program - check CC." "$LINENO" 5
-
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <stdio.h>
- #include <pwd.h>
- #include <stdlib.h>
-
- int main() {
- struct passwd *pw;
- char tmpbuf[100];
- FILE *f;
-
- unlink("vpopmail.dir");
- unlink("vpopmail.uid");
- unlink("vpopmail.gid");
-
- if ( (f=fopen("vpopusername","r+"))==NULL) {
- printf("No vpopmail user found.\n");
- printf("Please add the vchkpw group and\n");
- printf("vpopmail user. Then run configure again\n");
- return(-1);
- }
-
- fgets(tmpbuf,100,f);
- fclose(f);
- tmpbuf[strlen(tmpbuf)-1] = 0;
-
- if (( pw=getpwnam(tmpbuf)) != 0 ) {
- f=fopen("vpopmail.dir","a+");
- fprintf(f,"%s\n", pw->pw_dir);
- fclose(f);
-
- f=fopen("vpopmail.uid", "a+");
- fprintf(f,"%d\n", pw->pw_uid);
- fclose(f);
-
- f=fopen("vpopmail.gid", "a+");
- fprintf(f,"%d\n", pw->pw_gid);
- fclose(f);
- } else {
- printf("No vpopmail user found.\n");
- printf("Please add the vchkpw group and\n");
- printf("vpopmail user. Then run configure again\n");
- return(-1);
- }
- return(0);
- }
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- as_fn_error "Could not compile and run even a trivial ANSI C program - check CC." "$LINENO" 5
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-if test ! -f vpopmail.uid
-then
- as_fn_error "No vpopmail user." "$LINENO" 5
-fi
-
-if test ! -f vpopmail.gid
-then
- as_fn_error "No vpopmail group." "$LINENO" 5
-fi
-
-if test ! -f vpopmail.dir
-then
- as_fn_error "No vpopmail home directory" "$LINENO" 5
-fi
-
vpopmaildir=`cat vpopmail.dir`


@@ -5785,27 +5693,6 @@

#----------------------------------------------------------------------

Expand Down Expand Up @@ -51,7 +155,7 @@ Last-Update: 2010-09-13
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether roaming-users has been enabled" >&5
$as_echo_n "checking whether roaming-users has been enabled... " >&6; }
# Check whether --enable-roaming-users was given.
@@ -5888,28 +5869,11 @@
@@ -5888,28 +5775,11 @@
# Check whether --enable-tcpserver_file was given.
if test "${enable_tcpserver_file+set}" = set; then :
enableval=$enable_tcpserver_file; tcpserver_file="$enableval"
Expand Down Expand Up @@ -81,7 +185,7 @@ Last-Update: 2010-09-13
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }

@@ -6414,6 +6378,44 @@
@@ -6414,6 +6284,44 @@
#define SPAMC_PROG "$spamc_prog"
_ACEOF

Expand Down Expand Up @@ -126,7 +230,7 @@ Last-Update: 2010-09-13

;;
esac
@@ -6664,7 +6666,7 @@
@@ -6664,7 +6572,7 @@
as_fn_error "Unable to find your MySQL lib dir, specify --enable-libdir." "$LINENO" 5
fi

Expand All @@ -135,7 +239,7 @@ Last-Update: 2010-09-13

;;

@@ -6727,7 +6729,7 @@
@@ -6727,7 +6635,7 @@
#define USE_LDAP $USE_LDAP
_ACEOF

Expand All @@ -144,7 +248,7 @@ Last-Update: 2010-09-13

auth_inc="-I/usr/local/include"

@@ -9029,8 +9031,8 @@
@@ -9029,8 +8937,8 @@
;;
esac

Expand Down
109 changes: 0 additions & 109 deletions pkg-install

This file was deleted.

0 comments on commit 0b3461e

Please sign in to comment.