-PACKAGE=proxmox-mailgateway-api
-PKGVER=1.0
-PKGREL=1
+PACKAGE=pmg-api
+PKGVER=5.0
+PKGREL=21
+
+# this requires package pmg-doc-generator
+export NOVIEW=1
+include /usr/share/pmg-doc-generator/pmg-doc-generator.mk
+
DEB=${PACKAGE}_${PKGVER}-${PKGREL}_all.deb
REPOID=`./repoid.pl .git`
-SERVICES = pmgdaemon pmgproxy
-CLITOOLS = pmgdb pmgconfig
-CLISCRIPTS= pmg-smtp-filter pmgsh pmgpolicy
+SERVICES = pmgdaemon pmgproxy pmgtunnel pmgmirror
+CLITOOLS = pmgdb pmgconfig pmgperf pmgcm pmgqm pmgreport pmgversion pmgupgrade pmgsubscription pmgbackup
+CLISCRIPTS = pmg-smtp-filter pmgsh pmgpolicy pmgbanner
+CRONSCRIPTS = pmg-hourly pmg-daily
+
+CLI_CLASSES = $(addprefix PMG/CLI/, $(addsuffix .pm, ${CLITOOLS}))
+SERVICE_CLASSES = $(addprefix PMG/Service/, $(addsuffix .pm, ${SERVICES}))
+SERVICE_UNITS = $(addprefix debian/, $(addsuffix .service, ${SERVICES}))
+TIMER_UNITS = $(addprefix debian/, $(addsuffix .timer, ${CRONSCRIPTS} pmgspamreport pmgreport))
-CLI_CLASSES = $(addprefix, 'PMG/API2/', $(addsuffix '.pm', ${CLITOOLS}))
-CLI_BINARIES = $(addprefix, 'bin/', ${CLITOOLS} ${CLISCRIPTS})
+CLI_BINARIES = $(addprefix bin/, ${CLITOOLS} ${CLISCRIPTS} ${CRONSCRIPTS})
+CLI_MANS = $(addsuffix .1, ${CLITOOLS}) pmgsh.1
+
+
+SERVICE_MANS = $(addsuffix .8, ${SERVICES}) pmg-smtp-filter.8 pmgpolicy.8
+CONF_MANS= pmg.conf.5 cluster.conf.5
TEMPLATES = \
+ fetchmailrc.tt \
+ pmgreport.tt \
+ spamreport-verbose.tt \
+ spamreport-short.tt \
main.cf.in \
main.cf.in.demo \
master.cf.in \
postgresql.conf.in \
pg_hba.conf.in
-TEMPLATES_FILES = $(addprefix, 'templates/', ${TEMPLATES})
+TEMPLATES_FILES = $(addprefix templates/, ${TEMPLATES})
LIBSOURCES = \
PMG/pmgcfg.pm \
+ PMG/RESTEnvironment.pm \
PMG/Utils.pm \
+ PMG/HTMLMail.pm \
PMG/ModGroup.pm \
PMG/SMTPPrinter.pm \
- PMG/NoVncIndex.pm \
PMG/Config.pm \
PMG/Cluster.pm \
PMG/ClusterConfig.pm \
PMG/AccessControl.pm \
PMG/AtomicFile.pm \
PMG/MailQueue.pm \
+ PMG/Postfix.pm \
PMG/SMTP.pm \
PMG/Unpack.pm \
+ PMG/Backup.pm \
PMG/RuleCache.pm \
PMG/Statistic.pm \
+ PMG/UserConfig.pm \
+ PMG/Fetchmail.pm \
PMG/LDAPConfig.pm \
PMG/LDAPSet.pm \
PMG/LDAPCache.pm \
PMG/DBTools.pm \
+ PMG/Quarantine.pm \
PMG/RuleDB/Group.pm \
PMG/RuleDB/Rule.pm \
PMG/RuleDB/Object.pm \
PMG/RuleDB/Receiver.pm \
PMG/RuleDB/Domain.pm \
PMG/RuleDB/ReceiverDomain.pm \
+ PMG/RuleDB/LDAP.pm \
+ PMG/RuleDB/LDAPUser.pm \
PMG/RuleDB/TimeFrame.pm \
PMG/RuleDB/MatchField.pm \
PMG/RuleDB/ContentTypeFilter.pm \
PMG/RuleDB/Accept.pm \
PMG/RuleDB/Block.pm \
PMG/RuleDB.pm \
- PMG/CLI/pmgdb.pm \
${CLI_CLASSES} \
+ ${SERVICE_CLASSES} \
+ PMG/API2/Subscription.pm \
+ PMG/API2/APT.pm \
PMG/API2/Network.pm \
PMG/API2/Services.pm \
PMG/API2/Tasks.pm \
PMG/API2/LDAP.pm \
PMG/API2/Domains.pm \
+ PMG/API2/Fetchmail.pm \
+ PMG/API2/Users.pm \
+ PMG/API2/Transport.pm \
+ PMG/API2/MyNetworks.pm \
+ PMG/API2/MimeTypes.pm \
PMG/API2/Config.pm \
- PMG/API2/ClusterConfig.pm \
+ PMG/API2/Cluster.pm \
+ PMG/API2/ClamAV.pm \
+ PMG/API2/SpamAssassin.pm \
+ PMG/API2/Statistics.pm \
+ PMG/API2/MailTracker.pm \
+ PMG/API2/Backup.pm \
PMG/API2/Nodes.pm \
+ PMG/API2/Postfix.pm \
+ PMG/API2/Quarantine.pm \
PMG/API2/AccessControl.pm \
+ PMG/API2/ObjectGroupHelpers.pm \
+ PMG/API2/Rules.pm \
PMG/API2/RuleDB.pm \
+ PMG/API2/SMTPWhitelist.pm \
+ PMG/API2/Who.pm \
+ PMG/API2/When.pm \
+ PMG/API2/What.pm \
+ PMG/API2/Action.pm \
PMG/API2.pm
-all: ${LIBSOURCES} ${CLI_BINARIES} ${TEMPLATES_FILES}
+SOURCES = ${LIBSOURCES} ${CLI_BINARIES} ${TEMPLATES_FILES} ${CONF_MANS} ${CLI_MANS} ${SERVICE_MANS} ${SERVICE_UNITS} ${TIMER_UNITS}
+
+all: ${SOURCES}
.PHONY: deb
-deb ${DEB}: ${LIBSOURCES} ${CLI_BINARIES} ${TEMPLATES_FILES}
+deb ${DEB}: ${SOURCES}
rm -rf build
rsync -a * build
cd build; dpkg-buildpackage -b -us -uc
perl -I. -T -e "use PMG::Service::$*; PMG::Service::$*->generate_bash_completions();" >$@.tmp
mv $@.tmp $@
-install: ${BTDATA} $(addsuffix .pm, $(addprefix PMG/Service/, ${SERVICES})) $(addsuffix .service-bash-completion, ${SERVICES}) ${LIBSOURCES} ${CLI_BINARIES} $(addsuffix .bash-completion, ${CLITOOLS}) ${TEMPLATES_FILES}
+install: ${SOURCES} $(addsuffix .service-bash-completion, ${SERVICES}) $(addsuffix .bash-completion, ${CLITOOLS})
for i in ${SERVICES}; do perl -I. -T -e "use PMG::Service::$$i; PMG::Service::$$i->verify_api();"; done
for i in ${CLITOOLS}; do perl -I. -T -e "use PMG::CLI::$$i; PMG::CLI::$$i->verify_api();"; done
perl -I. bin/pmgsh verifyapi
install -d -m 0755 ${DESTDIR}/usr/bin
- install -d -m 0700 -o www-data -g www-data ${DESTDIR}/var/log/pmgproxy
+ install -d -m 0755 -o www-data -g www-data ${DESTDIR}/var/log/pmgproxy
install -d -m 0755 ${DOCDIR}
# TODO: is there a better location ?
install -m 0644 favicon.ico ${DOCDIR}
for i in ${CLITOOLS}; do install -D -m 0644 $$i.bash-completion ${BASHCOMPLDIR}/$$i; done
for i in ${CLISCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/bin/$$i; done
for i in ${TEMPLATES}; do install -D -m 0644 templates/$$i ${DESTDIR}/var/lib/pmg/templates/$$i; done
+ for i in ${CLI_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man1/$$i; done
+ for i in ${CONF_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man5/$$i; done
+ for i in ${SERVICE_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man8/$$i; done
+ for i in ${CRONSCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/lib/pmg/bin/$$i; done
+ install -d -m 0755 ${DESTDIR}/lib/systemd/system
+ for i in ${TIMER_UNITS}; do install -m 0644 $$i ${DESTDIR}/lib/systemd/system/; done
.PHONY: upload
upload: ${DEB}
- ./repoid.pl .git/ check
- # fixme tar cf - ${DEB} | ssh repoman@repo.proxmox.com upload
+ ./repoid.pl .git/ check
+ tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch
.PHONY: check
check:
distclean: clean
clean:
+ make cleanup-docgen
make -C tests clean
- rm -rf ./build *.deb *.changes *.buildinfo *.bash-completion *.service-bash-completion
+ rm -rf ${CONF_MANS} ./build *.deb *.changes *.buildinfo *.bash-completion *.service-bash-completion
if test -d .git; then rm -f PMG/pmgcfg.pm; fi
find . -name '*~' -exec rm {} ';'