Subject: [alpine-aports] [PATCH 1/9] main/skalibs: upgrade to 2.4.0.1

From: Laurent Bercot <[email-masked]>
Date: Fri, 4 Nov 2016 19:16:33 +0100

---
 main/skalibs/APKBUILD | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/main/skalibs/APKBUILD b/main/skalibs/APKBUILD
index 633aba0..52a2acb 100644
--- a/main/skalibs/APKBUILD
+++ b/main/skalibs/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Laurent Bercot <[email-masked]>
 # Contributor: John Regan <[email-masked]>
 pkgname=skalibs
-pkgver=2.4.0.0
+pkgver=2.4.0.1
 pkgrel=0
 pkgdesc="A set of general-purpose C programming libraries for skarnet.org software."
 url="http://skarnet.org/software/skalibs/"
@@ -9,7 +9,7 @@ arch="all"
 license="ISC"
 depends=""
 depends_dev=""
-makedepends="$depends_dev"
+makedepends=""
 install=""
 subpackages="$pkgname-dev $pkgname-doc"
 source="http://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz"
@@ -54,6 +54,6 @@ doc() {
 	cp -a "$_builddir/doc" "$subpkgdir/usr/share/doc/$pkgname"
 }
 
-md5sums="b953668521fae8669dc7089ca4e18974  skalibs-2.4.0.0.tar.gz"
-sha256sums="a58cdcc8a2f083090632cdee01f962bee2f99c3f8be61f36c1e13adaef42cea9  skalibs-2.4.0.0.tar.gz"
-sha512sums="c1faffaee495da024102a6af98356fcbc76af467612b6e2eff64d9d724dac138d2d5c5d551f4683daf9757c28c90af77ece1a5f5d9fced04dfc33a04eaab8eba  skalibs-2.4.0.0.tar.gz"
+md5sums="03feceae188571937ca1b2bc83a42647  skalibs-2.4.0.1.tar.gz"
+sha256sums="70dc9f8635d6efdb1d1c7c2274a5305dcc6a346e4227eeb79df7d2d376dbd2ed  skalibs-2.4.0.1.tar.gz"
+sha512sums="b4fde1382b22c4b2b5af0172ae0a8959463ec52ab3871ad163f4b3e8dd2792c93cbe6a49b3145fec76af365130d865f537a69918c5c169959459b4234b355325  skalibs-2.4.0.1.tar.gz"
-- 
2.8.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Laurent Bercot <[email-masked]>
Date: Fri, 4 Nov 2016 19:16:35 +0100

---
 main/s6/APKBUILD          | 20 +++++++++++++-------
 main/s6/s6-svscanboot     | 40 ++++++++++++++++++++++++++++++++++++++++
 main/s6/s6.post-deinstall |  6 ++++++
 main/s6/s6.post-install   | 11 +++++++++++
 main/s6/s6.post-upgrade   | 11 +++++++++++
 main/s6/s6.pre-deinstall  |  9 +++++++++
 main/s6/s6.pre-install    |  5 +++++
 main/s6/s6.pre-upgrade    |  5 +++++
 main/s6/s6.trigger        |  3 +++
 9 files changed, 103 insertions(+), 7 deletions(-)
 create mode 100644 main/s6/s6-svscanboot
 create mode 100644 main/s6/s6.post-deinstall
 create mode 100644 main/s6/s6.post-install
 create mode 100644 main/s6/s6.post-upgrade
 create mode 100644 main/s6/s6.pre-deinstall
 create mode 100644 main/s6/s6.pre-install
 create mode 100644 main/s6/s6.pre-upgrade
 create mode 100644 main/s6/s6.trigger

diff --git a/main/s6/APKBUILD b/main/s6/APKBUILD
index 0c087af..0fb607a 100644
--- a/main/s6/APKBUILD
+++ b/main/s6/APKBUILD
@@ -2,17 +2,18 @@
 # Contributor: John Regan <[email-masked]>
 pkgname=s6
 pkgver=2.4.0.0
-pkgrel=0
+pkgrel=1
 pkgdesc="skarnet.org's small & secure supervision software suite."
 url="http://skarnet.org/software/$pkgname/"
 arch="all"
 license="ISC"
 depends="skalibs execline"
 depends_dev="skalibs-dev execline-dev"
-makedepends="$depends_dev"
-install=""
+makedepends="skalibs-dev execline-dev"
+install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.pre-deinstall $pkgname.post-install $pkgname.post-upgrade $pkgname.post-deinstall"
+triggers="s6.trigger=/run/service"
 subpackages="$pkgname-dev $pkgname-doc"
-source="http://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz"
+source="http://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz s6-svscanboot"
 
 _builddir="$srcdir/$pkgname-$pkgver"
 prepare() {
@@ -41,6 +42,8 @@ build() {
 package() {
 	cd "$_builddir"
 	make DESTDIR="$pkgdir" install || return 1
+	cp -f "$srcdir/s6-svscanboot" "$pkgdir/lib/$pkgname/"
+	chmod 0755 "$pkgdir/lib/$pkgname/s6-svscanboot"
 }
 
 doc() {
@@ -49,6 +52,9 @@ doc() {
 	cp -a "$_builddir/doc" "$subpkgdir/usr/share/doc/$pkgname"
 }
 
-md5sums="d43d82d23ba2f4a00435648298bccc28  s6-2.4.0.0.tar.gz"
-sha256sums="5e788d5935dbcce76ac9a99cfcf6ee46a2ffb84220c84225df7589e9a3585560  s6-2.4.0.0.tar.gz"
-sha512sums="bd294fd6ec6bd5b696c52f8ef43de278a82d2b5ec4bcea3f32ab45f15b22b33633210f38709c1e736bab8ac4c560af6a307b2617709adfc8d5f9c0bce329dff2  s6-2.4.0.0.tar.gz"
+md5sums="d43d82d23ba2f4a00435648298bccc28  s6-2.4.0.0.tar.gz
+2b94208da23b0e4f93e48414b991eeef  s6-svscanboot"
+sha256sums="5e788d5935dbcce76ac9a99cfcf6ee46a2ffb84220c84225df7589e9a3585560  s6-2.4.0.0.tar.gz
+d80ce5c38ed48550316cd84fcbba497fdfa9ce4f6d30dda8f82e6b8c7705fdac  s6-svscanboot"
+sha512sums="bd294fd6ec6bd5b696c52f8ef43de278a82d2b5ec4bcea3f32ab45f15b22b33633210f38709c1e736bab8ac4c560af6a307b2617709adfc8d5f9c0bce329dff2  s6-2.4.0.0.tar.gz
+4b1d236e91620fd8627564a691744531778fdd7f58b43c9af316357301761b25fa28b47c228f9e030b54fa10b81195f96cf777e1a0ee59f8cc455309060a8021  s6-svscanboot"
diff --git a/main/s6/s6-svscanboot b/main/s6/s6-svscanboot
new file mode 100644
index 0000000..a7542a4
--- /dev/null
+++ b/main/s6/s6-svscanboot
@@ -0,0 +1,40 @@
+#!/bin/execlineb -S1
+
+if
+{
+  if -t { redirfd -w 2 /dev/null mkdir /run/uncaught-logs }
+  if { chown catchlog:catchlog /run/uncaught-logs }
+  chmod 2700 /run/uncaught-logs
+}
+
+if
+{
+  if -t { redirfd -w 2 /dev/null mkdir ${1} }
+  if { mkdir ${1}/.s6-svscan ${1}/s6-svscan-log }
+  if { ln -s /bin/false ${1}/.s6-svscan/crash }
+  if
+  {
+    redirfd -w 1 ${1}/.s6-svscan/finish
+    heredoc 0 "#!/bin/execlineb -P\nsleep 1\n"
+    cat
+  }
+  if { chmod 0755 ${1}/.s6-svscan/finish }
+  if { 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
+  }
+  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.post-deinstall b/main/s6/s6.post-deinstall
new file mode 100644
index 0000000..065e0c6
--- /dev/null
+++ b/main/s6/s6.post-deinstall
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm -rf /run/service /run/uncaught-logs
+deluser catchlog
+delgroup catchlog
+exit 0
diff --git a/main/s6/s6.post-install b/main/s6/s6.post-install
new file mode 100644
index 0000000..84a8b04
--- /dev/null
+++ b/main/s6/s6.post-install
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if grep -qFx "::respawn:/lib/s6/s6-svscanboot /run/service" < /etc/inittab ; then
+  :
+else
+  cat >> /etc/inittab <<EOF
+# Launch and supervise s6-svscan
+::respawn:/lib/s6/s6-svscanboot /run/service
+EOF
+  kill -HUP 1
+fi
diff --git a/main/s6/s6.post-upgrade b/main/s6/s6.post-upgrade
new file mode 100644
index 0000000..84a8b04
--- /dev/null
+++ b/main/s6/s6.post-upgrade
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if grep -qFx "::respawn:/lib/s6/s6-svscanboot /run/service" < /etc/inittab ; then
+  :
+else
+  cat >> /etc/inittab <<EOF
+# Launch and supervise s6-svscan
+::respawn:/lib/s6/s6-svscanboot /run/service
+EOF
+  kill -HUP 1
+fi
diff --git a/main/s6/s6.pre-deinstall b/main/s6/s6.pre-deinstall
new file mode 100644
index 0000000..9d44c6f
--- /dev/null
+++ b/main/s6/s6.pre-deinstall
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+stamp=`echo | /bin/s6-tai64n`
+tmp=/tmp/inittab.$$.${stamp%% }
+grep -vFx -e '# Launch and supervise s6-svscan' -e '::respawn:/lib/s6/s6-svscanboot /run/service' < /etc/inittab > "$tmp" || true
+mv -f "$tmp" /etc/inittab
+s6-svc -X /run/service/s6-svscan-log || true
+s6-svscanctl -q /run/service || true
+kill -HUP 1
diff --git a/main/s6/s6.pre-install b/main/s6/s6.pre-install
new file mode 100644
index 0000000..6d9b6d5
--- /dev/null
+++ b/main/s6/s6.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S catchlog 2>/dev/null
+adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog 2>/dev/null
+exit 0
diff --git a/main/s6/s6.pre-upgrade b/main/s6/s6.pre-upgrade
new file mode 100644
index 0000000..6d9b6d5
--- /dev/null
+++ b/main/s6/s6.pre-upgrade
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S catchlog 2>/dev/null
+adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog 2>/dev/null
+exit 0
diff --git a/main/s6/s6.trigger b/main/s6/s6.trigger
new file mode 100644
index 0000000..8db8d9a
--- /dev/null
+++ b/main/s6/s6.trigger
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+s6-svscanctl -aN /run/service
-- 
2.8.3

---

---

From: Timo Teras <[email-masked]>
Date: Thu, 24 Nov 2016 08:31:09 +0200

The:
> start a supervision tree in /run/service when installed

is a bad idea. We don't want the packages to do things like this
automatically. This is especially bad because s6-dev pulls s6, so this
can royally mess up builders.

> +++ b/main/s6/s6.post-deinstall

Normally we don't try to delete users.

> +++ b/main/s6/s6.post-install

This should be separate 'setup-s6' script. This must not be done
automatically.

Also HUPing init does not work inside containers. And when apk
installing with --root this breaks.

> +++ b/main/s6/s6.post-upgrade

Same here. We'll implement restarting things after upgrade somehow else
than post-install. Admin should be able to upgrade packages without
restarting system daemons.

> +grep -vFx -e '# Launch and supervise s6-svscan' -e
> '::respawn:/lib/s6/s6-svscanboot /run/service' < /etc/inittab >
> "$tmp" || true +mv -f "$tmp" /etc/inittab +s6-svc
> -X /run/service/s6-svscan-log || true +s6-svscanctl -q /run/service
> || true +kill -HUP 1
> +adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog
> 2>/dev/null +exit 0
> +adduser -S -D -H -s /bin/false -G catchlog -g catchlog catchlog
> 2>/dev/null +exit 0

---

---

From: Laurent Bercot <[email-masked]>
Date: Fri, 4 Nov 2016 19:16:34 +0100

---
 main/execline/APKBUILD | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main/execline/APKBUILD b/main/execline/APKBUILD
index 108b099..02306b6 100644
--- a/main/execline/APKBUILD
+++ b/main/execline/APKBUILD
@@ -2,14 +2,14 @@
 # Contributor: John Regan <[email-masked]>
 pkgname=execline
 pkgver=2.2.0.0
-pkgrel=0
+pkgrel=1
 pkgdesc="A small scripting language, to be used in place of a shell in non-interactive scripts."
 url="http://skarnet.org/software/$pkgname/"
 arch="all"
 license="ISC"
 depends="skalibs"
 depends_dev="skalibs-dev"
-makedepends="$depends_dev"
+makedepends="skalibs-dev"
 install=""
 subpackages="$pkgname-dev $pkgname-doc"
 source="http://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz"
-- 
2.8.3

---