diff options
author | Laurent Bercot <ska-devel@skarnet.org> | 2017-06-07 15:21:44 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2017-06-07 14:22:11 +0000 |
commit | b05a85c9e082e7866a3fd22aa05f3a5c87879c26 (patch) | |
tree | 93b48bf6224cae55cf5150b79b37ffd713e35926 /main/s6 | |
parent | 1473297ec96ceba75e6f162dd1ac0fa361b1fccd (diff) | |
download | aports-b05a85c9e082e7866a3fd22aa05f3a5c87879c26.tar.bz2 aports-b05a85c9e082e7866a3fd22aa05f3a5c87879c26.tar.xz |
main/s6: add policy files
Diffstat (limited to 'main/s6')
-rw-r--r-- | main/s6/APKBUILD | 17 | ||||
-rw-r--r-- | main/s6/s6-svscanboot | 32 | ||||
-rw-r--r-- | main/s6/s6.initd | 15 | ||||
-rw-r--r-- | main/s6/s6.pre-install | 6 | ||||
-rw-r--r-- | main/s6/s6.pre-upgrade | 6 | ||||
-rw-r--r-- | main/s6/s6.trigger | 3 |
6 files changed, 75 insertions, 4 deletions
diff --git a/main/s6/APKBUILD b/main/s6/APKBUILD index 5d81159870..c62301e989 100644 --- a/main/s6/APKBUILD +++ b/main/s6/APKBUILD @@ -2,16 +2,19 @@ # Contributor: John Regan <john@jrjrtech.com> pkgname=s6 pkgver=2.5.1.0 -pkgrel=0 +pkgrel=1 pkgdesc="skarnet.org's small & secure supervision software suite." -url="http://skarnet.org/software/$pkgname/" +url="https://skarnet.org/software/$pkgname/" arch="all" license="ISC" makedepends="skalibs-dev execline-dev" options="!check" subpackages="$pkgname-dev $pkgname-doc" -source="http://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz" +source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz s6-svscanboot s6.initd" builddir="$srcdir/$pkgname-$pkgver" +install="s6.pre-install s6.pre-upgrade" +triggers="s6.trigger=/run/service" + build() { cd "$builddir" @@ -28,6 +31,10 @@ build() { package() { cd "$builddir" make DESTDIR="$pkgdir" install + cp -f "$srcdir/s6-svscanboot" "$pkgdir/lib/s6/s6-svscanboot" + mkdir -p "$pkgdir/etc/init.d" + cp -f "$srcdir/s6.initd" "$pkgdir/etc/init.d/s6" + chmod 0755 "$pkgdir/lib/s6/s6-svscanboot" "$pkgdir/etc/init.d/s6" } doc() { @@ -36,4 +43,6 @@ doc() { cp -a "$builddir/doc" "$subpkgdir/usr/share/doc/$pkgname" } -sha512sums="b8d40b541d6c9b4b78f2aea229eea3188f867dda4ed15626e590b549c0e6bd5114d015ad749faa520e69385272c0960cf6d635a4e51d4e14821e61cab7469fd0 s6-2.5.1.0.tar.gz" +sha512sums="b8d40b541d6c9b4b78f2aea229eea3188f867dda4ed15626e590b549c0e6bd5114d015ad749faa520e69385272c0960cf6d635a4e51d4e14821e61cab7469fd0 s6-2.5.1.0.tar.gz +871ca1f86b354b7c63ce1d3bef8794627e176f993144ed67a17d0a069f5ac2164d94aba980711f61ad349dcd4fe2bf928195f2121a75e611c9897d73f1af12a0 s6-svscanboot +e7f4fcdc04fc7f72df4419018d048e14f80d50d01ebc284b6d208d6bada3201ca91be0a110930618a26fb0e6bcc1603de01467f6f1dc635c8dcae60f1a0b1b9b s6.initd" diff --git a/main/s6/s6-svscanboot b/main/s6/s6-svscanboot new file mode 100644 index 0000000000..2b41d29160 --- /dev/null +++ b/main/s6/s6-svscanboot @@ -0,0 +1,32 @@ +#!/bin/execlineb -S1 + +foreground { redirfd -w 2 /dev/null mkdir -p /run/uncaught-logs } +if { chown catchlog:catchlog /run/uncaught-logs } +if { chmod 2700 /run/uncaught-logs } +foreground { redirfd -w 2 /dev/null mkdir -p ${1}/.s6-svscan ${1}/s6-svscan-log } +foreground { redirfd -w 2 /dev/null ln -sf /bin/false ${1}/.s6-svscan/crash } +if +{ + redirfd -w 1 ${1}/.s6-svscan/finish + heredoc 0 "#!/bin/execlineb -P\ns6-svc -X -- \"${1}/s6-svscan-log\"\n" + cat +} +if { chmod 0755 ${1}/.s6-svscan/finish } +foreground { redirfd -w 2 /dev/null mkfifo -m 0600 ${1}/s6-svscan-log/fifo } +if +{ + redirfd -w 1 ${1}/s6-svscan-log/run + heredoc 0 "#!/bin/execlineb -P +redirfd -w 2 /dev/console +redirfd -rnb 0 fifo +s6-setuidgid catchlog +exec -c +s6-log t /run/uncaught-logs\n" + cat +} +if { chmod 0755 ${1}/s6-svscan-log/run } + +redirfd -r 0 /dev/null +redirfd -wnb 1 ${1}/s6-svscan-log/fifo +fdmove -c 2 1 +s6-svscan -St0 ${1} diff --git a/main/s6/s6.initd b/main/s6/s6.initd new file mode 100644 index 0000000000..9f984cc135 --- /dev/null +++ b/main/s6/s6.initd @@ -0,0 +1,15 @@ +#!/sbin/openrc-run +# Copyright 2016 Laurent Bercot +# Distributed under the terms of the ISC License. +# +# We currently start the supervision tree under OpenRC because +# it's easy integration. It's not perfect: the supervision tree +# should ideally be rooted in process 1, and here it's not. +# But it's only temporary: in a later Alpine release, s6-svscan +# will *be* process 1. + +name="s6" +command="/lib/s6/s6-svscanboot" +command_args="/run/service" +pidfile="/run/s6.pid" +start_stop_daemon_args="-b -m -k 022" diff --git a/main/s6/s6.pre-install b/main/s6/s6.pre-install new file mode 100644 index 0000000000..19804af6d3 --- /dev/null +++ b/main/s6/s6.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup -S catchlog 2>/dev/null +adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog 2>/dev/null +echo 'Run "rc-update add s6 default" to automatically start a s6 supervision tree on /run/service at boot time.' 1>&2 +exit 0 diff --git a/main/s6/s6.pre-upgrade b/main/s6/s6.pre-upgrade new file mode 100644 index 0000000000..19804af6d3 --- /dev/null +++ b/main/s6/s6.pre-upgrade @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup -S catchlog 2>/dev/null +adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog 2>/dev/null +echo 'Run "rc-update add s6 default" to automatically start a s6 supervision tree on /run/service at boot time.' 1>&2 +exit 0 diff --git a/main/s6/s6.trigger b/main/s6/s6.trigger new file mode 100644 index 0000000000..8db8d9a5aa --- /dev/null +++ b/main/s6/s6.trigger @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +s6-svscanctl -aN /run/service |