1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
#!/usr/bin/make -f
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_BUILD_MAINT_OPTIONS=hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
S=$(CURDIR)/debian/xymon
C=$(CURDIR)/debian/xymon-client
%:
dh $@ --with apache2
override_dh_auto_configure:
USEXYMONPING=y \
ENABLESSL=y \
ENABLELDAP=y \
ENABLELDAPSSL=y \
XYMONUSER=xymon \
XYMONTOPDIR=/usr/lib/xymon \
XYMONVAR=/var/lib/xymon \
XYMONHOSTURL=/xymon \
CGIDIR=/usr/lib/xymon/cgi-bin \
XYMONCGIURL=/xymon-cgi \
SECURECGIDIR=/usr/lib/xymon/cgi-secure \
SECUREXYMONCGIURL=/xymon-seccgi \
HTTPDGID=www-data \
XYMONLOGDIR=/var/log/xymon \
XYMONHOSTNAME=localhost \
XYMONHOSTIP=127.0.0.1 \
MANROOT=/usr/share/man \
INSTALLBINDIR=/usr/lib/xymon/server/bin \
INSTALLETCDIR=/etc/xymon \
INSTALLWEBDIR=/etc/xymon/web \
INSTALLEXTDIR=/usr/lib/xymon/server/ext \
INSTALLTMPDIR=/var/lib/xymon/tmp \
INSTALLWWWDIR=/var/lib/xymon/www \
./configure --server \
--pcrelib $(shell pcre-config --libs) \
--ssllib /usr/lib/$(DEB_HOST_MULTIARCH) \
--ldaplib /usr/lib/$(DEB_HOST_MULTIARCH)
override_dh_auto_build:
MAKEFLAGS=-j1 CFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" PKGBUILD=1 $(MAKE)
override_dh_clean:
dh_clean
debconf-updatepo
override_dh_auto_install:
# SERVER
MAKEFLAGS=-j1 CFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" PKGBUILD=1 INSTALLROOT=$S/ $(MAKE) install
# Static content in /usr/share
cd $S/var/lib/xymon/www && \
mv gifs ../../../../usr/share/xymon && ln -s ../../../../usr/share/xymon/gifs . && \
mv help ../../../../usr/share/xymon && ln -s ../../../../usr/share/xymon/help .
# Create static gifs
cd $S/usr/share/xymon/gifs && mkdir static && \
for gif in *.gif ; do \
convert "$$gif[0]" xpm:- | convert xpm:- static/$$gif || exit 1 ; \
done && \
cd static && ln -s ../*.ico ../*.css .
# We depend on the -client package
rm -rf $S/usr/lib/xymon/client
# This needs setuid root
chmod 4755 $S/usr/lib/xymon/server/bin/xymonping
# Apache 2.4 style stuff, used by implicit dh_apache2, see also debian/xymon.apache2
mkdir -p debian/tmp
mv $S/etc/xymon/xymon-apache.conf debian/tmp/xymon.conf
# We use a modified version of this as /etc/init.d/xymon
rm $S/usr/lib/xymon/server/xymon.sh
# Autogenerated on first install
rm $S/etc/xymon/hosts.cfg
# Fix permissions in /var/lib/xymon (dh_fixperms ignores /var)
chmod a-x $S/var/lib/xymon/www/menu/*.gif $S/var/lib/xymon/www/menu/*.css
# CLIENT
CFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" PKGBUILD=1 INSTALLROOT=$C/ $(MAKE) install-client
cd $C/usr/lib/xymon/client && mv etc/* $C/etc/xymon && rmdir etc && ln -s ../../../../etc/xymon etc
cd $C/usr/lib/xymon/client && rmdir logs && ln -s ../../../../var/log/xymon logs
cd $C/usr/lib/xymon/client && rmdir tmp && ln -s ../../../../var/lib/xymon/tmp
# the only command needed in /usr/bin is xymoncmd, its PATH includes our private .../bin
cd $C/usr/bin && ln -s ../lib/xymon/client/bin/xymoncmd xymoncmd
cp debian/xymon-client.default.template $C/usr/share/xymon/xymon-client.default.template
ifneq (,$(findstring kfreebsd,$(shell dpkg --print-architecture)))
# kfreebsd support
install -m644 debian/kfreebsd.cfg $C/etc/xymon/xymonclient.d/kfreebsd.cfg
else
# no kfreebsd support
endif
dh_movefiles --sourcedir=debian/xymon -a
set -e; cd $S/usr/lib/xymon/server/bin && \
for f in * ; do \
if [ -f $C/usr/lib/xymon/client/bin/$$f ] ; then \
rm -v $$f ; ln -s ../../client/bin/$$f ; \
fi \
done
rmdir $S/usr/share/man/man7
override_dh_installdocs:
dh_installdocs
mv -v $S/usr/share/doc/xymon/RELEASENOTES $S/usr/share/doc/xymon/NEWS
mv -v $C/usr/share/doc/xymon-client/RELEASENOTES $C/usr/share/doc/xymon-client/NEWS
override_dh_installinit:
dh_installinit -a -- defaults 98 02
override_dh_fixperms:
dh_fixperms -a -Xbin/xymonping
|