summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/sysvinit/APKBUILD62
-rw-r--r--system/sysvinit/inittab-2.8860
-rw-r--r--system/sysvinit/sysvinit-2.88-posix-header.patch10
-rw-r--r--system/sysvinit/sysvinit.post-upgrade4
-rw-r--r--system/sysvinit/utmpx.patch378
5 files changed, 514 insertions, 0 deletions
diff --git a/system/sysvinit/APKBUILD b/system/sysvinit/APKBUILD
new file mode 100644
index 000000000..184b330cf
--- /dev/null
+++ b/system/sysvinit/APKBUILD
@@ -0,0 +1,62 @@
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=sysvinit
+pkgver=2.88
+pkgrel=4
+pkgdesc="System V-style init programs"
+url="https://savannah.nongnu.org/projects/sysvinit"
+arch="all"
+license="GPL-2.0+"
+depends=""
+makedepends="linux-headers utmps-dev"
+install="sysvinit.post-upgrade"
+options="!check"
+provides="/sbin/init"
+subpackages="$pkgname-doc"
+source="http://download.savannah.nongnu.org/releases/sysvinit/sysvinit-${pkgver}dsf.tar.bz2
+ inittab-2.88
+ sysvinit-2.88-posix-header.patch
+ utmpx.patch
+ "
+builddir="$srcdir/sysvinit-${pkgver}dsf"
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+
+ # util-linux
+ sed -i -r \
+ -e '/^(USR)?S?BIN/s:\<(last|lastb|mesg)\>::g' \
+ -e '/^MAN[18]/s:\<(last|lastb|mesg)[.][18]\>::g' \
+ src/Makefile
+
+ # broken
+ sed -i -r \
+ -e '/^USRBIN/s:utmpdump::g' \
+ -e '/^MAN1/s:utmpdump\.1::g' \
+ src/Makefile
+
+ # procps
+ sed -i -r \
+ -e '/\/bin\/pidof/d'\
+ -e '/^MAN8/s:\<pidof.8\>::g' \
+ src/Makefile
+}
+
+build() {
+ cd "$builddir"
+ export DISTRO="Adélie"
+ make -C src
+}
+
+package() {
+ cd "$builddir"
+ make -C src install ROOT="$pkgdir"
+ rm "$pkgdir"/usr/bin/lastb || true
+ install -D -m644 "$srcdir"/inittab-2.88 "$pkgdir"/etc/inittab
+}
+
+sha512sums="0bd8eeb124e84fdfa8e621b05f796804ee69a9076b65f5115826bfa814ac1d5d28d31a5c22ebe77c86a93b2288edf4891adc0afaecc4de656c4ecda8a83807bf sysvinit-2.88dsf.tar.bz2
+3866d377873b44fb7675b9f05e28190b99b7fedddd9463a0bf41de6ff7cad90e0a4273a9908b1f5c77abea85aa867e2f20ce4d466ce97607863cd9b122f8e9b0 inittab-2.88
+27dfe089660a291cbcba06d8564bad11f7fd7c96629e72c2b005562689dc7d8bb479c760e980590906e98423b991ae0acd048713d3bc372174d55ed894abeb3f sysvinit-2.88-posix-header.patch
+3605f88ac3faf7d12bf2269ca5d8625850d53e8583b573ab280fa17066c8e4e5217a0d17b94e47ea67a153ad3b88b433471a77544bd085f01f7d9d353ac16aae utmpx.patch"
diff --git a/system/sysvinit/inittab-2.88 b/system/sysvinit/inittab-2.88
new file mode 100644
index 000000000..1f0b5eb98
--- /dev/null
+++ b/system/sysvinit/inittab-2.88
@@ -0,0 +1,60 @@
+#
+# /etc/inittab: This file describes how the INIT process should set up
+# the system in a certain run-level.
+#
+# Author: Miquel van Smoorenburg, <miquels@cistron.nl>
+# Modified by: Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
+# Modified by: Daniel Robbins, <drobbins@gentoo.org>
+# Modified by: Martin Schlemmer, <azarah@gentoo.org>
+# Modified by: Mike Frysinger, <vapier@gentoo.org>
+# Modified by: Robin H. Johnson, <robbat2@gentoo.org>
+# Modified by: William Hubbs, <williamh@gentoo.org>
+# Modified by: A. Wilcox, <awilfox@adelielinux.org>
+#
+
+# Default runlevel.
+id:3:initdefault:
+
+# System initialization, mount local filesystems, etc.
+si::sysinit:/sbin/openrc sysinit
+
+# Further system initialization, brings up the boot runlevel.
+rc::bootwait:/sbin/openrc boot
+
+l0:0:wait:/sbin/openrc shutdown
+l0s:0:wait:/sbin/halt -hnp
+l1:1:wait:/sbin/openrc single
+l2:2:wait:/sbin/openrc nonetwork
+l3:3:wait:/sbin/openrc default
+l4:4:wait:/sbin/openrc default
+l5:5:wait:/sbin/openrc default
+l6:6:wait:/sbin/openrc reboot
+l6r:6:wait:/sbin/reboot -fin
+#z6:6:respawn:/sbin/sulogin
+
+# new-style single-user
+su0:S:wait:/sbin/openrc single
+su1:S:wait:/sbin/sulogin
+
+# TERMINALS
+#x1:12345:respawn:/sbin/agetty 38400 console linux
+c1:12345:respawn:/sbin/agetty 38400 tty1 linux
+c2:2345:respawn:/sbin/agetty 38400 tty2 linux
+c3:2345:respawn:/sbin/agetty 38400 tty3 linux
+c4:2345:respawn:/sbin/agetty 38400 tty4 linux
+c5:2345:respawn:/sbin/agetty 38400 tty5 linux
+c6:2345:respawn:/sbin/agetty 38400 tty6 linux
+
+# SERIAL CONSOLES
+#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100
+#s1:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100
+
+# What to do at the "Three Finger Salute".
+ca:12345:ctrlaltdel:/sbin/shutdown -r now
+
+# Used by /etc/init.d/xdm to control DM startup.
+# Read the comments in /etc/init.d/xdm for more
+# info. Do NOT remove, as this will start nothing
+# extra at boot if /etc/init.d/xdm is not added
+# to the "default" runlevel.
+x:a:once:/etc/X11/startDM.sh
diff --git a/system/sysvinit/sysvinit-2.88-posix-header.patch b/system/sysvinit/sysvinit-2.88-posix-header.patch
new file mode 100644
index 000000000..3d63e434e
--- /dev/null
+++ b/system/sysvinit/sysvinit-2.88-posix-header.patch
@@ -0,0 +1,10 @@
+--- a/src/init.c 2016-06-06 07:54:04.237447068 +0000
++++ b/src/init.c 2016-06-06 08:17:37.177523978 +0000
+@@ -46,6 +46,7 @@
+ #include <string.h>
+ #include <signal.h>
+ #include <termios.h>
++#include <sys/ttydefaults.h>
+ #include <utmp.h>
+ #include <ctype.h>
+ #include <stdarg.h>
diff --git a/system/sysvinit/sysvinit.post-upgrade b/system/sysvinit/sysvinit.post-upgrade
new file mode 100644
index 000000000..189621e2c
--- /dev/null
+++ b/system/sysvinit/sysvinit.post-upgrade
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+/sbin/telinit U &> /dev/null
+exit 0
diff --git a/system/sysvinit/utmpx.patch b/system/sysvinit/utmpx.patch
new file mode 100644
index 000000000..b8ee0b48b
--- /dev/null
+++ b/system/sysvinit/utmpx.patch
@@ -0,0 +1,378 @@
+--- sysvinit-2.88dsf/src/runlevel.c.old 2009-09-10 03:28:49.000000000 -0500
++++ sysvinit-2.88dsf/src/runlevel.c 2018-07-03 21:24:40.370000000 -0500
+@@ -22,7 +22,7 @@
+ */
+
+ #include <stdio.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <time.h>
+ #include <stdlib.h>
+
+@@ -30,24 +30,27 @@
+ int argc;
+ char **argv;
+ {
+- struct utmp *ut;
++ struct utmpx *ut;
+ char prev;
+
+- if (argc > 1) utmpname(argv[1]);
++ if (argc > 1) {
++ printf("unknown\n");
++ return(1);
++ }
+
+- setutent();
+- while ((ut = getutent()) != NULL) {
++ setutxent();
++ while ((ut = getutxent()) != NULL) {
+ if (ut->ut_type == RUN_LVL) {
+ prev = ut->ut_pid / 256;
+ if (prev == 0) prev = 'N';
+ printf("%c %c\n", prev, ut->ut_pid % 256);
+- endutent();
++ endutxent();
+ exit(0);
+ }
+ }
+
+ printf("unknown\n");
+- endutent();
++ endutxent();
+ return(1);
+ }
+
+--- sysvinit-2.88dsf/src/halt.c.old 2010-02-26 07:45:49.000000000 -0600
++++ sysvinit-2.88dsf/src/halt.c 2018-07-03 21:26:26.050000000 -0500
+@@ -47,7 +47,7 @@
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <stdlib.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <fcntl.h>
+ #include <string.h>
+ #include <unistd.h>
+@@ -93,7 +93,7 @@
+ */
+ int get_runlevel(void)
+ {
+- struct utmp *ut;
++ struct utmpx *ut;
+ char *r;
+ #if RUNLVL_PICKY
+ time_t boottime;
+@@ -119,8 +119,8 @@
+ /*
+ * Find runlevel in utmp.
+ */
+- setutent();
+- while ((ut = getutent()) != NULL) {
++ setutxent();
++ while ((ut = getutxent()) != NULL) {
+ #if RUNLVL_PICKY
+ /*
+ * Only accept value if it's from after boottime.
+@@ -132,7 +132,7 @@
+ return (ut->ut_pid & 255);
+ #endif
+ }
+- endutent();
++ endutxent();
+
+ /* This should not happen but warn the user! */
+ fprintf(stderr, "WARNING: could not determine runlevel"
+--- sysvinit-2.88dsf/src/utmp.c.old 2009-11-24 04:03:19.000000000 -0600
++++ sysvinit-2.88dsf/src/utmp.c 2018-07-03 21:38:47.460000000 -0500
+@@ -32,7 +32,7 @@
+ #include <time.h>
+ #include <fcntl.h>
+ #include <string.h>
+-#include <utmp.h>
++#include <utmpx.h>
+
+ #include "init.h"
+ #include "initreq.h"
+@@ -46,7 +46,11 @@
+ # define HAVE_UPDWTMP 1
+ # endif
+ #else
+-# define HAVE_UPDWTMP 0
++# define HAVE_UPDWTMPX 1
++#endif
++
++#ifndef WTMP_FILE
++# define WTMP_FILE "/var/run/wtmp"
+ #endif
+
+
+@@ -60,24 +64,10 @@
+ int type, /* TYPE of entry */
+ char *line) /* Which line is this */
+ {
+- int fd;
+- struct utmp utmp;
++ struct utmpx utmp;
+ struct utsname uname_buf;
+ struct timeval tv;
+
+- /*
+- * Can't do much if WTMP_FILE is not present or not writable.
+- */
+- if (access(WTMP_FILE, W_OK) < 0)
+- return;
+-
+- /*
+- * Try to open the wtmp file. Note that we even try
+- * this if we have updwtmp() so we can see if the
+- * wtmp file is accessible.
+- */
+- if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND)) < 0) return;
+-
+ #ifdef INIT_MAIN
+ /*
+ * Note if we are going to write a boot record.
+@@ -115,13 +105,9 @@
+ * Zero the fields and enter new fields.
+ */
+ memset(&utmp, 0, sizeof(utmp));
+-#if defined(__GLIBC__)
+ gettimeofday(&tv, NULL);
+ utmp.ut_tv.tv_sec = tv.tv_sec;
+ utmp.ut_tv.tv_usec = tv.tv_usec;
+-#else
+- time(&utmp.ut_time);
+-#endif
+ utmp.ut_pid = pid;
+ utmp.ut_type = type;
+ strncpy(utmp.ut_name, user, sizeof(utmp.ut_name));
+@@ -132,12 +118,7 @@
+ if (uname(&uname_buf) == 0)
+ strncpy(utmp.ut_host, uname_buf.release, sizeof(utmp.ut_host));
+
+-#if HAVE_UPDWTMP
+- updwtmp(WTMP_FILE, &utmp);
+-#else
+- write(fd, (char *)&utmp, sizeof(utmp));
+-#endif
+- close(fd);
++ updwtmpx(WTMP_FILE, &utmp);
+ }
+
+ /*
+@@ -152,17 +133,11 @@
+ char *line, /* LINE if used. */
+ char *oldline) /* Line of old utmp entry. */
+ {
+- struct utmp utmp;
+- struct utmp tmp;
+- struct utmp *utmptr;
++ struct utmpx utmp;
++ struct utmpx tmp;
++ struct utmpx *utmptr;
+ struct timeval tv;
+
+- /*
+- * Can't do much if UTMP_FILE is not present or not writable.
+- */
+- if (access(UTMP_FILE, W_OK) < 0)
+- return;
+-
+ #ifdef INIT_MAIN
+ /*
+ * Note if we are going to write a boot record.
+@@ -203,13 +178,9 @@
+ utmp.ut_type = type;
+ utmp.ut_pid = pid;
+ strncpy(utmp.ut_id, id, sizeof(utmp.ut_id));
+-#if defined(__GLIBC__)
+ gettimeofday(&tv, NULL);
+ utmp.ut_tv.tv_sec = tv.tv_sec;
+ utmp.ut_tv.tv_usec = tv.tv_usec;
+-#else
+- time(&utmp.ut_time);
+-#endif
+ strncpy(utmp.ut_user, user, UT_NAMESIZE);
+ if (line) strncpy(utmp.ut_line, line, UT_LINESIZE);
+
+@@ -221,9 +192,9 @@
+ /*
+ * Find existing entry for the tty line.
+ */
+- setutent();
++ setutxent();
+ tmp = utmp;
+- if ((utmptr = getutid(&tmp)) != NULL) {
++ if ((utmptr = getutxid(&tmp)) != NULL) {
+ strncpy(utmp.ut_line, utmptr->ut_line, UT_LINESIZE);
+ if (oldline)
+ strncpy(oldline, utmptr->ut_line, UT_LINESIZE);
+@@ -233,9 +204,9 @@
+ /*
+ * Update existing utmp file.
+ */
+- setutent();
+- pututline(&utmp);
+- endutent();
++ setutxent();
++ pututxline(&utmp);
++ endutxent();
+ }
+
+ /*
+--- sysvinit-2.88dsf/src/init.c.old 2018-07-03 21:21:20.180000000 -0500
++++ sysvinit-2.88dsf/src/init.c 2018-07-03 21:47:37.630000000 -0500
+@@ -47,7 +47,7 @@
+ #include <signal.h>
+ #include <termios.h>
+ #include <sys/ttydefaults.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <ctype.h>
+ #include <stdarg.h>
+ #include <sys/syslog.h>
+@@ -132,7 +132,7 @@
+ int sltime = 5; /* Sleep time between TERM and KILL */
+ char *argv0; /* First arguments; show up in ps listing */
+ int maxproclen; /* Maximal length of argv[0] with \0 */
+-struct utmp utproto; /* Only used for sizeof(utproto.ut_id) */
++struct utmpx utproto; /* Only used for sizeof(utproto.ut_id) */
+ char *console_dev; /* Console device. */
+ int pipe_fd = -1; /* /dev/initctl */
+ int did_boot = 0; /* Did we already do BOOT* stuff? */
+@@ -2049,12 +2049,6 @@
+ static
+ void redo_utmp_wtmp(void)
+ {
+- struct stat ustat;
+- const int ret = stat(UTMP_FILE, &ustat);
+-
+- if ((ret < 0) || (ustat.st_size == 0))
+- wrote_utmp_rlevel = wrote_utmp_reboot = 0;
+-
+ if ((wrote_wtmp_reboot == 0) || (wrote_utmp_reboot == 0))
+ write_utmp_wtmp("reboot", "~~", 0, BOOT_TIME, "~");
+
+@@ -2575,8 +2569,6 @@
+ console_init();
+
+ if (!reload) {
+- int fd;
+-
+ /* Close whatever files are open, and reset the console. */
+ close(0);
+ close(1);
+@@ -2590,13 +2582,6 @@
+ setenv("PATH", PATH_DEFAULT, 1 /* Overwrite */);
+
+ /*
+- * Initialize /var/run/utmp (only works if /var is on
+- * root and mounted rw)
+- */
+- if ((fd = open(UTMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0644)) >= 0)
+- close(fd);
+-
+- /*
+ * Say hello to the world
+ */
+ initlog(L_CO, bootmsg, "booting");
+--- sysvinit-2.88dsf/src/dowall.c.old 2010-03-19 11:53:57.000000000 -0500
++++ sysvinit-2.88dsf/src/dowall.c 2018-07-03 21:50:28.300000000 -0500
+@@ -31,7 +31,7 @@
+ #include <time.h>
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <pwd.h>
+ #include <fcntl.h>
+ #include <signal.h>
+@@ -153,7 +153,7 @@
+ {
+ FILE *tp;
+ struct sigaction sa;
+- struct utmp *utmp;
++ struct utmpx *utmp;
+ time_t t;
+ char term[UT_LINESIZE+ strlen(_PATH_DEV) + 1];
+ char line[81];
+@@ -210,9 +210,9 @@
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGALRM, &sa, NULL);
+
+- setutent();
++ setutxent();
+
+- while ((utmp = getutent()) != NULL) {
++ while ((utmp = getutxent()) != NULL) {
+ if(utmp->ut_type != USER_PROCESS ||
+ utmp->ut_user[0] == 0) continue;
+ if (strncmp(utmp->ut_line, _PATH_DEV, strlen(_PATH_DEV)) == 0) {
+@@ -246,7 +246,7 @@
+ if (fd >= 0) close(fd);
+ if (tp != NULL) fclose(tp);
+ }
+- endutent();
++ endutxent();
+
+ exit(0);
+ }
+--- sysvinit-2.88dsf/src/shutdown.c.old 2010-03-23 09:37:01.000000000 -0500
++++ sysvinit-2.88dsf/src/shutdown.c 2018-07-03 22:50:09.520000000 -0500
+@@ -51,7 +51,7 @@
+ #include <signal.h>
+ #include <fcntl.h>
+ #include <stdarg.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <syslog.h>
+ #include "paths.h"
+ #include "reboot.h"
+@@ -335,6 +335,9 @@
+ for(i = 3; i < 20; i++) close(i);
+ close(255);
+
++ /* Record the fact that we're going down */
++ write_wtmp("shutdown", "~~", 0, RUN_LVL, "~~");
++
+ /* First idle init. */
+ if (kill(1, SIGTSTP) < 0) {
+ fprintf(stderr, "shutdown: can't idle init: %s.\r\n", strerror(errno));
+@@ -360,9 +363,6 @@
+ /* script failed or not present: do it ourself. */
+ sleep(1); /* Give init the chance to collect zombies. */
+
+- /* Record the fact that we're going down */
+- write_wtmp("shutdown", "~~", 0, RUN_LVL, "~~");
+-
+ /* This is for those who have quota installed. */
+ #if defined(ACCTON_OFF)
+ # if (ACCTON_OFF > 1) && (_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500))
+@@ -480,7 +480,7 @@
+ struct sigaction sa;
+ struct tm *lt;
+ struct stat st;
+- struct utmp *ut;
++ struct utmpx *ut;
+ time_t t;
+ uid_t realuid;
+ char *halttype;
+@@ -586,7 +586,7 @@
+ fclose(fp);
+
+ /* Now walk through /var/run/utmp to find logged in users. */
+- while(!user_ok && (ut = getutent()) != NULL) {
++ while(!user_ok && (ut = getutxent()) != NULL) {
+
+ /* See if this is a user process on a VC. */
+ if (ut->ut_type != USER_PROCESS) continue;
+@@ -612,7 +612,7 @@
+ break;
+ }
+ }
+- endutent();
++ endutxent();
+
+ /* See if user was allowed. */
+ if (!user_ok) {