summaryrefslogtreecommitdiff
path: root/system/s6-linux-init/APKBUILD
blob: 742ed3ff650e7d7266ab67f7cc1158f96751d61f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=s6-linux-init
pkgver=1.0.5.1
pkgrel=0
pkgdesc="A s6-based init system"
url="https://skarnet.org/software/$pkgname/"
arch="all"
options="!check"  # No test suite.
license="ISC"
_skalibs_version=2.9.3.0
_s6_version=2.9.2.0
depends="execline s6>=$_s6_version s6-linux-init-common"
makedepends="skalibs-dev>=$_skalibs_version execline-dev s6-dev utmps-dev"
subpackages="$pkgname-common:common:noarch $pkgname-early-getty:earlygetty:noarch $pkgname-libs $pkgname-dev $pkgname-libs-dev:libsdev $pkgname-doc"
source="https://skarnet.org/software/$pkgname/$pkgname-$pkgver.tar.gz rc.init runlevel rc.shutdown reboot.sh earlygetty.run"
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
provides="/sbin/init=0"

build() {
	./configure \
		--enable-shared \
		--enable-static \
		--enable-allstatic \
		--enable-static-libc \
		--libdir=/usr/lib \
		--libexecdir="/lib/$pkgname" \
		--with-dynlib=/lib \
		--enable-utmps
	make
}

package() {
	make DESTDIR="$pkgdir" install

	for i in rc.init runlevel rc.shutdown ; do
		cp -f "$srcdir/$i" "$pkgdir/etc/s6-linux-init/skel/"
		chmod 0755 "$pkgdir/etc/s6-linux-init/skel/$i"
	done

	# static binaries don't work under fakeroot, so build a dynamic one just for us
	touch src/init/s6-linux-init-maker.o
	make s6-linux-init-maker LDFLAGS_NOSHARED=""

	./s6-linux-init-maker \
	  -u catchlog \
	  -G "sleep 86400" \
	  -1 \
	  -L \
	  -p "/usr/bin:/usr/sbin:/bin:/sbin" \
	  -m 022 \
	  -s /run/kernel_env \
	  -f "$pkgdir/etc/s6-linux-init/skel" \
	  -U "" \
	  "$pkgdir/etc/s6-linux-init/current"
	mkdir -p -m 0755 "$pkgdir/sbin" "$pkgdir/etc/runlevels/empty"
	for i in init halt poweroff reboot shutdown telinit ; do
		ln -sf "../etc/s6-linux-init/current/bin/$i" "$pkgdir/sbin/$i"
	done
}


common() {
	pkgdesc="Files for an s6 supervision tree, common to s6-linux-init and sysvinit"
	depends="execline s6"
	runimg="$pkgdir/etc/s6-linux-init/current/run-image"
	subrunimg="$subpkgdir/etc/s6-linux-init/current/run-image"
	install="$subpkgname.post-upgrade $subpkgname.pre-deinstall"
	mkdir -p -m 0755 "$subrunimg/service/.s6-svscan" "$subrunimg/service/s6-svscan-log" "$subpkgdir/usr/share/s6-linux-init-common"
	mv "$runimg/uncaught-logs" "$subrunimg/"
	mv "$runimg/service/s6-svscan-log" "$subrunimg/service/"
	mkdir -m 0755 "$runimg/service/s6-svscan-log"
	mv "$subrunimg/service/s6-svscan-log/run" "$runimg/service/s6-svscan-log/"
	cp -f "$srcdir/reboot.sh" "$subpkgdir/usr/share/s6-linux-init-common/"
}


earlygetty() {
	pkgdesc="Files for a configurable early getty"
        depends="s6-linux-init-common"
        svcimg="$pkgdir/etc/s6-linux-init/current/run-image/service"
        subsvcimg="$subpkgdir/etc/s6-linux-init/current/run-image/service"
	mkdir -p -m 0755 "$subsvcimg"
	mv "$svcimg/s6-linux-init-early-getty" "$subsvcimg/"
	cp -f "$srcdir/earlygetty.run" "$subsvcimg/s6-linux-init-early-getty/run"
	chmod 0755 "$subsvcimg/s6-linux-init-early-getty/run"
}


libs() {
        pkgdesc="$pkgdesc (shared libraries)"
        depends="skalibs-libs>=$_skalibs_version"
        mkdir -p "$subpkgdir/lib"
        mv "$pkgdir"/lib/*.so.* "$subpkgdir/lib/"
}


dev() {
        pkgdesc="$pkgdesc (development files)"
        depends="skalibs-dev>=$_skalibs_version"
	install_if="dev $pkgname=$pkgver-r$pkgrel"
        mkdir -p "$subpkgdir/usr"
        mv "$pkgdir/usr/lib" "$pkgdir/usr/include" "$subpkgdir/usr/"
}


libsdev() {
        pkgdesc="$pkgdesc (development files for dynamic linking)"
        depends="$pkgname-dev"
        mkdir -p "$subpkgdir/lib"
        mv "$pkgdir"/lib/*.so "$subpkgdir/lib/"
}


doc() {
        pkgdesc="$pkgdesc (documentation)"
        depends=""
        install_if="docs $pkgname=$pkgver-r$pkgrel"
        mkdir -p "$subpkgdir/usr/share/doc"
        cp -a "$builddir/doc" "$subpkgdir/usr/share/doc/$pkgname"
}
sha512sums="c23fff1f5f2433119cbcfceb8e69c2f5542c8377079010891f4147a056d66c23fc08e08ca20ce0236d40386aac187cefd7b38bccb1bd5395d01ef4716c7a7432  s6-linux-init-1.0.5.1.tar.gz
756b0cbbe5dabb4631380c3c7ea199cc213224b2e36e50a2d012a61948170078b78bf49b85d886319fecf59843087f937d3d804723b2553ac9f94d088a2f0fd8  rc.init
e73c3c32b118831074288d23fadace2158a2b15d5a13ffa73290b92a9e39c2a21c73d3b0eabea29bcbaa5f6381611fd8d0aaa6aa691ec7de91b8ef6ae404b6da  runlevel
7bb050248a5c2ab6a56c50c35f87cde724f97ff9882f5e60b0f0f2f14bd93c1df7d99fedc3d81c8519cf1a1ed90e03f1cbb9bf891c7b3618aa9a5f5738d262f4  rc.shutdown
6fb2a1112988fd2322b4bc4862bfb948a1c2e43921c5d01ae873c0d31b39fe74fc2934a5018c08b1704a2b2199b31d3a3d7365be369bba734f153b74e000aa74  reboot.sh
67b8dfc5e4174d7ec6fab4ac618e6acf27481808bbaa7cfd3d805dc3e66c017f76e30c5e1ce5d5a5bb5ba3fbf97c0d8b864d8095fae40d1ae9dad3ae629811f9  earlygetty.run"