diff options
author | Stuart Cardall <developer@it-offshore.co.uk> | 2016-09-05 14:15:43 +0000 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2016-09-28 23:43:47 +0200 |
commit | da92db0d6f725c0491da1a4571c393bcfb6f26d6 (patch) | |
tree | 2d07770a34193554463f3ac21f1b8d376727af0b /community | |
parent | fea1d2846a97032ab6e69e848cbc735e6be68f23 (diff) | |
download | aports-da92db0d6f725c0491da1a4571c393bcfb6f26d6.tar.bz2 aports-da92db0d6f725c0491da1a4571c393bcfb6f26d6.tar.xz |
community/socklog: add setup script
Diffstat (limited to 'community')
-rw-r--r-- | community/socklog/APKBUILD | 56 | ||||
-rw-r--r-- | community/socklog/socklog.post-install | 13 | ||||
-rw-r--r-- | community/socklog/socklog.setup | 42 |
3 files changed, 76 insertions, 35 deletions
diff --git a/community/socklog/APKBUILD b/community/socklog/APKBUILD index bda6ad8fa3..e1bb1fc25b 100644 --- a/community/socklog/APKBUILD +++ b/community/socklog/APKBUILD @@ -2,48 +2,46 @@ # Maintainer: Stuart Cardall <developer@it-offshore.co.uk> pkgname=socklog pkgver=2.1.0 -pkgrel=2 +pkgrel=3 pkgdesc="System and kernel logging services for runit" url="http://smarden.org/socklog/" arch="all" license="BSD" install="$pkgname.post-install" subpackages="$pkgname-doc" -source="http://smarden.org/$pkgname/$pkgname-$pkgver.tar.gz" - -_builddir="$srcdir"/admin/socklog-$pkgver/src - -prepare() { - local i - cd "$_builddir" - for i in $source; do - case $i in - *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; - esac - done - echo "$CC $CFLAGS" > conf-cc - echo "$CC $LDFLAGS" > conf-ld -} +source="http://smarden.org/$pkgname/$pkgname-$pkgver.tar.gz + socklog.setup + " +builddir="$srcdir/admin/socklog-$pkgver/src" build() { - cd "$_builddir" + cd "$builddir" + + echo "$CC $CFLAGS" > conf-cc + echo "$CC $LDFLAGS" > conf-ld make } package() { - cd "$_builddir" - install -d "$pkgdir"/usr/bin - install -d "$pkgdir"/sbin - for i in socklog socklog-conf; do - install -m755 "$i" "$pkgdir"/sbin/$i || return 1 - done + cd "$builddir" + + local i + for i in socklog socklog-conf; do + install -m755 -D "$i" "$pkgdir"/sbin/$i || return 1 + done for i in socklog-check tryto uncat; do - install -m755 "$i" "$pkgdir"/usr/bin/$i || return 1 - done + install -m755 -D "$i" "$pkgdir"/usr/bin/$i || return 1 + done + install -d "$pkgdir"/usr/share/man/man8 - cd .. && cp -rf man/* "$pkgdir"/usr/share/man/man8/ + cd .. && cp -rf man/* "$pkgdir"/usr/share/man/man8/ + + install -m754 "$srcdir"/socklog.setup "$pkgdir"/sbin/setup-socklog || return 1 } -md5sums="5d0e8e28c9329ad3af982c5241df9ff1 socklog-2.1.0.tar.gz" -sha256sums="aa869a787ee004da4e5509b5a0031bcc17a4ab4ac650c2ce8d4e488123acb455 socklog-2.1.0.tar.gz" -sha512sums="920ce5e661a6a3d970fa77ee3c228d48699ea03530be2b43b7517458b25e31a0a7f352ece2d076c715b6d34dbb26b424b48eb0f55b9bcd0355b74d3e34c77ac7 socklog-2.1.0.tar.gz" +md5sums="5d0e8e28c9329ad3af982c5241df9ff1 socklog-2.1.0.tar.gz +3d3071e02b3f41281529f622d2dea3f1 socklog.setup" +sha256sums="aa869a787ee004da4e5509b5a0031bcc17a4ab4ac650c2ce8d4e488123acb455 socklog-2.1.0.tar.gz +57531f4baf7ebfa6600449eb58926b42b1bf1d36b934af5a52c53216ed9a26d2 socklog.setup" +sha512sums="920ce5e661a6a3d970fa77ee3c228d48699ea03530be2b43b7517458b25e31a0a7f352ece2d076c715b6d34dbb26b424b48eb0f55b9bcd0355b74d3e34c77ac7 socklog-2.1.0.tar.gz +9ff1296eaa3af00659b835a182bd90b2cfbe1c6f18cfd1259845a20d8735f54b2ba6fce3863f0f18ef5c8129a1842d11414d306d9486468ff1be6d34b9364dfd socklog.setup" diff --git a/community/socklog/socklog.post-install b/community/socklog/socklog.post-install index de53f609d3..b3aeb8de6f 100644 --- a/community/socklog/socklog.post-install +++ b/community/socklog/socklog.post-install @@ -4,6 +4,7 @@ # Distributed under the terms of the GNU General Public License, v2 or later # adduser -S -D -H -h /var/empty -s /sbin/nologin -g log log 2>/dev/null + if [ ! -d /etc/sv/socklog-unix ]; then socklog-conf unix nobody log mkdir -p /etc/service @@ -11,12 +12,12 @@ if [ ! -d /etc/sv/socklog-unix ]; then fi if [ ! -f /etc/sv/socklog-unix/run ]; then -cat > /etc/sv/socklog-unix/run <<EOF -#!/bin/sh -/etc/init.d/syslog stop &>/dev/null -exec 2>&1 -exec chpst -Unobody socklog unix /dev/log -EOF + cat > /etc/sv/socklog-unix/run <<-EOF + #!/bin/sh + + exec 2>&1 + exec chpst -Unobody socklog unix /dev/log + EOF fi exit 0 diff --git a/community/socklog/socklog.setup b/community/socklog/socklog.setup new file mode 100644 index 0000000000..cccd06f528 --- /dev/null +++ b/community/socklog/socklog.setup @@ -0,0 +1,42 @@ +#!/bin/sh + +NORMAL="\033[1;0m" +STRONG="\033[1;1m" +RED="\033[1;31m" +GREEN="\033[1;32m" +runscript="/etc/sv/socklog-unix/run" + +print_stop() { + local prompt="${STRONG}$1 ${RED}$2${NORMAL}" + printf "${prompt}" +} + +print_start() { + local prompt="${STRONG}$1 ${GREEN}$2${NORMAL}" + printf "${prompt}" +} + +print_stop "\nSTOP BusyBox Syslog & remove it from the Boot Runlevel ?" "[ Enter, or Y to remove ]: "; read ans +if [ -z "$ans" ] || [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then + printf "\n" + rc-update del syslog boot + rc-service syslog stop + rc-service klogd stop +fi + +print_start "\nSTART & enable socklog with runit ?" "[ Enter, or Y to add ]: "; read ans +if [ -z "$ans" ] || [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then + if [ -f $runscript ] && [ ! -x $runscript ]; then + printf "\nenabling: %s" "$runscript" + chmod 700 $runscript + fi + + if [ ! -x /sbin/runit ]; then + printf "\n" + apk add runit + rc-update add runitd boot + rc-service runitd start + fi +fi + +exit 0 |