Permalink
Browse files

Merge branch 'rpm'

Conflicts:
	.gitignore
  • Loading branch information...
2 parents 46171d0 + a1ef2d1 commit 38e4449d4d1c76b12fc43df08b2c28d1d98f2721 @abh abh committed Feb 13, 2010
View
@@ -2,9 +2,15 @@
/config/
/pm_to_blib
/blib/
-Makefile
+
+# only ignore top-level Makefile; we need the one in packaging/rpm!
+/Makefile
Makefile.[a-z]*
+# ignore file produced by rpm build process
+/packaging/rpm/qpsmtpd.spec
+packaging/rpm/build/
+
*~
*.bak
View
@@ -0,0 +1,152 @@
+# -- generic Makefile for building RPM-based packages out of source
+# code control systems (git, cvs, svn)
+
+SCM_TYPE := git
+SCM_PATH := ../../
+#CVSROOT := $(shell cat 2>/dev/null src/CVS/Root)
+#SVN_PATH := $(shell svn info ${SCM_PATH} 2>/dev/null | awk '/^URL:/{print $$2}')
+#SVN_REV := $(shell svn info ${SVN_PATH} 2>/dev/null | awk '/^Last Changed Rev:/{print $$4}')
+
+PACKAGE := $(shell cat PACKAGE)
+VERSION := $(shell cat VERSION)
+RELEASE := $(shell cat RELEASE)
+BASE_VER := ${VERSION}-${RELEASE}
+CURRENT_PACKAGE := $(PACKAGE)-$(BASE_VER)
+TARBALL := $(CURRENT_PACKAGE).tar
+
+DIRNAME := $(shell echo $${PWD})
+DIRBASE := $(shell basename $${PWD})
+
+
+.SUFFIXES:
+.PHONY: clean mrclean distclean prepclean all default
+.PHONY: rpm rpmdist buildrpm buildrpmdist
+.PHONY: buildtarball buildtargz
+.PHONY: builddir distdir prepbuildtarball
+.PHONY: cvs-export git-export svn-export test-export
+.PHONY: cvs-clean git-clean svn-clean test-clean
+.PHONY: update
+
+default: rpmdist
+
+# -- the "rpmdist" target will build out of the SCM, but will
+# use the user's default build settings (which in many cases
+# is exposed as an RPM repository)
+#
+#rpmdist: buildrpmdist distclean
+rpmdist: buildrpmdist
+
+buildrpmdist: buildtargz
+ @rpmbuild \
+ --define "_package ${PACKAGE}" \
+ --define "_version ${VERSION}" \
+ --define "_release ${RELEASE}" \
+ -ta ./build/$(TARBALL).gz
+
+# -- the "rpm" target will build out of the SCM, but will leave
+# the resulting package in the relative ./build/ directory
+#
+rpm: buildrpm $(SCM_TYPE)-clean
+
+buildrpm: buildtargz
+ @echo ${PACKAGE} ${VERSION} ${RELEASE}
+ @rpmbuild \
+ --define "_rpmdir ./build/" \
+ --define "_sourcedir ./build/" \
+ --define "_srcrpmdir ./build/" \
+ --define "_package ${PACKAGE}" \
+ --define "_version ${VERSION}" \
+ --define "_release ${RELEASE}" \
+ -ta ./build/$(TARBALL).gz
+
+buildtarball: prepbuildtarball
+ @tar \
+ --create \
+ --directory ./build/ \
+ --file ./build/$(TARBALL) \
+ ${CURRENT_PACKAGE}
+
+buildtargz: buildtarball
+ @gzip -c < ./build/$(TARBALL) > ./build/$(TARBALL).gz
+
+prepbuildtarball: $(SCM_TYPE)-export
+ ${MAKE} update \
+ && cp ${PACKAGE}.spec ./build/${CURRENT_PACKAGE} \
+ && cp files/* ./build/
+
+test-clean:
+ @cd .. \
+ && rm "$(CURRENT_PACKAGE)"
+
+test-export: builddir
+ @cd .. \
+ && ln -snvf $(DIRBASE) $(CURRENT_PACKAGE) \
+ && tar \
+ --create \
+ --dereference \
+ --to-stdout \
+ --exclude "*.git*" \
+ --exclude "*.svn*" \
+ --exclude "*/CVS/*" \
+ --exclude "$(CURRENT_PACKAGE)/build/*" \
+ $(CURRENT_PACKAGE) \
+ | tar \
+ --extract \
+ --directory $(CURRENT_PACKAGE)/build/ \
+ --file -
+
+git-export: builddir prepclean
+ (cd $(SCM_PATH) ; git archive --format=tar --prefix=$(CURRENT_PACKAGE)/ HEAD) \
+ | tar \
+ --extract \
+ --directory ./build/ \
+ --file -
+
+git-clean:
+ @:
+
+cvs-export: builddir prepclean
+ @cd ./build/ \
+ && echo CURRENT_PACKAGE: ${CURRENT_PACKAGE} \
+ && echo CVSROOT: ${CVSROOT} \
+ && CVSROOT=${CVSROOT} cvs export -r HEAD -d$(CURRENT_PACKAGE) ${PACKAGE}
+
+cvs-clean:
+ @:
+
+svn-export: builddir prepclean
+ @cd ./build/ \
+ && svn export $(SVN_PATH) $(CURRENT_PACKAGE)
+
+svn-clean:
+ @:
+
+builddir:
+ @mkdir -p ./build
+
+distdir:
+ @mkdir -p ./dist
+
+prepclean:
+ @rm -rf ./build/$(CURRENT_PACKAGE)*
+
+clean:
+ @rm -rf ./build/* ./dist/* 2>/dev/null || :
+
+mrclean: clean
+
+distclean: clean $(SCM_TYPE)-clean
+ @rmdir ./build/ ./dist/ 2>/dev/null || :
+
+# -- recursive Makefile calls (during build phase)
+#
+update: $(PACKAGE).spec VERSION RELEASE
+
+$(PACKAGE).spec: VERSION RELEASE $(PACKAGE).spec.in
+ @sed \
+ -e "s|@PACKAGE@|$(PACKAGE)|" \
+ -e "s|@VERSION@|$(VERSION)|" \
+ -e "s|@RELEASE@|$(RELEASE)|" \
+ < $(PACKAGE).spec.in > $@
+
+# -- end of Makefile
View
@@ -0,0 +1 @@
+qpsmtpd
View
@@ -0,0 +1 @@
+0.1
View
@@ -0,0 +1 @@
+0.82
@@ -0,0 +1,10 @@
+If you run qpsmtpd-apache on a box with SELinux enabled, you'll need to
+allow apache to listen to your SMTP port, typically port 25.
+
+The following command allows apache to listen on port 25:
+
+ semanage port -m -t http_port_t -p tcp 25
+
+Use the -d option to remove this permission:
+
+ semanage port -d -t http_port_t -p tcp 25
@@ -0,0 +1,3 @@
+#!/bin/sh
+export QPSMTPD_CONFIG=/etc/qpsmtpd
+exec /usr/bin/qpsmtpd 2> /dev/null
@@ -0,0 +1,122 @@
+#! /bin/bash
+#
+# qpsmtpd-forkserver Start/Stop the qpsmtpd forking server
+#
+# chkconfig: 2345 90 60
+# description: qpsmtpd is a flexible smtpd daemon written in Perl. \
+# Apart from the core SMTP features, all functionality is \
+# implemented in small "extension plugins" using the easy \
+# to use object oriented plugin API.
+# processname: qpsmtpd-forkserver
+# config: /etc/qpsmtpd
+# pidfile: /var/run/qpsmtpd-forkserver.pid
+
+
+# Source function library.
+. /etc/init.d/functions
+. /etc/sysconfig/qpsmtpd-forkserver
+
+RETVAL=0
+
+# See how we were called.
+
+prog="qpsmtpd-forkserver"
+
+start() {
+ # cleanup environment a bit.
+ unset PERL_UNICODE
+ unset LANG
+ unset LC_TIME
+ unset LC_ALL
+ unset BASH_ENV
+ unset ENV
+ unset CDPATH
+ unset IFS
+
+ echo -n $"Starting $prog: "
+ trap "" 1
+ daemon $prog --detach $QPSMTPD_OPTIONS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ killproc $prog
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
+ return $RETVAL
+}
+
+# functions status() uses pidof, which doesn't work with (?) scripts
+qpstatus() {
+ local base=${1##*/}
+ local pid
+
+ # Test syntax.
+ if [ "$#" = 0 ] ; then
+ echo $"Usage: status {program}"
+ return 1
+ fi
+
+ # Use "/var/run/*.pid" file for pid
+ if [ -f /var/run/${base}.pid ] ; then
+ read pid < /var/run/${base}.pid
+ if [ -n "$pid" ]; then
+ /bin/ps -p $pid >/dev/null
+ if [ $? -eq 0 ]; then
+ echo $"${base} (pid $pid) is running..."
+ return 0
+ else
+ echo $"${base} dead but pid file exists"
+ return 1
+ fi
+ fi
+ fi
+ # See if /var/lock/subsys/${base} exists
+ if [ -f /var/lock/subsys/${base} ]; then
+ echo $"${base} dead but subsys locked"
+ return 2
+ fi
+ echo $"${base} is stopped"
+ return 3
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ status)
+ qpstatus qpsmtpd-forkserver
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/$prog ] && restart || :
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
+ exit 1
+esac
+
+exit $?
@@ -0,0 +1,3 @@
+QPSMTPD_OPTIONS="-p 25 -l 127.0.0.1 --pid-file /var/run/qpsmtpd-forkserver.pid"
+export QPSMTPD_CONFIG=/etc/qpsmtpd
+export HOME=~smtpd
Oops, something went wrong.

0 comments on commit 38e4449

Please sign in to comment.