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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
#!/usr/bin/make -f
# debian/rules for samhain
# Copyright (C) 2001 to 2024 by Javier Fernandez-Sanguino <jfs@debian.org>
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This is the debhelper compatability version to use.
# export DH_COMPAT=12
include /usr/share/dpkg/architecture.mk
# Disable dnmalloc for most architectures except for
# those known to work (i386 and amd64).
# For more information see:
# http://www.la-samhna.de/samhain/manual/dnmalloc.html
ifeq (linux,$(DEB_HOST_ARCH_OS))
ifeq (amd64,$(DEB_HOST_ARCH))
DNMALLOC = --enable-dnmalloc
else ifeq (i386,$(DEB_HOST_ARCH))
DNMALLOC = --enable-dnmalloc
else
DNMALLOC = --disable-dnmalloc
endif
else
ifeq (amd64,$(DEB_HOST_ARCH))
DNMALLOC = --enable-dnmalloc
else ifeq (i386,$(DEB_HOST_ARCH))
DNMALLOC = --enable-dnmalloc
else
DNMALLOC = --disable-dnmalloc
endif
endif
ifeq (x86_64,$(DEB_HOST_GNU_CPU))
DISABLE_ASM = --disable-asm
endif
# This is a quick fix to make samhain 4.1.4 buildable using GCC-15. See
# https://bugs.debian.org/1097839 for further details. I suggest to work
# with upstream to make samhain's upstream code compliant with GCC-15.
export DEB_CFLAGS_MAINT_APPEND=-std=gnu17
# This is a quick fix regarding bug #1111631 following a patch provided by
# Aurelien Jarno <aurel32@debian.org>, see https://bugs.debian.org/1111631
# for further details. I suggest to report the problem upstream so that they
# can rework the dnmalloc code.
#
# Disable dnmalloc for all architectures at it is unmaintained and has issues
# with GCC >= 11 (see #1111631)
DNMALLOC = --disable-dnmalloc
%:
dh $@
override_dh_auto_configure:
./configure --prefix=/usr --mandir=\$${prefix}/share/man \
--with-config-file=/etc/samhain/samhainrc \
--with-state-dir=/var/lib/samhain \
$(DNMALLOC) \
$(DISABLE_ASM) \
--enable-network=no \
--enable-login-watch \
--enable-mounts-check \
--enable-process-check \
--enable-port-check \
--enable-suidcheck \
--with-pid-file=/run/samhain/samhain.pid \
--with-log-file=/var/log/samhain/samhain.log \
--build=$(DEB_BUILD_GNU_TYPE) \
--host=$(DEB_HOST_GNU_TYPE) \
override_dh_clean:
[ ! -f Makefile ] || $(MAKE) distclean
-rm -f samhainrc.install
-rm -f build-stamp build-server-stamp build-client-stamp
dh_clean
override_dh_installdirs:
dh_installdirs
# Fix the permissions
chmod o-rX `pwd`/debian/samhain/var/log/samhain \
`pwd`/debian/samhain/var/lib/samhain \
`pwd`/debian/samhain/etc/samhain
override_dh_install:
$(MAKE) install install-boot DESTDIR=`pwd`/debian/samhain
# However, remove the rc.d links
-rm -rf `pwd`/debian/samhain/etc/rc?.d
# Remove /run from the package, it is created by the init script
-rm -rf `pwd`/debian/samhain/run
# Remove the configuration file as it needs to be installed by dh_install
-rm -rf `pwd`/debian/samhain/etc/samhain/samhainrc
dh_install
override_dh_installdocs:
dh_installdocs
[ -f debian/samhain/usr/share/doc/samhain/MANUAL-2_4.html.tar ] && \
cd debian/samhain/usr/share/doc/samhain && \
tar xf MANUAL-2_4.html.tar && mv MANUAL-2_4 manual.html && \
rm -f MANUAL-2_4.html.tar
override_dh_installinit:
dh_installinit -- defaults 19
override_dh_installchangelogs:
dh_installchangelogs docs/Changelog
# TODO: create install targets for client and server
# Builds the server (Yule)
# See http://www.la-samhna.de/samhain/manual/yule.html
build-server: build-server-stamp
build-server-stamp:
dh_testdir
./configure --prefix=/usr --mandir=\$${prefix}/share/man \
--with-config-file=/etc/yule/yulerc \
--with-state-dir=/var/lib/yule \
--with-prelude \
$(DNMALLOC) \
--enable-network=server \
--enable-login-watch \
--enable-mounts-check \
--enable-logfile-monitor \
--enable-process-check \
--enable-port-check \
--enable-suidcheck \
--with-pid-file=/var/run/samhain/yule.pid \
--with-log-file=/var/log/samhain/yule.log
$(MAKE)
touch build-server-stamp
# Build the Samhain client
build-client: build-client-stamp
build-client-stamp:
dh_testdir
./configure --prefix=/usr --mandir=\$${prefix}/share/man \
--with-config-file=/etc/samhain/samhainrc \
--with-state-dir=/var/lib/samhain \
--with-prelude \
$(DNMALLOC) \
--enable-network=client \
--enable-login-watch \
--enable-mounts-check \
--enable-logfile-monitor \
--enable-process-check \
--enable-port-check \
--enable-suidcheck \
--with-pid-file=/var/run/samhain/samhain.pid \
--with-log-file=/var/log/samhain/samhain.log
$(MAKE)
touch build-client-stamp
get-orig-source:
@echo "Retrieving source"
wget -q -O samhain-current.tar.gz http://la-samhna.de/samhain/samhain-current.tar.gz
@echo "Extracting source"
tar -zxf samhain-current.tar.gz
@echo "Verifying source"
# Take the latest version
file=`tar -ztf samhain-current.tar.gz |grep -v asc | head -1`; \
gpgfile=`tar -ztf samhain-current.tar.gz |grep asc | head -1`; \
newfile=`echo $$file | sed -e 's/-/_/; s/\.tar/.orig.tar/'`; \
mv $$file $$newfile; \
gpg -q --verify $$gpgfile $$newfile
rm -f samhain-current.tar.gz
|