Commit 09c3e7be authored by Natanael Copa's avatar Natanael Copa

testing/auditd: misc cleanups, add init.d script

- split out -static and -libs subpackages
- add init.d script
- remove unneeded make install
- add check function
parent ebd69d60
# Maintainer: Tycho Andersen <tycho@docker.com>
pkgname=audit
pkgver=2.7.2
pkgrel=0
pkgrel=1
pkgdesc="User space tools for 2.6 kernel auditing"
url="http://people.redhat.com/sgrubb/audit/"
arch="all"
......@@ -10,11 +10,13 @@ depends=""
depends_dev=""
makedepends="$depends_dev linux-headers libcap-ng-dev python3"
install=""
subpackages="$pkgname-dev $pkgname-doc"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs"
source="http://people.redhat.com/sgrubb/audit/audit-$pkgver.tar.gz
0001-auditctl-include-headers-to-make-build-work-with-mus.patch
0002-auparse-remove-use-of-rawmemchr.patch
0003-all-get-rid-of-strndupa.patch
auditd.initd
auditd.confd
"
builddir="$srcdir/audit-$pkgver"
......@@ -31,15 +33,31 @@ build() {
--enable-shared=audit \
|| return 1
make || return 1
make DESTDIR="$pkgdir" install || return 1
}
check() {
cd "$builddir"
make check
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install || return 1
install -D -m755 "$srcdir"/auditd.initd \
"$pkgdir"/etc/init.d/auditd || return 1
install -D -m644 "$srcdir"/auditd.confd \
"$pkgdir"/etc/conf.d/auditd || return 1
}
static() {
pkgdesc="Static libaudit libraries"
mkdir -p "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}
sha512sums="a3974547a6da15e87c9070f3aa8a40232555afbd8d6cdf41e6d3c2a059f766ae75febbe8ff72fdadb522222eefda08e55f10dd8d20a3cee2625a6048d38c152b audit-2.7.2.tar.gz
9070de8b9d778c2907adfcb78a02c3a243ed1951d399184679518493a7eca1560878616ace1f661005bda9384e8fc6fde103298c9c57d8883786210939927ecc 0001-auditctl-include-headers-to-make-build-work-with-mus.patch
bede955da1a31b42fbb259ea88cfca97e9a4263987e5982eeeee78a74524ce5f819872cbf404551dcce490ad188cd6a0eee65312ca7665c295581801c92bbb05 0002-auparse-remove-use-of-rawmemchr.patch
41c50d8203ba8d31bd0e4fbcacbf9f15d6d83aae77660d815aecfe75e0cd40e587730becb725431f0416da14468b85c7a13739040498869d64a30ef0602081c1 0003-all-get-rid-of-strndupa.patch"
41c50d8203ba8d31bd0e4fbcacbf9f15d6d83aae77660d815aecfe75e0cd40e587730becb725431f0416da14468b85c7a13739040498869d64a30ef0602081c1 0003-all-get-rid-of-strndupa.patch
1b48c248db5d34f148f9c79f8b2a6acbf61c729230341b861f5e331bbfb0c8356305a09eb2cc5c82c14c4fd9a13c7c13957e1ed493834b8b3b9ee38978e4c31f auditd.initd
69d8777772ded7a8c0db2bcf84961b121bb355fa0d4ba0e14e311f8a8bfe665cbd2b7ac632d73477f9dfa9a6eec357a7ed458fe9b3e7b5ede75b166f3f092ab7 auditd.confd"
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Configuration options for auditd
# -f for foreground mode
# There are some other options as well, but you'll have to look in the source
# code to find them as they aren't ready for use yet.
EXTRAOPTIONS=''
# Audit rules file to run after starting auditd
RULEFILE_STARTUP=/etc/audit/audit.rules
# Audit rules file to run before and after stopping auditd
RULEFILE_STOP_PRE=/etc/audit/audit.rules.stop.pre
RULEFILE_STOP_POST=/etc/audit/audit.rules.stop.post
# If you want to enforce a certain locale for auditd,
# uncomment one of the next lines:
#AUDITD_LANG=none
AUDITD_LANG=C
#AUDITD_LANG=en_US
#AUDITD_LANG=en_US.UTF-8
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
extra_started_commands='reload reload_auditd reload_rules'
description='Linux Auditing System'
description_reload='Reload daemon configuration and rules'
description_reload_rules='Reload daemon rules'
description_reload_auditd='Reload daemon configuration'
name='auditd'
pidfile='/var/run/auditd.pid'
command='/sbin/auditd'
start_auditd() {
# Env handling taken from the upstream init script
if [ -z "$AUDITD_LANG" -o "$AUDITD_LANG" = "none" -o "$AUDITD_LANG" = "NONE" ]; then
unset LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
else
LANG="$AUDITD_LANG"
LC_TIME="$AUDITD_LANG"
LC_ALL="$AUDITD_LANG"
LC_MESSAGES="$AUDITD_LANG"
LC_NUMERIC="$AUDITD_LANG"
LC_MONETARY="$AUDITD_LANG"
LC_COLLATE="$AUDITD_LANG"
export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
fi
unset HOME MAIL USER USERNAME
ebegin "Starting ${name}"
start-stop-daemon \
--start --quiet --pidfile ${pidfile} \
--exec ${command} -- ${EXTRAOPTIONS}
local ret=$?
eend $ret
return $ret
}
stop_auditd() {
ebegin "Stopping ${name}"
start-stop-daemon --stop --quiet --pidfile ${pidfile}
local ret=$?
eend $ret
return $ret
}
loadfile() {
local rules="$1"
if [ -n "${rules}" -a -f "${rules}" ]; then
einfo "Loading audit rules from ${rules}"
/sbin/auditctl -R "${rules}" >/dev/null
return $?
else
return 0
fi
}
start() {
start_auditd
local ret=$?
if [ $ret -eq 0 -a "${RC_CMD}" != "restart" ]; then
loadfile "${RULEFILE_STARTUP}"
fi
return $ret
}
reload_rules() {
loadfile "${RULEFILE_STARTUP}"
}
reload_auditd() {
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --signal HUP \
--exec "${command}" --pidfile "${pidfile}"
eend $?
}
reload() {
reload_auditd
reload_rules
}
stop() {
[ "${RC_CMD}" != "restart" ] && loadfile "${RULEFILE_STOP_PRE}"
stop_auditd
local ret=$?
[ "${RC_CMD}" != "restart" ] && loadfile "${RULEFILE_STOP_POST}"
return $ret
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment