aboutsummaryrefslogtreecommitdiff
path: root/core/runit
diff options
context:
space:
mode:
Diffstat (limited to 'core/runit')
-rwxr-xr-xcore/runit/build49
-rw-r--r--core/runit/checksums6
-rwxr-xr-xcore/runit/files/210
-rw-r--r--core/runit/files/poweroff2
-rw-r--r--core/runit/files/reboot2
-rw-r--r--core/runit/patches/clearmem.patch12
-rw-r--r--core/runit/patches/svlogd.patch14
-rw-r--r--core/runit/patches/utmpset-time_t.patch57
-rw-r--r--core/runit/sources6
-rw-r--r--core/runit/version2
10 files changed, 135 insertions, 25 deletions
diff --git a/core/runit/build b/core/runit/build
index 3fc5c37a..9b848bf9 100755
--- a/core/runit/build
+++ b/core/runit/build
@@ -1,26 +1,27 @@
#!/bin/sh -e
-cd runit-2.1.2/src
-
-sed -e 's@sbin/runit@usr/bin/runit@g' -i runit.h
-
-# Build statically
-echo "${CC:-gcc} -D_GNU_SOURCE $CFLAGS -static" > conf-cc
-echo "${CC:-gcc} $LDFLAGS -static -Wl,-z -Wl,noexecstack" > conf-ld
-
-# Set service path to /var/service
-sed -i -e 's:^char \*varservice ="/service/";$:char \*varservice ="/var/service/";:' sv.c
-
-make
-
-for bin in chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset; do
- install -Dm755 "$bin" "$1/usr/bin/$bin"
-done
-cd ../man
-for man in ./*; do
- install -Dm644 "$man" "$1/usr/share/man/man8/$man"
-done
-
-
-mkdir -p "$1/var"
-ln -s ../run/runit/runsvdir/current "$1/var/service"
+for patch in ./*.patch ; do patch -p0 < "$patch" ; done
+cd runit-2.1.2
+
+(
+ cd src
+
+ sed 's@sbin/runit@usr/bin/runit@g' -i runit.h
+ printf '%s -D_GNU_SOURCE -static\n' "${CC-cc}" "$CFLAGS" > conf-cc
+ printf '%s %s -static -Wl,-z -Wl,noexecstack\n' "${CC-cc}" "$CFLAGS" > conf-ld
+ sed -i 's:^char \*varservice ="/service/";$:char \*varservice ="/var/service/";:' sv.c
+
+ make
+
+ install -Dm755 -t "$1/usr/bin/" chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset
+)
+
+install -Dm644 -t "$1/usr/share/man/man8" man/*
+
+mkdir -p "$1/var/service" "$1/etc/runit"
+ln -s runit-init "$1/usr/bin/init"
+ln -s /usr/lib/init/rc.boot "$1/etc/runit/1"
+ln -s /usr/lib/init/rc.shutdown "$1/etc/runit/3"
+
+install -Dm755 ../2 "$1/etc/runit/2"
+install -Dm755 -t "$1/usr/bin" ../poweroff ../reboot
diff --git a/core/runit/checksums b/core/runit/checksums
index 0f08a729..d77e778f 100644
--- a/core/runit/checksums
+++ b/core/runit/checksums
@@ -1 +1,7 @@
6fd0160cb0cf1207de4e66754b6d39750cff14bb0aa66ab49490992c0c47ba18 runit-2.1.2.tar.gz
+48fa11e767a19c8c7e72e4fcf6b03d7be286ccee795f11ce10577e28522b91b5 2
+4b1ca5dd082259040d34700b87e86f54f6fd0f72e3e77726b043250187d6b81d poweroff
+b3bfe836d9e70b591ba4d510905213df7abacd3593027c54657682aaafaedb75 reboot
+56730d7443d5e531b92daebbea849278c473be6cfbd6323c2c9f2717cec05f22 clearmem.patch
+64ae1e4e0581cd3cc82695395e6531117685f050c005154bb7927e3e522ab2fb svlogd.patch
+eb53263561b597e67555ecf67984a05c348965e4b7d077ed91ba641cb64d3951 utmpset-time_t.patch
diff --git a/core/runit/files/2 b/core/runit/files/2
new file mode 100755
index 00000000..cae35839
--- /dev/null
+++ b/core/runit/files/2
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+PATH=/usr/bin:
+
+for getty in 1 2 3 4 5 6 ; do
+ while :; do /sbin/getty 38400 tty${getty} 2>&1 ; done & # for busybox
+ # while :; do /sbin/getty /dev/tty${getty} linux 2>&1 ; done & # for ubase
+done
+
+exec /usr/bin/runsvdir -P /var/service
diff --git a/core/runit/files/poweroff b/core/runit/files/poweroff
new file mode 100644
index 00000000..7c07b053
--- /dev/null
+++ b/core/runit/files/poweroff
@@ -0,0 +1,2 @@
+#!/bin/sh
+runit-init 0
diff --git a/core/runit/files/reboot b/core/runit/files/reboot
new file mode 100644
index 00000000..be831eca
--- /dev/null
+++ b/core/runit/files/reboot
@@ -0,0 +1,2 @@
+#!/bin/sh
+runit-init 6
diff --git a/core/runit/patches/clearmem.patch b/core/runit/patches/clearmem.patch
new file mode 100644
index 00000000..2660c5f9
--- /dev/null
+++ b/core/runit/patches/clearmem.patch
@@ -0,0 +1,12 @@
+Taken from void
+diff -Naur runit-2.1.2/src/svlogd.c runit-2.1.2/src/svlogd.c
+--- runit-2.1.2/src/svlogd.c
++++ runit-2.1.2/src/svlogd.c
+@@ -705,6 +705,7 @@
+ coe(fdwdir);
+ dir =(struct logdir*)alloc(dirn *sizeof(struct logdir));
+ if (! dir) die_nomem();
++ memset(dir, 0, dirn * sizeof(struct logdir));
+ for (i =0; i < dirn; ++i) {
+ dir[i].fddir =-1; dir[i].fdcur =-1;
+ dir[i].btmp =(char*)alloc(buflen *sizeof(char));
diff --git a/core/runit/patches/svlogd.patch b/core/runit/patches/svlogd.patch
new file mode 100644
index 00000000..c43a228f
--- /dev/null
+++ b/core/runit/patches/svlogd.patch
@@ -0,0 +1,14 @@
+Taken from void
+Initialize all fields of sockaddr_in.
+http://skarnet.org/cgi-bin/archive.cgi?2:mss:1163:201602:gpiglpbjdemlioaeabbn
+
+--- runit-2.1.2/src/svlogd.c
++++ runit-2.1.2/src/svlogd.c
+@@ -430,6 +430,7 @@
+ ld->name =(char*)fn;
+ ld->ppid =0;
+ ld->match ='+';
++ ld->udpaddr.sin_family =AF_INET;
+ ld->udpaddr.sin_port =0;
+ ld->udponly =0;
+ while (! stralloc_copys(&ld->prefix, "")) pause_nomem();
diff --git a/core/runit/patches/utmpset-time_t.patch b/core/runit/patches/utmpset-time_t.patch
new file mode 100644
index 00000000..9ccf6268
--- /dev/null
+++ b/core/runit/patches/utmpset-time_t.patch
@@ -0,0 +1,57 @@
+Taken from void
+From 20a0afcd367666efc17c59cf121a0d991ff1bd09 Mon Sep 17 00:00:00 2001
+From: Gerrit Pape <pape@smarden.org>
+Date: Thu, 31 Jul 2014 12:25:49 +0000
+Subject: [PATCH] utmpset.c: mixes "int32_t *" and "time_t *"
+
+Don't pass int32_t to time(), thx Lorenzo Beretta,
+https://bugs.debian.org/754849
+---
+ runit-2.1.2/src/utmpset.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/runit-2.1.2/src/utmpset.c b/runit-2.1.2/src/utmpset.c
+index eea41a5..2e8a525 100644
+--- runit-2.1.2/src/utmpset.c
++++ runit-2.1.2/src/utmpset.c
+@@ -24,6 +24,7 @@ void usage(void) { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }
+ int utmp_logout(const char *line) {
+ int fd;
+ uw_tmp ut;
++ time_t t;
+ int ok =-1;
+
+ if ((fd =open(UW_TMP_UFILE, O_RDWR, 0)) < 0)
+@@ -35,7 +36,8 @@ int utmp_logout(const char *line) {
+ if (!ut.ut_name[0] || (str_diff(ut.ut_line, line) != 0)) continue;
+ memset(ut.ut_name, 0, sizeof ut.ut_name);
+ memset(ut.ut_host, 0, sizeof ut.ut_host);
+- if (time(&ut.ut_time) == -1) break;
++ if (time(&t) == -1) break;
++ ut.ut_time = t;
+ #ifdef DEAD_PROCESS
+ ut.ut_type =DEAD_PROCESS;
+ #endif
+@@ -52,6 +54,7 @@ int wtmp_logout(const char *line) {
+ int len;
+ struct stat st;
+ uw_tmp ut;
++ time_t t;
+
+ if ((fd = open_append(UW_TMP_WFILE)) == -1)
+ strerr_die4sys(111, FATAL, "unable to open ", UW_TMP_WFILE, ": ");
+@@ -65,10 +68,11 @@ int wtmp_logout(const char *line) {
+ memset(&ut, 0, sizeof(uw_tmp));
+ if ((len =str_len(line)) > sizeof ut.ut_line) len =sizeof ut.ut_line -2;
+ byte_copy(ut.ut_line, len, line);
+- if (time(&ut.ut_time) == -1) {
++ if (time(&t) == -1) {
+ close(fd);
+ return(-1);
+ }
++ ut.ut_time = t;
+ #ifdef DEAD_PROCESS
+ ut.ut_type =DEAD_PROCESS;
+ #endif
+--
+2.0.1
diff --git a/core/runit/sources b/core/runit/sources
index a10d7bef..61e59c85 100644
--- a/core/runit/sources
+++ b/core/runit/sources
@@ -1 +1,7 @@
http://smarden.org/runit/runit-2.1.2.tar.gz
+files/2
+files/poweroff
+files/reboot
+patches/clearmem.patch
+patches/svlogd.patch
+patches/utmpset-time_t.patch
diff --git a/core/runit/version b/core/runit/version
index 174fb505..b9ac7b5d 100644
--- a/core/runit/version
+++ b/core/runit/version
@@ -1 +1 @@
-2.1.2 1
+2.1.2 2