summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfreaj <freaj@riseup.net>2015-03-23 11:37:40 +0100
committerfreaj <freaj@riseup.net>2015-03-23 11:37:40 +0100
commit7f7e069a651b0a2779fb6e4fbad8c7710349cac0 (patch)
tree67305ba0ed387b9bf51f3e2440c93687726b85ab
parentf8e4235893b9122cffa0400654a2a9b1d1146a11 (diff)
downloadabslibre-7f7e069a651b0a2779fb6e4fbad8c7710349cac0.tar.gz
abslibre-7f7e069a651b0a2779fb6e4fbad8c7710349cac0.tar.bz2
abslibre-7f7e069a651b0a2779fb6e4fbad8c7710349cac0.zip
sysvinit: add new package to [pcr]
-rw-r--r--pcr/sysvinit/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch35
-rw-r--r--pcr/sysvinit/0001-simplify-writelog.patch126
-rw-r--r--pcr/sysvinit/0002-remove-ansi-escape-codes-from-log-file.patch80
-rw-r--r--pcr/sysvinit/PKGBUILD62
4 files changed, 303 insertions, 0 deletions
diff --git a/pcr/sysvinit/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch b/pcr/sysvinit/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch
new file mode 100644
index 000000000..4a7392f1e
--- /dev/null
+++ b/pcr/sysvinit/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch
@@ -0,0 +1,35 @@
+From 251ed68a591cd869b4d5d15bcb7da1f24a865550 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= <maandree@operamail.com>
+Date: Tue, 5 Nov 2013 08:15:59 +0100
+Subject: [PATCH] do not build sulogin on archlinux, it is provided by
+ util-linux
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Mattias Andrée <maandree@operamail.com>
+---
+ src/Makefile | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/Makefile b/src/Makefile
+index 9e80533..1998d39 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -37,6 +37,13 @@ MAN1 += utmpdump.1 wall.1
+ MAN8 += sulogin.8 bootlogd.8
+ endif
+
++ifeq ($(DISTRO),archlinux)
++SBIN += bootlogd
++USRBIN += utmpdump wall
++MAN1 += utmpdump.1 wall.1
++MAN8 += bootlogd.8
++endif
++
+ ifeq ($(DISTRO),Debian)
+ CPPFLAGS+= -DACCTON_OFF
+ SBIN += sulogin bootlogd
+--
+1.8.4.2
+
diff --git a/pcr/sysvinit/0001-simplify-writelog.patch b/pcr/sysvinit/0001-simplify-writelog.patch
new file mode 100644
index 000000000..cc28f14bc
--- /dev/null
+++ b/pcr/sysvinit/0001-simplify-writelog.patch
@@ -0,0 +1,126 @@
+From 5577552eb1344ddd661893564b1e628f8edcf13d Mon Sep 17 00:00:00 2001
+From: Florian Pritz <bluewind@xinu.at>
+Date: Fri, 15 Jun 2012 16:41:52 +0200
+Subject: [PATCH 1/2] simplify writelog()
+
+All we do is prepend the date and remove \r. We don't handle color
+codes, but the user can just cat the log file in a terminal and it will
+interpret the codes correctly.
+
+Signed-off-by: Florian Pritz <bluewind@xinu.at>
+---
+ bootlogd.c | 76 +++++++++++++++++-------------------------------------------
+ 1 file changed, 21 insertions(+), 55 deletions(-)
+
+diff --git a/bootlogd.c b/bootlogd.c
+index 570d382..e36e261 100644
+--- a/bootlogd.c
++++ b/bootlogd.c
+@@ -68,11 +68,6 @@ int didnl = 1;
+ int createlogfile = 0;
+ int syncalot = 0;
+
+-struct line {
+- char buf[256];
+- int pos;
+-} line;
+-
+ /*
+ * Console devices as listed on the kernel command line and
+ * the mapping to actual devices in /dev
+@@ -351,63 +346,34 @@ int consolename(char *res, int rlen)
+ */
+ void writelog(FILE *fp, unsigned char *ptr, int len)
+ {
+- time_t t;
+- char *s;
+- char tmp[8];
+- int olen = len;
+- int dosync = 0;
+- int tlen;
+-
+- while (len > 0) {
+- tmp[0] = 0;
+- if (didnl) {
++ int dosync = 0;
++ int i;
++ static int first_run = 1;
++
++ for (i = 0; i < len; i++) {
++ int ignore = 0;
++
++ /* prepend date to every line */
++ if (*(ptr-1) == '\n' || first_run) {
++ time_t t;
++ char *s;
+ time(&t);
+ s = ctime(&t);
+ fprintf(fp, "%.24s: ", s);
+- didnl = 0;
++ dosync = 1;
++ first_run = 0;
+ }
+- switch (*ptr) {
+- case 27: /* ESC */
+- strcpy(tmp, "^[");
+- break;
+- case '\r':
+- line.pos = 0;
+- break;
+- case 8: /* ^H */
+- if (line.pos > 0) line.pos--;
+- break;
+- case '\n':
+- didnl = 1;
+- dosync = 1;
+- break;
+- case '\t':
+- line.pos += (line.pos / 8 + 1) * 8;
+- if (line.pos >= (int)sizeof(line.buf))
+- line.pos = sizeof(line.buf) - 1;
+- break;
+- case 32 ... 127:
+- case 161 ... 255:
+- tmp[0] = *ptr;
+- tmp[1] = 0;
+- break;
+- default:
+- sprintf(tmp, "\\%03o", *ptr);
+- break;
+- }
+- ptr++;
+- len--;
+
+- tlen = strlen(tmp);
+- if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
+- memcpy(line.buf + line.pos, tmp, tlen);
+- line.pos += tlen;
++ if (*ptr == '\r') {
++ ignore = 1;
+ }
+- if (didnl) {
+- fprintf(fp, "%s\n", line.buf);
+- memset(&line, 0, sizeof(line));
++
++ if (!ignore) {
++ fwrite(ptr, sizeof(char), 1, fp);
+ }
+- }
+
++ ptr++;
++ }
+ if (dosync) {
+ fflush(fp);
+ if (syncalot) {
+@@ -415,7 +381,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
+ }
+ }
+
+- outptr += olen;
++ outptr += len;
+ if (outptr >= endptr)
+ outptr = ringbuf;
+
+--
+1.7.10.4
+
diff --git a/pcr/sysvinit/0002-remove-ansi-escape-codes-from-log-file.patch b/pcr/sysvinit/0002-remove-ansi-escape-codes-from-log-file.patch
new file mode 100644
index 000000000..89b3280df
--- /dev/null
+++ b/pcr/sysvinit/0002-remove-ansi-escape-codes-from-log-file.patch
@@ -0,0 +1,80 @@
+From 8d0022d9540112a92ce8d88c91c4ac10bad8c9ef Mon Sep 17 00:00:00 2001
+From: Florian Pritz <bluewind@xinu.at>
+Date: Sun, 24 Jun 2012 15:49:51 +0200
+Subject: [PATCH 2/2] remove ansi escape codes from log file
+
+References: https://en.wikipedia.org/wiki/ANSI_escape_code
+
+Signed-off-by: Florian Pritz <bluewind@xinu.at>
+---
+ bootlogd.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 43 insertions(+), 2 deletions(-)
+
+diff --git a/bootlogd.c b/bootlogd.c
+index e36e261..88e610d 100644
+--- a/bootlogd.c
++++ b/bootlogd.c
+@@ -349,6 +349,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
+ int dosync = 0;
+ int i;
+ static int first_run = 1;
++ static int inside_esc = 0;
+
+ for (i = 0; i < len; i++) {
+ int ignore = 0;
+@@ -364,10 +365,50 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
+ first_run = 0;
+ }
+
+- if (*ptr == '\r') {
+- ignore = 1;
++ /* remove escape sequences, but do it in a way that allows us to stop
++ * in the middle in case the string was cut off */
++ if (inside_esc == 1) {
++ /* first '[' is special because if we encounter it again, it should be considered the final byte */
++ if (*ptr == '[') {
++ /* multi char sequence */
++ ignore = 1;
++ inside_esc = 2;
++ } else {
++ /* single char sequence */
++ if (*ptr >= 64 && *ptr <= 95) {
++ ignore = 1;
++ }
++ inside_esc = 0;
++ }
++ } else if (inside_esc == 2) {
++ switch (*ptr) {
++ case '0' ... '9': /* intermediate chars of escape sequence */
++ case ';':
++ case 32 ... 47:
++ if (inside_esc) {
++ ignore = 1;
++ }
++ break;
++ case 64 ... 126: /* final char of escape sequence */
++ if (inside_esc) {
++ ignore = 1;
++ inside_esc = 0;
++ }
++ break;
++ }
++ } else {
++ switch (*ptr) {
++ case '\r':
++ ignore = 1;
++ break;
++ case 27: /* ESC */
++ ignore = 1;
++ inside_esc = 1;
++ break;
++ }
+ }
+
++
+ if (!ignore) {
+ fwrite(ptr, sizeof(char), 1, fp);
+ }
+--
+1.7.10.4
+
diff --git a/pcr/sysvinit/PKGBUILD b/pcr/sysvinit/PKGBUILD
new file mode 100644
index 000000000..b19798b5b
--- /dev/null
+++ b/pcr/sysvinit/PKGBUILD
@@ -0,0 +1,62 @@
+# Maintainer : freaj <freaj@riseup.net>
+# Maintainer (Manjaro): artoo <artoo@manjaro.org>
+# Contributor (Manjaro): Mattias Andrée <`base64 -d`(bWFhbmRyZWUK)@member.fsf.org>
+
+pkgname=sysvinit
+pkgver=2.88
+pkgrel=16
+pkgdesc='Linux System V Init'
+url='http://savannah.nongnu.org/projects/sysvinit'
+arch=('i686' 'x86_64' 'armv6h')
+license=('GPL')
+depends=('glibc')
+conflicts=('systemd-sysvcompat')
+
+source=("http://download.savannah.gnu.org/releases/sysvinit/sysvinit-${pkgver}dsf.tar.bz2"
+ "0001-simplify-writelog.patch" "0002-remove-ansi-escape-codes-from-log-file.patch"
+ "0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch")
+sha256sums=('60bbc8c1e1792056e23761d22960b30bb13eccc2cabff8c7310a01f4d5df1519'
+ '8126d09a35bdb9137bb19dc31b58cf1e829137fba34f7dcde7598018e1736826'
+ '90d38e4351ef9d77088661b411eb2b20eda435676e1e407f3d959ca2064d5c1e'
+ '43fed9d36b92f15bcdbde6ba2a2784a57115562795942c09dd33ff37a51cb138')
+
+build()
+{
+ cd "$srcdir/$pkgname-${pkgver}dsf"
+ patch -p1 -d "src" -i "$srcdir/0001-simplify-writelog.patch"
+ patch -p1 -d "src" -i "$srcdir/0002-remove-ansi-escape-codes-from-log-file.patch"
+ patch -p1 -i "$srcdir/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch"
+
+ # Patch for Arch's Linux filesystem hierarchy
+ if [ "$(grep 'execv("/sbin/mount", args);' < src/killall5.c | wc -l)" = 1 ]; then
+ sed -i 's:execv("/bin/mount", args);::' src/killall5.c
+ fi
+ sed -i 's|/bin:/sbin:/usr/bin:/usr/sbin|/usr/bin|' src/initscript.sample src/init.h src/shutdown.c
+ sed -i 's|/sbin:/usr/sbin:/bin:/usr/bin|/usr/bin|' src/initscript.sample src/init.h src/shutdown.c
+ sed -i 's|/bin:/usr/bin:/sbin:/usr/sbin|/usr/bin|' src/initscript.sample src/init.h src/shutdown.c
+ sed -i 's:/sbin/:/bin/:g' contrib/notify-pam-dead.patch man/*.{1,5,8} src/*.{c,h} src/initscript.sample
+ sed -i 's:/bin/:/usr/bin/:g' contrib/notify-pam-dead.patch man/*.{1,5,8} src/*.{c,h} src/initscript.sample
+ sed -i 's:/usr/usr/:/usr/:g' contrib/notify-pam-dead.patch man/*.{1,5,8} src/*.{c,h} src/initscript.sample
+
+ make DISTRO=archlinux
+}
+
+package()
+{
+ cd "$srcdir/$pkgname-${pkgver}dsf"
+ mkdir -p "$pkgdir/__temp__"
+ make DISTRO=archlinux ROOT="$pkgdir/__temp__" install
+ cd "$pkgdir/__temp__"
+ rm -r bin usr/bin usr/share/man/man?/{mesg,utmpdump,wall,last,pidof}.? usr/share/man/man1
+ find . | while read file; do
+ if [ -d "$file" ]; then
+ mkdir -p ".$file"
+ else
+ cp "$file" ".$file"
+ fi
+ done
+ cd ..
+ rm -r "__temp__"
+ mv "$pkgdir/sbin" "$pkgdir/usr/bin"
+}
+