diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2016-09-03 13:29:29 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2016-09-03 13:49:23 +0200 |
commit | 13976180140fc9eb0bf477c225f89ed0e210b4b9 (patch) | |
tree | f25c40bdd2b02cfd036857512010d0f6008154e4 | |
parent | fd47d9508abcaae68145950149f73bdc5161a18b (diff) | |
download | aports-13976180140fc9eb0bf477c225f89ed0e210b4b9.tar.bz2 aports-13976180140fc9eb0bf477c225f89ed0e210b4b9.tar.xz |
community/psad: improve abuild and fix rundir location
-rw-r--r-- | community/psad/APKBUILD | 145 | ||||
-rw-r--r-- | community/psad/psad.initd | 4 |
2 files changed, 77 insertions, 72 deletions
diff --git a/community/psad/APKBUILD b/community/psad/APKBUILD index 2a0a55e48e..b3c6a54afd 100644 --- a/community/psad/APKBUILD +++ b/community/psad/APKBUILD @@ -7,91 +7,96 @@ pkgdesc="3 lightweight system daemons that analyze iptables log messages to dete url="http://cipherdyne.org/psad/" arch="all" license="GPL" -depends="perl iptables ip6tables ssmtp mailx psmisc perl-bit-vector perl-date-calc perl-iptables-chainmgr \ - perl-iptables-parse perl-net-ipv4addr perl-unix-syslog net-tools whois" +depends="perl iptables ip6tables ssmtp mailx psmisc perl-bit-vector + perl-date-calc perl-iptables-chainmgr perl-iptables-parse perl-net-ipv4addr + perl-unix-syslog net-tools whois" subpackages="$pkgname-doc" source="http://cipherdyne.org/psad/download/$pkgname-nodeps-$pkgver.tar.gz psad.initd - psad.confd - " - -_builddir="$srcdir"/$pkgname-nodeps-$pkgver + psad.confd" +builddir="$srcdir/$pkgname-nodeps-$pkgver" build() { - cd "$_builddir" + cd "$builddir" - #Set the config dirs + # Set the config dirs. sed -e "s|'/usr/sbin'|'$pkgdir/usr/sbin'|" \ - -e "s|'/usr/bin'|'$pkgdir/usr/bin'|" \ - -e "s|my \$mpath = \"/usr/share/man/man\$section\";|my \$mpath = \"$pkgdir/usr/share/man/man\$section\";|" \ - ./install.pl -i - #/usr/sbin/psadwatchd set with last cmd + -e "s|'/usr/bin'|'$pkgdir/usr/bin'|" \ + -e "s|my \$mpath = \"/usr/share/man/man\$section\";|my \$mpath = \"$pkgdir/usr/share/man/man\$section\";|" \ + -i ./install.pl || return 1 + + # /usr/sbin/psadwatchd set with last cmd sed -e "s|/var/log/psad|$pkgdir&|" \ - -e "s|/var/run/psad|$pkgdir&|" \ - -e "s|/var/lib/psad|$pkgdir&|" \ - -e "s|/usr/lib/psad|$pkgdir&|" \ - -e "s|/etc/psad|$pkgdir&|" \ - -e "s|/usr/bin/whois_psad|$pkgdir/usr/bin/whois|" \ - -e "s|/usr/sbin/fwcheck_psad|$pkgdir&|" \ - -e "s|/usr/sbin/kmsgsd|$pkgdir&|" \ - -e "s|/usr/sbin/psad|$pkgdir&|" \ - ./psad.conf -i + -e "s|/var/run/psad|$pkgdir/run/psad|" \ + -e "s|/var/lib/psad|$pkgdir&|" \ + -e "s|/usr/lib/psad|$pkgdir&|" \ + -e "s|/etc/psad|$pkgdir&|" \ + -e "s|/usr/bin/whois_psad|$pkgdir/usr/bin/whois|" \ + -e "s|/usr/sbin/fwcheck_psad|$pkgdir&|" \ + -e "s|/usr/sbin/kmsgsd|$pkgdir&|" \ + -e "s|/usr/sbin/psad|$pkgdir&|" \ + -i ./psad.conf || return 1 - # set mail command to mailx - sed -e 's|/bin/mail;|/usr/bin/mail;|g' -i ./psad.conf + # Set mail command to mailx. + sed -e 's|/bin/mail;|/usr/bin/mail;|g' -i ./psad.conf || return 1 - #Disable install of generic init script & setting numeric run level - START=$(sed -n '/if ($init_dir and &is_root()) {/=' ./install.pl) - END=$(expr $START + 7) - #Busybox sed does not support +7d - sed -e ''$START','$END'd' ./install.pl -i + # Disable install of generic init script & setting numeric run level. + local start=$(sed -n '/if ($init_dir and &is_root()) {/=' ./install.pl) + local end=$(expr $start + 7) + # Busybox sed does not support +7d. + sed ''$start','$end'd' ./install.pl -i || return 1 - #populate install.answers so build does not wait for them - echo -e "Would you like to merge the config from the existing psad installation:\t y;" > ./install.answers - echo -e "Preserve any user modfications in etc psad signatures:\t y;" >> ./install.answers - echo -e "Preserve any user modfications in etc psad icmp_types:\t y;" >> ./install.answers - echo -e "Preserve any user modfications in etc psad icmp6_types:\t y;" >> ./install.answers - echo -e "Preserve any user modfications in etc psad posf:\t y;" >> ./install.answers - echo -e "Preserve any user modfications in etc psad auto_dl:\t y;" >> ./install.answers - echo -e "Preserve any user modfications in etc psad snort_rule_dl:\t y;" >> ./install.answers - echo -e "Preserve any user modfications in etc psad pf os:\t y;" >> ./install.answers - echo -e "Preserve any user modfications in etc psad ip_options:\t y;" >> ./install.answers - echo -e "Would you like alerts sent to a different address:\t y;" >> ./install.answers - echo -e "Email addresses:\t root@localhost;" >> ./install.answers - echo -e "Would you like psad to only parse specific strings in iptables messages:\t n;" >> ./install.answers - echo -e "First is it ok to leave the HOME_NET setting as any:\t y;" >> ./install.answers - echo -e "Would you like to enable DShield alerts:\t n;" >> ./install.answers - echo -e "Would you like to install the latest signatures from http www cipherdyne org psad signatures:\t n;" >> ./install.answers - echo -e "Enable psad at boot time:\t n;" >> ./install.answers + # Populate install.answers so build does not wait for them. + cat >./install.answers <<-EOF + Would you like to merge the config from the existing psad installation: y; + Preserve any user modfications in etc psad signatures: y; + Preserve any user modfications in etc psad icmp_types: y; + Preserve any user modfications in etc psad icmp6_types: y; + Preserve any user modfications in etc psad posf: y; + Preserve any user modfications in etc psad auto_dl: y; + Preserve any user modfications in etc psad snort_rule_dl: y; + Preserve any user modfications in etc psad pf os: y; + Preserve any user modfications in etc psad ip_options: y; + Would you like alerts sent to a different address: y; + Email addresses: root@localhost; + Would you like psad to only parse specific strings in iptables messages: n; + First is it ok to leave the HOME_NET setting as any: y; + Would you like to enable DShield alerts: n; + Would you like to install the latest signatures from http www cipherdyne org psad signatures: n; + Enable psad at boot time:\t n; + EOF } package() { - cd "$_builddir" + cd "$builddir" + + mkdir -p "$pkgdir"/etc/psad \ + "$pkgdir"/usr/bin \ + "$pkgdir"/usr/sbin \ + "$pkgdir"/usr/share/man/man8 \ + "$pkgdir"/var/lib/psad \ + "$pkgdir"/var/log/psad + + # Add dummy whois so build completes. + ln -s /bin/busybox "$pkgdir"/usr/bin/whois || return 1 + + # Dummy runlevel 1 / skip perl module installation. + ./install.pl --runlevel 1 --Use-answers --Skip-mod-install || return 1 + rm -Rf "$pkgdir"/var/run - mkdir -p $pkgdir/etc/psad \ - $pkgdir/usr/bin \ - $pkgdir/usr/sbin \ - $pkgdir/usr/share/man/man8 \ - $pkgdir/var/lib/psad \ - $pkgdir/var/log/psad \ - $pkgdir/var/run/psad - # add dummy whois so build completes - ln -s /bin/busybox $pkgdir/usr/bin/whois - # dummy runlevel 1 / skip perl module installation - ./install.pl --runlevel 1 --Use-answers --Skip-mod-install + # Set correct permissions. + chmod -R o+r "$pkgdir"/etc/psad + chmod -R o+r "$pkgdir"/usr/sbin/* + chmod 0700 "$pkgdir"/var/lib/psad - #Set correct permissions - chmod -R o+r $pkgdir/etc/psad - chmod -R o+r $pkgdir/usr/sbin/* - chmod 0700 $pkgdir/var/lib/psad - #remove whois symbolic link - rm -f $pkgdir/usr/bin/whois + # Remove whois symbolic link. + rm -f "$pkgdir"/usr/bin/whois - # Fix the config - sed -e "s|$pkgdir||" $pkgdir/etc/psad/psad.conf -i - sed -e "s|$pkgdir||" $pkgdir/var/log/psad/install.log -i + # Fix the config. + sed "s|$pkgdir||" -i "$pkgdir"/etc/psad/psad.conf || return 1 + sed "s|$pkgdir||" -i "$pkgdir"/var/log/psad/install.log || return 1 - #install init script & config defaults + # Install init script & config defaults. install -m755 -D "$srcdir"/$pkgname.initd \ "$pkgdir"/etc/init.d/$pkgname || return 1 install -m644 -D "$srcdir"/$pkgname.confd \ @@ -99,11 +104,11 @@ package() { } md5sums="644e6094c5142f54cdca6e7429825307 psad-nodeps-2.4.3.tar.gz -7c7bfa7a69c2865dcaa0d0377a4c3041 psad.initd +1b061d02d75d09537ef25e588c09583f psad.initd bc07efebb41cc23c4be129bbbacc874b psad.confd" sha256sums="c5a90f4c284c0eda3b24c5fcd9d0fd0e464ad8bf0fe7559ac6ecc41bb81e0b65 psad-nodeps-2.4.3.tar.gz -62270f32b21808a86453c641381c0265a013f75463dd16f003a379c6a7fab3d1 psad.initd +872152efdd6b5774ed0a11a44156ca5c4707af31ac4e998cfd20a3f47a81fefa psad.initd 74c72225fa37c367a458321b737050cacaf262f32b0cc13babc54468ff1988b9 psad.confd" sha512sums="9234a2ed534f571fb46d7566313802813076b9a3f2011695288b7b1a5c4f3f22cefc6ea99e087cbeb1072d61c278c11a28b5aaa4e4024d8bb459dda4873840d2 psad-nodeps-2.4.3.tar.gz -88af8694bd29c2c109fa8dad4b4b950af97482c4ef0a6c527339705aec5817bfb9176dd63488339f80a1200edb5f3bbe73b81f2011ba238cef7aade96bf95856 psad.initd +ec709b1ba1df36dad5c1c2cfb5fc45765ac4ccdd6fc7a3e2f23c972c7dfb8e5910aeb1ba42437abd0d2c766bb99bcb790301c7b8ba3ee7e6593dcae13e9efc3a psad.initd a80666f59356cc6157a9f5dca132991d4f1e0afda8f673d602de2557219d5521bec9ae148330e98d9483175d14d96e4cc2ccd11541d8b187b0e47f44ba4ada54 psad.confd" diff --git a/community/psad/psad.initd b/community/psad/psad.initd index f598ae05ed..d58b15daf7 100644 --- a/community/psad/psad.initd +++ b/community/psad/psad.initd @@ -4,7 +4,7 @@ # Adapted for Alpine Linux by Stuart Cardall <developer@it-offshore.co.uk> command="/usr/sbin/psad" -pidfile="/var/run/psad/psad.pid" +pidfile="/run/psad/psad.pid" config_file="/etc/psad/psad.conf" depend() { @@ -22,7 +22,7 @@ check_config() { start_pre() { check_config || return 1 - # make sure dir for pidfile exists. /var/run is tmpfs... + # make sure dir for pidfile exists. /run is tmpfs... checkpath --directory ${pidfile%/*} } |