commit 11fd07811b55fd67f62546896dbcfe944f72c83d Author: Jay Larson Date: Sat Jun 2 14:05:50 2018 -0500 First check in diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a64a46b --- /dev/null +++ b/Makefile @@ -0,0 +1,137 @@ +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation here: +# (http://www.gnu.org/licenses/gpl-2.0.html) +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# Some, but not all of variables are required. The following list +# describes the required variables: +# +# * URL: The main website of the upstream project +# * REPO: The location of the package on the source pacakge +# server. This might be one of core, main, dev, or +# perhaps others. +# * BRIEF: Short description, should be 50 chars or less +# * SNAPVER: This is the package version. When a package is +# changed, but no changes are made to the source code +# this value should be increased. This would include +# things like usher being modified, changes to default +# configuration files, file permissions, etc. +# * ARCHIVE: The default commands that set this variable should +# work in most cases, but in some cases it may need +# to be modified. This variable should contain the +# path to the source of the package (./SRC/filename) +# * TYPE: This is probably not really needed due to the +# ability of gnu tar to figure it out on its own. +# Should probably be removed at some point. +# * SRCDIR: This is the name of the source directory after the +# package source is extracted. The default command +# should in most cases set this automatically. +# * PATCHDIR: This directory should be ./SRC/patches and is +# required, whether or not patches are used. +# * VERSION: This should be set automatically based on the +# version string in the source directory and SNAPVER. +# The default command here should work in many cases, +# but certain packages may need to use a different +# method. +# +# Variables that aren't required: +# +# * ARCH: This should be populated for packages which contain +# compiled binaries. If it is not populated the ARCH +# will be set to 'noarch'. +# * DEPENDS: If any other packages are required for this package +# to function then they need to be listed here, +# preferably in alphabetical order. +# * BUILDDEPS: Any package beyond packages from the core repo +# need to be listed here. The idea is that we +# can automate building and testing packages +# from clean core systems. The core repo is +# intended to include only the base minimum +# packages which provide a functional system. +# * SRCPKG: By default this is populated automatically with +# the name of the package (current directory). If +# the source package is used to generate multiple +# packages then this variable should contain the +# name of the git repo that tracks the source. +# * DESC: This is to be used to provide a longer description +# of the package. + +ARCH = x86_64 +DEPENDS = cyrus-sasl,dash,db,glibc,openldap,openssl,pcre +BUILDDEPS = +SRCPKG = +URL = http://www.postfix.org/ +REPO = main +BRIEF = The Postfix MTA +DESC = The Postfix MTA (Mail Transport Agent) was written as an alternative \ +to the widely-used Sendmail program +SNAPVER = 0 + +ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1) +TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n') +SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//') +PATCHDIR := $(PWD)/SRC/patches +VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')-$(SNAPVER) + +include /usr/share/snap/Makefile.snaplinux + +$(SRCDIR)/Makefile: $(ARCHIVE) + @if [ '$(TYPE)' == 'application/x-bzip2' ]; then \ + tar -jxf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-gzip' ]; then \ + tar -zxf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-tar' ]; then \ + tar -xf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-xz' ]; then \ + tar -xf $(ARCHIVE); \ + else \ + echo 'Unable to determine archive type'; \ + exit 1; \ + fi + @touch $(SRCDIR)/Makefile + +# binfile should be replaced with a file generated by the +# make process. It won't really break anything if not +# set to a valid file, but the source make process will +# be re-executed even if it isn't necessary + +$(SRCDIR)/bin/postfix: $(SRCDIR)/Makefile + @cd $(SRCDIR) && make CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \ + -I/usr/include/sasl -DHAS_LDAP -DUSE_TLS" AUXLIBS="-lsasl2 \ + -lldap -llber -lssl -lcrypto" makefiles && make + +$(ROOT): $(SRCDIR)/bin/postfix + @if [ -d $(ROOT) ]; then \ + touch $(ROOT); \ + else \ + mkdir -v $(ROOT); \ + fi + + @cd $(SRCDIR) && sh postfix-install -non-interactive \ + install_root=$(ROOT) \ + daemon_directory=/usr/lib/postfix \ + manpage_directory=/usr/share/man \ + html_directory=/usr/share/doc/postfix/html \ + readme_directory=/usr/share/doc/postfix/readme && \ + install -v -d -m 0755 $(ROOT)/etc/init.d && \ + install -v -d -m 0755 $(ROOT)/usr/share/postfix/etc && \ + install -v -m 0755 $(SNAPDIR)/postfix.init \ + $(ROOT)/etc/init.d/postfix && \ + mv -v $(ROOT)/etc/postfix/* $(ROOT)/usr/share/postfix/etc + +test: $(ROOT) + @cd $(SRCDIR); \ + make check + +clean: + @rm -rvf $(ROOT) \ + $(SNAPINFO) \ + $(MANIFEST) \ + $(FILES) \ + $(SRCDIR) + diff --git a/SNAP/README b/SNAP/README new file mode 100644 index 0000000..cb756b1 --- /dev/null +++ b/SNAP/README @@ -0,0 +1,5 @@ +This is the directory where the manifest, snapinfo, +and files.tar.gz files will be created. It is also +where the usher file should be placed if it is +required by the package. Any other files that need +to be included could also be placed here. diff --git a/SNAP/postfix.init b/SNAP/postfix.init new file mode 100755 index 0000000..4927f02 --- /dev/null +++ b/SNAP/postfix.init @@ -0,0 +1,52 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: postfix +# Required-Start: $syslog $local_fs $network +# Should-Start: $remote_fs openldap saslauthd +# Required-Stop: $network +# Should-Stop: $remote_fs openldap saslauthd +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Postfix MTA +# Description: Controls the Postfix Mail Transfer Agent +### END INIT INFO + +. /lib/lsb/init-functions + +BINFILE=/usr/lib/postfix/master +PIDFILE=/var/spool/postfix/pid/master.pid + +case "$1" in + start) + log_init_msg "Starting Postfix" + start_daemon -p "${PIDFILE}" /usr/sbin/postfix start 2> /dev/null && \ + log_success_msg || log_failure_msg + ;; + stop) + log_init_msg "Stopping Postfix" + killproc -p "${PIDFILE}" ${BINFILE} && log_success_msg || log_failure_msg + ;; + reload) + log_init_msg "Reloading Postfix" + killproc -p "${PIDFILE}" ${BINFILE} -HUP && log_success_msg || \ + log_failure_msg + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + status) + pid=$(pidofproc -p "$PIDFILE" "$BINFILE"); + + if [ "$?" -ne 0 ]; then + echo "postfix is not runing" + else + echo "postfix running with PID: $pid" + fi + ;; + *) + echo "Usage: $0 {start|stop|reload|restart|status}" + exit 1 + ;; +esac diff --git a/SNAP/usher b/SNAP/usher new file mode 100755 index 0000000..adbddba --- /dev/null +++ b/SNAP/usher @@ -0,0 +1,41 @@ +#!/bin/sh + +set -e + +case $1 in + preinst) + exit 0 + ;; + postinst) + getent group postfix 2>&1 > /dev/null || groupadd -g 32 postfix + getent group postdrop 2>&1 > /dev/null || groupadd -g 33 postdrop + getent passwd postfix 2>&1 > /dev/null || useradd -c "Postfix Daemon" \ + -g postfix -d /dev/null -s /bin/false -u 32 postfix + + if [ ! -f /etc/aliases ]; then + printf "postmaster: root\nMAILER-DAEMON: root" > /etc/aliases + newaliases + fi + + for f in /usr/share/postfix/etc/*; do + if [ ! -f /etc/postfix/`basename $f` ]; then + cp -a $f /etc/postfix + fi + done + + chown -R postfix.postdrop /var/spool/postfix/* /var/lib/postfix + chown root.root /var/spool/postfix/pid + chgrp postdrop /usr/sbin/postqueue \ + /usr/sbin/postdrop \ + /var/spool/postfix/public \ + /var/spool/postfix/maildrop + chmod 2555 /usr/sbin/postqueue \ + /usr/sbin/postdrop + ;; + prerm) + exit 0 + ;; + postrm) + exit 0 + ;; +esac diff --git a/SRC/patches/README b/SRC/patches/README new file mode 100644 index 0000000..976577a --- /dev/null +++ b/SRC/patches/README @@ -0,0 +1,3 @@ +Place any patch files here and preface each with a +number indicating the order of execution. Patch +files are expected to use a .patch extension. diff --git a/SRC/postfix-3.3.1.tar.gz b/SRC/postfix-3.3.1.tar.gz new file mode 100644 index 0000000..1753972 Binary files /dev/null and b/SRC/postfix-3.3.1.tar.gz differ diff --git a/SRC/postfix-3.3.1.tar.gz.sig b/SRC/postfix-3.3.1.tar.gz.sig new file mode 100644 index 0000000..10e5d57 Binary files /dev/null and b/SRC/postfix-3.3.1.tar.gz.sig differ