Hello community, here is the log from the commit of package sysvinit for openSUSE:Factory checked in at 2020-10-07 14:16:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sysvinit (Old) and /work/SRC/openSUSE:Factory/.sysvinit.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sysvinit" Wed Oct 7 14:16:09 2020 rev:172 rq:834509 version:2.97 Changes: -------- --- /work/SRC/openSUSE:Factory/sysvinit/sysvinit.changes 2019-09-27 14:43:03.589605494 +0200 +++ /work/SRC/openSUSE:Factory/.sysvinit.new.4249/sysvinit.changes 2020-10-07 14:16:13.945378132 +0200 @@ -1,0 +2,30 @@ +Wed Aug 26 12:42:23 UTC 2020 - Dominique Leuenberger <[email protected]> + +- Drop /bin/pidof and /sbin/pidof, including corresponding man + page: let's switch to pidof as provided by procps-ng. + +------------------------------------------------------------------- +Tue Aug 25 14:45:33 UTC 2020 - Dominique Leuenberger <[email protected]> + +- Update to sysvinit 2.97: + * Check $(ROOT) filesystem for libcrypt instead of a hardcoded + path to /usr. + * Code clean-up and making sure we avoid freeing unused memory. + * Added shell script which converts systemd unit files into + init.d style scripts. + * Allow init to load configuration data from files stored in + /etc/inittab.d/ + * Allow shutdown time to be specified in the format +hh:mm. This + is in addition to the existing formats such as hh:mm, +m, and + "now". + * Fixed typos in manual pages. +- Update startpar to 0.65: + + Make sure startpar testsuite can find insserv executable in + /usr/sbin or /sbin. + + Added PREFIX variable to Makefile and testsuite to make + location of startpar and insserv more flexible. +- Rebase sysvinit-2.90.dif. +- Drop SCVER defines: not used in any place. +- Drop startpar-sysmacros.patch: fixed upstream. + +------------------------------------------------------------------- Old: ---- startpar-0.63.tar.xz startpar-sysmacros.patch sysvinit-2.96.tar.xz New: ---- startpar-0.65.tar.xz sysvinit-2.97.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ powerd.spec ++++++ --- /var/tmp/diff_new_pack.qgvf8h/_old 2020-10-07 14:16:15.161379099 +0200 +++ /var/tmp/diff_new_pack.qgvf8h/_new 2020-10-07 14:16:15.165379102 +0200 @@ -1,7 +1,7 @@ # # spec file for package powerd # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ Group: System/Base BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: systemd-rpm-macros -Url: https://power.sourceforge.net/ +URL: https://power.sourceforge.net/ Source0: powerd-%{version}.tar.bz2 Source2: powerd.service Patch0: powerd-%{version}.dif ++++++ sysvinit.spec ++++++ --- /var/tmp/diff_new_pack.qgvf8h/_old 2020-10-07 14:16:15.205379134 +0200 +++ /var/tmp/diff_new_pack.qgvf8h/_new 2020-10-07 14:16:15.209379137 +0200 @@ -1,7 +1,7 @@ # # spec file for package sysvinit # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,9 +18,8 @@ Name: sysvinit %define KPVER 2.23 -%define SCVER 1.20 -%define SIVER 2.96 -%define START 0.63 +%define SIVER 2.97 +%define START 0.65 Version: %{SIVER} Release: 0 Summary: SysV-Style init @@ -29,15 +28,14 @@ BuildRequires: blog-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build #!BuildIgnore: sysvinit-tools -Url: https://savannah.nongnu.org/projects/sysvinit/ -Source: sysvinit-%{SIVER}.tar.xz +URL: https://savannah.nongnu.org/projects/sysvinit/ +Source: http://download.savannah.nongnu.org/releases/sysvinit/sysvinit-%{SIVER}.tar.xz Source1: https://github.com/bitstreamout/killproc/archive/v%{KPVER}.tar.gz#/killproc-%{KPVER}.tar.gz -Source2: startpar-%{START}.tar.xz +Source2: http://download.savannah.nongnu.org/releases/sysvinit/startpar-%{START}.tar.xz Patch: %{name}-2.90.dif Patch2: %{name}-2.88dsf-suse.patch Patch9: %{name}-2.90-no-kill.patch Patch50: startpar-0.58.dif -Patch51: startpar-sysmacros.patch %description System V style init programs by Miquel van Smoorenburg that control the @@ -56,7 +54,7 @@ %description tools Helper tools from sysvinit that support booting, including but not exclusive -to startpar, killproc and pidof. System V init specific programs are in the +to startpar and killproc. System V init specific programs are in the sysvinit package. %prep @@ -76,7 +74,6 @@ popd pushd ../startpar-%{START} %patch50 -%patch51 -p1 popd %_fixowner . %_fixgroup . @@ -106,26 +103,26 @@ # Remove files not packed: # rm -vf %{buildroot}/usr/include/initreq.h +# pidof is part of procps-ng; let's remove the symlinks to killproc5 here +rm -f %{buildroot}{/sbin,/bin,%{_mandir}/man8}/pidof{,.8} %files tools %defattr (-,root,root,755) %license COPYING COPYRIGHT %doc doc/Propaganda doc/Changelog doc/killproc -/bin/pidof /bin/usleep /bin/fsync -/bin/startpar /sbin/fstab-decode /sbin/checkproc /sbin/pidofproc /sbin/killproc /sbin/killall5 -/sbin/pidof /sbin/startproc /sbin/rvmtab /sbin/vhangup /sbin/mkill /sbin/start_daemon +%{_bindir}/startpar %doc %{_mandir}/man1/usleep.1.gz %doc %{_mandir}/man1/fsync.1.gz %doc %{_mandir}/man1/startpar.1.gz @@ -134,7 +131,6 @@ %doc %{_mandir}/man8/pidofproc.8.gz %doc %{_mandir}/man8/killall5.8.gz %doc %{_mandir}/man8/killproc.8.gz -%doc %{_mandir}/man8/pidof.8.gz %doc %{_mandir}/man8/startproc.8.gz %doc %{_mandir}/man8/start_daemon.8.gz %doc %{_mandir}/man8/rvmtab.8.gz ++++++ startpar-0.58.dif ++++++ --- /var/tmp/diff_new_pack.qgvf8h/_old 2020-10-07 14:16:15.269379185 +0200 +++ /var/tmp/diff_new_pack.qgvf8h/_new 2020-10-07 14:16:15.269379185 +0200 @@ -1,28 +1,12 @@ ---- - Makefile | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - ---- Makefile -+++ Makefile 2019-06-17 13:48:36.894736888 +0000 -@@ -11,10 +11,9 @@ mandir = /usr/share/man - man1dir = $(mandir)/man1 - - SRCS = startpar.c makeboot.c proc.c +diff -ur -p0 startpar-0.65/Makefile startpar/Makefile +--- Makefile 2020-07-07 02:04:06.000000000 +0200 ++++ Makefile 2020-08-25 17:03:05.687028264 +0200 +@@ -15 +14,0 @@ SRCS = startpar.c makeboot.c proc.c -CXXSRCS = compiletest.cc - HDRS = makeboot.h proc.h - REST = COPYING Makefile startpar.1 +@@ -18 +17 @@ REST = COPYING Makefile startpar.1 -OBJS = $(SRCS:.c=.o) $(CXXSRCS:.cc=.o) +OBJS = $(SRCS:.c=.o) - - STARTPAR := $(shell pwd)/startpar - TARBALL = $(PACKAGE)-$(VERSION).tar.xz -@@ -45,8 +44,7 @@ ifeq ($(MAKECMDGOALS),makeboot) - CFLAGS += -DTEST - endif - +@@ -50,2 +49 @@ endif -SOURCEFILES= compiletest.cc \ - CHANGELOG \ +SOURCEFILES= CHANGELOG \ - COPYING \ - makeboot.c \ - makeboot.h \ ++++++ startpar-0.63.tar.xz -> startpar-0.65.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/CHANGELOG new/startpar/CHANGELOG --- old/startpar/CHANGELOG 2019-06-15 18:58:56.000000000 +0200 +++ new/startpar/CHANGELOG 2020-07-07 02:04:06.000000000 +0200 @@ -1,3 +1,40 @@ +startpar 0.65 +=============== + +* Make sure startpar testsuite can find insserv + executable in /usr/sbin or /sbin. + Added PREFIX variable to Makefile and testsuite to + make location of startpar and insserv more flexible. + +startpar 0.64 +=============== + +* Added sys/sysmacros.h header on non-FreeBSD systems to + make it possible to use makedev(). + +* Fixed typos in manual page. Patches provided by Dmitry Bogatov. + +* Make sure we do not try to use unallocated memory when detecting consoles. + +* Fixed handing of overriding location of init.d on the command line. + +* Fixed testsuite script to give better results to tests. Numbered + tests so mixed "success" and "failure" messages would be more clear. + +* Updated testsuite to work with insserv 1.20.0. + +* Fixed regression which could cause jobs to run in serial (interactive + mode) instead of parallel when devpts check failed. + Should greatly increase performance on affected systems. + +* Added -n flag which will prefix output from running jobs with the + name of the executable being run. + +* Added optimization flag to startpar (-O2). Can + be overridden by passing "OPT" variable to Makefile. + +* Made sure output lines from parallel jobs end with a newline character. + startpar 0.63 =============== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/Makefile new/startpar/Makefile --- old/startpar/Makefile 2019-06-15 18:58:56.000000000 +0200 +++ new/startpar/Makefile 2020-07-07 02:04:06.000000000 +0200 @@ -1,4 +1,4 @@ -VERSION = 0.63 +VERSION = 0.65 PACKAGE=startpar PROJECT=sysvinit #ISSUSE = -DSUSE @@ -6,8 +6,9 @@ INSTALL = install -m 755 INSTALL_DATA = install -m 644 DESTDIR = -sbindir = /bin -mandir = /usr/share/man +PREFIX ?= /usr +sbindir = $(PREFIX)/bin +mandir = $(PREFIX)/share/man man1dir = $(mandir)/man1 SRCS = startpar.c makeboot.c proc.c @@ -15,6 +16,7 @@ HDRS = makeboot.h proc.h REST = COPYING Makefile startpar.1 OBJS = $(SRCS:.c=.o) $(CXXSRCS:.cc=.o) +OPT ?= -O2 STARTPAR := $(shell pwd)/startpar TARBALL = $(PACKAGE)-$(VERSION).tar.xz @@ -25,7 +27,7 @@ endif CC ?= gcc -CFLAGS = $(RPM_OPT_FLAGS) $(COPTS) -D_GNU_SOURCE $(INC) -pipe +CFLAGS = $(RPM_OPT_FLAGS) $(COPTS) -D_GNU_SOURCE $(INC) -pipe $(OPT) WARNINGS = -Wall -W -Wformat -Werror=format-security CFLAGS += $(WARNINGS) @@ -69,11 +71,11 @@ install: startpar $(INSTALL) -d $(DESTDIR)$(sbindir) $(DESTDIR)$(man1dir) - $(INSTALL) startpar $(DESTDIR)$(sbindir)/. - $(INSTALL_DATA) startpar.1 $(DESTDIR)$(man1dir)/. + $(INSTALL) startpar $(DESTDIR)$(sbindir)/ + $(INSTALL_DATA) startpar.1 $(DESTDIR)$(man1dir)/ check: all - $(MAKE) STARTPAR=$(STARTPAR) -C testsuite $@ + $(MAKE) STARTPAR=$(STARTPAR) PREFIX=$(PREFIX) -C testsuite $@ distclean: clean rm -f $(TARBALL) $(TARBALL).sig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/makeboot.c new/startpar/makeboot.c --- old/startpar/makeboot.c 2019-06-15 18:58:56.000000000 +0200 +++ new/startpar/makeboot.c 2020-07-07 02:04:06.000000000 +0200 @@ -569,17 +569,6 @@ printf("\"\n"); } -#if DEBUG -void dump_status(void) -{ - struct makenode *node; - - for (node = tree_list; node; node = node->next) - fprintf(stderr, "XXX %s: status = %d, dep = %d, int = %d, imp = %d\n", - node->name, node->status, node->num_deps, node->interactive, node->importance); -} -#endif - #ifdef TEST void *xcalloc(size_t nmemb, size_t size) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/proc.c new/startpar/proc.c --- old/startpar/proc.c 2019-06-15 18:58:56.000000000 +0200 +++ new/startpar/proc.c 2020-07-07 02:04:06.000000000 +0200 @@ -23,6 +23,9 @@ #include <stdlib.h> #include <sys/ioctl.h> #include <sys/types.h> +#ifndef __FreeBSD__ +#include <sys/sysmacros.h> +#endif #include <sys/stat.h> #include <termios.h> #include <fcntl.h> @@ -161,7 +164,7 @@ if (!dir) goto out; while ((fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min) == 3)) { - struct console *restrict tail; + struct console *restrict tail = NULL; char * name; if (!strchr(fbuf, 'E')) @@ -173,7 +176,10 @@ continue; if (posix_memalign((void*)&tail, sizeof(void*), alignof(typeof(struct console))) != 0) - perror("memory allocation"); + { + perror("memory allocation in detect_consoles"); + exit(1); + } tail->next = (struct console*)0; tail->tty = name; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/startpar.1 new/startpar/startpar.1 --- old/startpar/startpar.1 2019-06-15 18:58:56.000000000 +0200 +++ new/startpar/startpar.1 2020-07-07 02:04:06.000000000 +0200 @@ -32,6 +32,7 @@ .IR iorate ] .RB [ \-e .IR etcdir ] +.RB [ \-n ] .RB [ \-t .IR timeout ] .RB [ \-T @@ -47,6 +48,7 @@ .IR par ] .RB [ \-i .IR iorate ] +.RB [ \-n ] .RB [ \-t .IR timeout ] .RB [ \-T @@ -105,6 +107,11 @@ the oldest output. Afterwards it will only print output of this script until it is finished. +When the +.B \-n +flag is used, output from a running job is prefixed with the name +of the program or script being run. + The .B \-M option switches @@ -117,7 +124,7 @@ .IR .depend.boot " or " .depend.start " or " .depend.stop respectively in the directory .IR /etc/init.d/ . -By scanning the boot and runlevel directories in +By scanning the boot and runlevel scripts in .I /etc/init.d/ it then executes the appropriate scripts in parallel. @@ -148,9 +155,9 @@ .I /etc/init.d/.depend.stop .SH SEE ALSO -.BR init.d (7), +.BR init (8), .BR insserv (8), -.BR startproc (8). +.BR startproc (8) .SH COPYRIGHT 2003,2004 SuSE Linux AG, Nuernberg, Germany. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/startpar.c new/startpar/startpar.c --- old/startpar/startpar.c 2019-06-15 18:58:56.000000000 +0200 +++ new/startpar/startpar.c 2020-07-07 02:04:06.000000000 +0200 @@ -117,9 +117,8 @@ const char *initddir = "/etc/init.d"; const char *etcdir = "/etc"; -#define LEGACY_DEPENDENCY_PATH "/etc/init.d/." -/* #define DEPENDENCY_PATH "/lib/insserv/" */ -char *dependency_path = LEGACY_DEPENDENCY_PATH; +#define WRITE_TO_FD 2 + #ifndef PATH_MAX #define PATH_MAX 2048 #endif @@ -150,6 +149,7 @@ static struct prg *prgs; static int inpar, par; static double iorate = 800.0; +int print_program_name = FALSE; #ifdef USE_PRELOAD static volatile enum { Unknown, Preload, NoPreload } ispreload = Unknown; @@ -296,16 +296,37 @@ char *b = p->buf; int r; + #ifdef DEBUG + fprintf(stderr, "About to write buf\n"); + #endif + if ( (print_program_name) && (p->name) && (p->len > 0) ) + { + char *temp_name; + int status; + + status = asprintf(&temp_name, "%s: ", p->name); + if (status >= 0) + { + write(WRITE_TO_FD, temp_name, status); + free(temp_name); + } + } while (p->len > 0) { - r = write(2, b, p->len); + r = write(WRITE_TO_FD, b, p->len); if (r < 0) - { + { if (errno == EINTR) continue; perror("write"); r = p->len; - } + } + else + { + /* make sure we finish output with a newline */ + if (b[p->len - 1] != '\n') + write(WRITE_TO_FD, "\n", 2); + } p->len -= r; b += r; } @@ -360,7 +381,6 @@ #if DEBUG fprintf(stderr, "checksystem par=%d newpar=%d (prcs_run=%lu) %ld\n", par, newpar, prcs_run, time(0)); - dump_status(); #endif if (newpar <= 0) return 1; @@ -421,15 +441,24 @@ if (ptsfd == -1) { + #ifdef DEBUG + fprintf(stderr, "No PT found\n"); + #endif return 0; } else if (ptsname(ptsfd) == 0 || grantpt(ptsfd) || unlockpt(ptsfd)) { + #ifdef DEBUG + fprintf(stderr, "Error getting PT\n"); + #endif close(ptsfd); return 0; } else { + #ifdef DEBUG + fprintf(stderr, "PT found\n"); + #endif close(ptsfd); return 1; } @@ -602,6 +631,10 @@ pid_t pid; int r; + #ifdef DEBUG + fprintf(stderr, "Running interactive, single task.\n"); + #endif + if ((pid = fork()) == (pid_t)-1) { perror("fork"); @@ -687,10 +720,10 @@ void storebuf(struct prg *p) { if ((gtimo_buflen + p->len) > gtimo_bufsize) - { + { writebuf(p); /* In case of overflow or memory shortage */ return; - } + } (void)memcpy(gtimo_buf + gtimo_buflen, p->buf, p->len); gtimo_buflen += p->len; @@ -698,7 +731,7 @@ glastio = now; } -void flushbuf(void) +void flushbuf(struct prg *p) { size_t len = gtimo_buflen; char * buf = gtimo_buf; @@ -706,14 +739,34 @@ if (!buf) return; /* In case of memory shortage */ + #ifdef DEBUG + fprintf(stderr, "About to flush buf\n"); + #endif + if ( (print_program_name) && (len > 0) && (p->name) ) + { + char *temp_name; + int status; + status = asprintf(&temp_name, "%s: ", p->name); + if (status >= 0) + { + write(WRITE_TO_FD, temp_name, status); + free(temp_name); + } + } while (len > 0) { - int r = write(2, buf, len); + int r = write(WRITE_TO_FD, buf, len); if (r < 0) - { + { perror("write"); r = len; - } + } + else + { + /* make sure we finish output with a newline */ + if (buf[len - 1] != '\n') + write(WRITE_TO_FD, "\n", 2); + } len -= r; buf += r; } @@ -789,7 +842,7 @@ p->fd = 0; } -static struct prg *interactive_task; +static struct prg *interactive_task = NULL; static volatile int active; static void sigchld(int sig attribute((unused))) { @@ -865,6 +918,7 @@ fprintf(stderr, " -l use legacy /etc/init.d path for Makefile-style scripts\n"); fprintf(stderr, " The default is to use the location /lib/insserv\n"); */ + fprintf(stderr, " -n prefix output with name of program displaying output\n"); fprintf(stderr, " -p parallel tasks\n"); fprintf(stderr, " -t I/O timeout\n"); fprintf(stderr, " -T global I/O timeout\n"); @@ -891,7 +945,6 @@ char *splashopt = 0; sigset_t nmask, omask, smask; int status; /* check if parsing makefile worked */ - int using_legacy_path = FALSE; /* use new makefile path by default */ detect_consoles(); @@ -904,10 +957,13 @@ numcpu = sysconf(_SC_NPROCESSORS_ONLN); myname = argv[0]; - while ((c = getopt(argc, argv, "fhp:t:T:a:M:P:R:S:vi:e:d:")) != EOF) + while ((c = getopt(argc, argv, "fhnp:t:T:a:M:P:R:S:vi:e:d:")) != EOF) { switch(c) { + case 'n': + print_program_name = TRUE; + break; case 'p': par = atoi(optarg); break; @@ -929,12 +985,6 @@ case 'e': etcdir = optarg; break; - /* - case 'l': - dependency_path = LEGACY_DEPENDENCY_PATH; - using_legacy_path = TRUE; - break; - */ case 'M': run_mode = optarg; break; @@ -950,17 +1000,16 @@ case 'v': printf("startpar version %s\n", VERSION); exit(0); - case 'h': - usage(0); - break; case 'i': iorate = atof(optarg); if (iorate < 0.0) iorate = 800.0; break; + case 'h': + usage(0); /* usage does not return, no need for break.It makes the compiler happy */ + break; default: usage(1); - break; } } if (forw) @@ -1006,21 +1055,14 @@ fprintf(stderr, "invalid run mode %s\n", run_mode); exit(1); } - snprintf(makefile, PATH_MAX, "%sdepend.%s", dependency_path, run_mode); + snprintf(makefile, PATH_MAX, "%s/.depend.%s", initddir, run_mode); status = parse_makefile(makefile); - /* If the parse fails it is probably because the file does not - exist. Try alternative location. -- Jesse */ - if ( (! status) && (! using_legacy_path) ) + if (! status) { - snprintf(makefile, PATH_MAX, "%sdepend.%s", LEGACY_DEPENDENCY_PATH, run_mode); - fprintf(stderr, "Trying to find makefile-style script at legacy location: %s\n", - LEGACY_DEPENDENCY_PATH); - status = parse_makefile(makefile); - if (! status) - exit(1); - } - else if ( (! status) && (using_legacy_path) ) + fprintf(stderr, "Unable to run scripts using dependency information in %s\n", + initddir); exit(1); /* no other place to try so drop out */ + } check_run_files(run_mode, prev_level, run_level); @@ -1035,7 +1077,7 @@ if (par > argc) /* not more than the number of all scripts */ par = argc; - inpar = par; /* the original argument of parallel procs per cpu */ + inpar = par; /* the original argument of parallel procs per cpu */ par = checkpar(inpar, isstart); /* the number of parallel procs on all cpu's */ @@ -1079,11 +1121,19 @@ { if ((*nodevec = pickup_task())) { + #ifdef DEBUG + fprintf(stderr, "About to run single task in run mode %s\n", run_mode); + #endif *resvec = run_single((*nodevec)->name, (*nodevec)->arg0, calcsplash(0, 1, splashopt)); finish_task(*nodevec); } } else - *resvec = run_single(*argv, *argv, calcsplash(0, 1, splashopt)); + { + #ifdef DEBUG + fprintf(stderr, "About to run single task with no devec\n"); + #endif + *resvec = run_single(*argv, *argv, calcsplash(0, 1, splashopt)); + } goto finished; } @@ -1184,7 +1234,7 @@ for (;;) { #ifdef CHECK_FORDEVPTS - int devpts = 0; + int devpts = checkdevpts(); #endif int maxfd = -1; int last = -1; @@ -1244,10 +1294,20 @@ p->num = num++; #ifdef CHECK_FORDEVPTS if (!devpts) - interactive_task = p; /* no /dev/pts, treat as interactive */ + { + #ifdef DEBUG + fprintf(stderr, "No devpts. Setting interactive.\n"); + #endif + interactive_task = p; /* no /dev/pts, treat as interactive */ + } #endif if (notty) + { + #ifdef DEBUG + fprintf(stderr, "No tty available. Set as interactive.\n"); + #endif interactive_task = p; /* no tty, treat as interactive */ + } if (interactive_task) continue; /* don't start this here */ run(p); @@ -1294,6 +1354,9 @@ { p = interactive_task; p->flags |= PRUNNING; + #ifdef DEBUG + fprintf(stderr, "About to run single, interactive task, active zero.\n"); + #endif resvec[p->num] = run_single(p->name, p->arg0, p->splashadd); if (run_mode) finish_task(nodevec[p->num]); @@ -1373,7 +1436,7 @@ { writebuf(p); if (p->fd) detach(p, GTIMO_OFFL); - flushbuf(); + flushbuf(p); gtimo_running = 0; } else if (gtimo_running) @@ -1393,7 +1456,12 @@ #ifdef CHECK_FORDEVPTS if (!devpts) - devpts = checkdevpts(); + { + devpts = checkdevpts(); + #ifdef DEBUG + fprintf(stderr, "Check for devpts returned %d\n", devpts); + #endif + } #endif continue; /* start new processes */ } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/testsuite/runtests new/startpar/testsuite/runtests --- old/startpar/testsuite/runtests 2019-06-15 18:58:56.000000000 +0200 +++ new/startpar/testsuite/runtests 2020-07-07 02:04:06.000000000 +0200 @@ -5,39 +5,39 @@ if [ -z "$STARTPAR" ] ; then STARTPAR=../startpar fi +if [ -z "$INSSERV" ] ; then + INSSERV="$PREFIX"/sbin/insserv + # If insserv is not in new location, check old location + if [ ! -x "$INSSERV" ] ; then + INSSERV=/sbin/insserv + fi +fi + +status=0 mkdir -p etc/init.d touch etc/insserv.conf -cat > etc/init.d/test <<EOF -#!/bin/sh -set -e -### BEGIN INIT INFO -# Provides: test -# Required-Start: $all -# Required-Stop: $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: init script for stopping readahead profiling -### END INIT INFO - -echo success: the test script is running $1 -EOF +cp testscript etc/init.d/test chmod a+rx etc/init.d/test -/sbin/insserv -p etc/init.d test +"$INSSERV" -p etc/init.d -i etc/init.d test || exit 1 if $STARTPAR -d etc/init.d -e etc -P S -R 2 -M start 2>&1 | grep -q 'is running' ; then - echo success: the test init.d script was running + echo Test 1 success: the test script in init.d was running else - echo error: the test init.d was not running + echo Test 1 error: the test script in init.d was not running + status=2 fi rm -rf etc - mkdir -p start touch start/working if $STARTPAR -a start ls 2>&1 | grep -q working ; then - echo success: the ls command was running + echo Test 2 success: the ls command was running else - echo error: the ls command was not running -fi ; rm -rf start + echo Test 2 error: the ls command was not running + status=3 +fi ; +rm -rf start + +exit $status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/testsuite/testscript new/startpar/testsuite/testscript --- old/startpar/testsuite/testscript 1970-01-01 01:00:00.000000000 +0100 +++ new/startpar/testsuite/testscript 2020-07-07 02:04:06.000000000 +0200 @@ -0,0 +1,12 @@ +#!/bin/sh +set -e +### BEGIN INIT INFO +# Provides: test +# Required-Start: $all +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: init script for testing purposes +### END INIT INFO + +echo Dependency test success: the test script is running $1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/testsuite/wait1 new/startpar/testsuite/wait1 --- old/startpar/testsuite/wait1 1970-01-01 01:00:00.000000000 +0100 +++ new/startpar/testsuite/wait1 2020-07-07 02:04:06.000000000 +0200 @@ -0,0 +1,13 @@ +#!/bin/bash + +echo one +sleep 1 +echo two +sleep 1 +echo three +sleep 1 +echo four +sleep 1 +echo five +sleep 5 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/testsuite/wait2 new/startpar/testsuite/wait2 --- old/startpar/testsuite/wait2 1970-01-01 01:00:00.000000000 +0100 +++ new/startpar/testsuite/wait2 2020-07-07 02:04:06.000000000 +0200 @@ -0,0 +1,13 @@ +#!/bin/bash + +echo one +sleep 1 +echo two +sleep 1 +echo three +sleep 1 +echo four +sleep 1 +echo five +sleep 5 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar/testsuite/wait3 new/startpar/testsuite/wait3 --- old/startpar/testsuite/wait3 1970-01-01 01:00:00.000000000 +0100 +++ new/startpar/testsuite/wait3 2020-07-07 02:04:06.000000000 +0200 @@ -0,0 +1,13 @@ +#!/bin/bash + +echo -n "one " +sleep 1 +echo -n "two " +sleep 1 +echo -n "three " +sleep 1 +echo -n "four " +sleep 1 +echo -n "five " +sleep 5 + ++++++ sysvinit-2.90.dif ++++++ --- /var/tmp/diff_new_pack.qgvf8h/_old 2020-10-07 14:16:15.365379261 +0200 +++ /var/tmp/diff_new_pack.qgvf8h/_new 2020-10-07 14:16:15.365379261 +0200 @@ -2,8 +2,10 @@ src/Makefile | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) ---- src/Makefile -+++ src/Makefile 2019-06-17 13:24:27.189649266 +0000 +Index: src/Makefile +=================================================================== +--- src/Makefile.orig ++++ src/Makefile @@ -9,7 +9,7 @@ # @@ -44,9 +46,9 @@ MANDB := endif -@@ -202,13 +198,8 @@ install: all - done +@@ -205,13 +201,8 @@ install: all # $(INSTALL_DIR) $(ROOT)/etc/ + $(INSTALL_DIR) $(ROOT)/etc/inittab.d # $(INSTALL_EXEC) ../doc/initscript.sample $(ROOT)/etc/ - ln -sf halt $(ROOT)/sbin/reboot - ln -sf halt $(ROOT)/sbin/poweroff ++++++ sysvinit-2.96.tar.xz -> sysvinit-2.97.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/contrib/TODO new/sysvinit-2.97/contrib/TODO --- old/sysvinit-2.96/contrib/TODO 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/contrib/TODO 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ - -There are several things on the wishlist. See also the "wishlist" bugs filed -against sysvinit in the debian bugs system (http://www.debian.org/Bugs/). - -1. A special target for kbrequest, so that extra CHILDs are - created (each one needs its own utmp/wtmp bookkeeping) -2. Extend the initreq.h interface? -3. Add GNU last long options to last - -4. Write all boot messages to a logfile - Problem: TIOCCONS ioctl redirects console output, it doesn't copy it. - I think this is not easily possible without kernel support. - I do not like the idea of booting with a pseudo tty as console and - a redirect process behind it writing to both the real console and a - logfile - too fragile. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/contrib/sysd2v.sh new/sysvinit-2.97/contrib/sysd2v.sh --- old/sysvinit-2.96/contrib/sysd2v.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/sysvinit-2.97/contrib/sysd2v.sh 2020-07-07 01:53:15.000000000 +0200 @@ -0,0 +1,551 @@ +#!/bin/sh +# sysd2v v0.3 -- systemd unit to sysvinit script converter +# Copyright (C) 2019 Trek http://www.trek.eu.org/devel/sysd2v +# distributed under the terms of the GNU General Public License 3 + + +nl=" +" + +# read a systemd unit file and set variables named ini_{section}_{key} +# usage: read_unit filename instance +# filename service unit configuration file, '-' to read from stdin +# instance instance name for template units +read_unit() +{ + filename=$1 + instance=$2 + + if [ "$filename" != - ] + then + inifile_unit_name=${filename##*/} + inifile_unit_name=${inifile_unit_name%.*} + fi + + rm_comm='/^[#;]/d' + concat=':l; /\\$/ { N; s/[[:space:]]*\\\n/ /; tl }' + subst_inst="s/%[Ii]/$instance/g" + unit=$( + cat "$filename" | + sed "$rm_comm" | + sed "$concat;$subst_inst" + ) + section_list=$( + printf %s "$unit" | + sed -n 's/^\[\([[:alnum:]]\+\)\].*/\1/p' + ) + oldifs=$IFS + IFS=$nl + + for section in $section_list + do + get_sect='/^\['"$section"'\]/,/^\[.\+\]/' + key_list=$( + printf %s "$unit" | + sed -n "$get_sect"'s/^\([[:alnum:]]\+\)[[:space:]]*=.*/\1/p' | + sort -u + ) + + for key in $key_list + do + val=$( + printf %s "$unit" | + sed -n "$get_sect"'s/^'"$key"'[[:space:]]*=[[:space:]]*\(.*\)/\1/p' + ) + var=$( + echo "${section}_$key" | + tr '[:upper:]' '[:lower:]' + ) + eval ini_$var=\$val + [ -n "$debug" ] && echo "ini_$var=$val" >&2 + done + done + + IFS=$oldifs +} + + +# read a systemd configuration value and write its prefix to stdout +# usage: get_prefix val +# val systemd configuration value +get_prefix () { printf %s "$1" | sed -n 's/^\([-@:+!|]*\).*/\1/p'; } + + +# read a boolean value and returns true or false +# usage: is_true val +# val boolean value +is_true () { case "$1" in 1|[Oo][Nn]|[Tt]*|[Yy]*) true;; *) false; esac } + + +# read systemd services list and write LSB facilities to stdout +# usage: get_provides services +# services list of service units +get_provides () +{ + lst= + for dep in $1 + do + lst=${lst:+$lst }${dep%.service} + done + printf %s "$lst" +} + + +# read systemd units list and write LSB facilities to stdout +# usage: get_depends dependencies [ignores] +# dependencies list of required units +# ignores facilities to ignore +get_depends () +{ + lst= + for dep in $1 + do + d= + case $dep in + local-fs-pre.target) d=mountkernfs;; + time-sync.target) d=\$time;; + systemd-modules-load.service) d=kmod;; + local-fs.target|network-pre.target) d=\$local_fs;; + systemd-sysctl.service) d=procps;; + network.target|network-online.target|systemd-networkd.service) + d=\$network;; + nss-lookup.target) d=\$named;; + rpcbind.target|remote-fs-pre.target) d=\$portmap;; + remote-fs.target|sysinit.target|basic.target) d=\$remote_fs;; + syslog.service) d=\$syslog;; + boot-complete.target|multi-user.target|default.target) d=\$all;; + *.service) d=${dep%.service};; + *) echo "WARNING: unsupported target '$dep'" >&2 + esac + + ign=${2:+$2 }$lst + [ -z "$ign" -o -n "${ign%%*"$d"*}" ] && + lst=${lst:+$lst }$d + done + + printf %s "$lst" +} + + +# read LSB facilities list and write runlevel to stdout +# usage: get_runlevel facilities +# facilities list of required facilities +get_runlevel () +{ + case $1 in + *\$remote_fs*) echo 2 3 4 5;; + *) echo S + esac +} + + +# write a list of environment files to be executed +# usage: write_env list +# list files separated by newlines, with prefix (-) +write_env () +{ + oldifs=$IFS + IFS=$nl + + for env in $1 + do + pre=$(get_prefix "$env") + noerr= + + [ -n "$pre" -a -z "${pre%%*-*}" ] && noerr="[ -r ${env#$pre} ] && " + + printf '%s\n' "$noerr. ${env#$pre}" + done + + IFS=$oldifs +} + + +# write an environment variable containing paths +# usage: write_path name prefix list +# name name of the environment variable +# prefix path prefix to append directories +# list paths separated by spaces or newlines +write_path () +{ + lst= + for dir in $3 + do + lst=${lst:+$lst:}$2/$dir + done + + [ -z "$3" ] || printf '%s=%s\n' $1 $lst +} + + +# write a list of directories to be created +# usage: write_install prefix list [user [group [mode]]] +# prefix path prefix to append directories +# list paths separated by spaces or newlines +# user user ownership +# group group ownership +# mode permission mode +write_install () +{ + for dir in $2 + do + printf ' install -d %s%s/%s || return 2\n' \ + "${3:+-o $3 }${4:+-g $4 }${5:+-m $5 }" "$1" "$dir" + done +} + + +# write a list of commands applying systemd executable prefixes +# usage: write_commands list [run [runpriv]] +# list commands separated by newlines, with prefixes (-@:+!) +# run command line to run each command (nice, chrt, ...) +# runpriv command line to set privileges (runuser, ...) +write_commands () +{ + oldifs=$IFS + IFS=$nl + + for cmd in $1 + do + pre=$(get_prefix "$cmd") + beg=$3 + end=' || return 2' + + if [ -n "$pre" ] + then + [ -z "${pre%%*-*}" ] && end= + [ -z "${pre%%*[+!]*}" ] && beg= + [ -z "${pre%%*[@:]*}" ] && + echo "WARNING: unsupported exec prefix '$pre'" >&2 + fi + + printf ' %s\n' "$2$beg${cmd#$pre}$end" + done + + IFS=$oldifs +} + + +# read a list of commands separated by newlines and write an override function +# usage: write_function name [commands] +# name function name (start_cmd, stop_cmd, ...) +# commands list of commands, read from stdin if omitted +write_function () +{ + lst=${2-$(cat)} + + [ -n "$lst" ] || return + [ "$lst" = : ] && printf "do_${1}_override () :\n\n" && return + + end=' true\n' + [ -z "${lst%%*|| return [0-9]}" -o -z "${lst%%*|| return \$?}" ] && end= + printf "do_${1}_override ()\n{\n%s\n$end}\n\n" "$lst" +} + + +# write an init-d-script file starting from the ini_* vars (see read_unit) +# usage: write_init servicename instance +# servicename name of the service provided +# instance instance name for template units +write_init () +{ + name=$1 + instance=$2 + + if [ "${name%@}" != "$name" ] + then + name=$name$instance + fi + + daemon_pre=$(get_prefix "$ini_service_execstart") + daemon=${ini_service_execstart#$daemon_pre} + + if [ "${daemon%%[[:space:]]*}" != "$daemon" ] + then + daemon_args=${daemon#*[[:space:]]} + daemon=${daemon%%[[:space:]]*} + fi + + pidfile=$ini_service_pidfile + + if [ -n "$ini_service_user" ] + then + start_args="--user $ini_service_user" + [ -n "$daemon_pre" -a -z "${daemon_pre%%*[+!]*}" ] || + start_args="$start_args --chuid $ini_service_user" + stop_args="--user $ini_service_user" + runprivstart="runuser -u $ini_service_user -- " + is_true "$ini_service_permissionsstartonly" || runpriv=$runprivstart + fi + + cls=$ini_service_ioschedulingclass + pri=$ini_service_ioschedulingpriority + [ -n "$cls$pri" ] && + start_args="$start_args --iosched ${cls:-best-effort}${pri:+:$pri}" && + run="ionice ${cls:+-c $cls }${pri:+-n $pri }" + + pol=$ini_service_cpuschedulingpolicy + pri=$ini_service_cpuschedulingpriority + [ -n "$pol$pri" ] && + start_args="$start_args --procsched ${pol:-other}${pri:+:$pri}" && + run="${run}chrt ${pol:+--$pol }${pri:-0} " + + [ -n "$ini_service_nice" ] && + start_args="$start_args --nicelevel $ini_service_nice" && + run="${run}nice -n $ini_service_nice " + + pre=$(get_prefix "$ini_service_workingdirectory") + workdir=${ini_service_workingdirectory#$pre} + [ "$workdir" = '~' ] && workdir=\~$ini_service_user + [ -n "$workdir" ] && + start_args="$start_args --chdir $workdir" && + chdir="${pre}cd $workdir" + + if [ -z "${service_type:=$ini_service_type}" ] + then + if [ -n "$ini_service_busname" ] + then + service_type=dbus + elif [ -n "$ini_service_execstart" ] + then + service_type=simple + else + service_type=oneshot + fi + fi + + if [ "$service_type" != forking ] + then + start_args="$start_args --background" + [ -z "$pidfile" -a "$ini_service_killmode" != none ] && + start_args="$start_args --make-pidfile" && + pidfile="/var/run/$name-sysd2v.pid" + fi + + if [ "$service_type" = notify ] + then + start_args="$start_args --notify-await" + timeout=${ini_service_timeoutstartsec:-$ini_service_timeoutsec} + timeout=${timeout%s} + [ -n "${timeout#60}" ] && + start_args="$start_args --notify-timeout $timeout" + [ -n "$timeout" -a -z "${timeout%%*[^0-9]*}" ] && + echo "WARNING: unsupported timeout '$timeout'" >&2 + elif [ "$service_type" = dbus ] + then + : TODO + fi + + signal=${ini_service_killsignal#SIG} + timeout=${ini_service_timeoutstopsec:-$ini_service_timeoutsec} + timeout=${timeout%s} + [ -n "${signal#TERM}" -o -n "${timeout#90}" ] && + stop_args="$stop_args --retry=${signal:-TERM}/${timeout:-90}/KILL/5" + + limitnofile=$ini_service_limitnofile + [ "$limitnofile" = infinity ] && limitnofile=unlimited + + need_install=$ini_service_runtimedirectory + need_install=$need_install$ini_service_statedirectory + need_install=$need_install$ini_service_cachedirectory + need_install=$need_install$ini_service_logsdirectory + need_install=$need_install$ini_service_configurationdirectory + + need_do_start=$ini_service_execstartpre$ini_service_execstartpost + need_do_start=$need_do_start$need_install + + execstop=$ini_service_execstop + + if [ "$service_type" != oneshot ] + then + [ "$pidfile" = "/var/run/${daemon##*/}.pid" ] && unset pidfile + [ "$name" = "${daemon##*/}" ] && unset name + + [ -n "$daemon_args" -a -z "${daemon_args%%*[\"\\]*}" ] && + echo "WARNING: DAEMON_ARGS needs to be escaped" >&2 + errcheck=' || return $?' + + if [ -n "$daemon_pre" ] + then + [ -z "${daemon_pre%%*-*}" ] && errcheck= + [ -z "${daemon_pre%%*[@:]*}" ] && + echo "WARNING: unsupported exec prefix '$daemon_pre'" >&2 + fi + + # TODO: test if already running before start (pretest="+do_status_cmd") + [ -n "$need_do_start" -o -z "$errcheck" ] && + execstart="-+do_start_cmd$errcheck" + + errcheck=' || return $?' + [ -n "$execstop" ] && errcheck= + [ -n "$execstop$ini_service_execstoppost" -a \ + "$ini_service_killmode" != none ] && + killstop="-do_stop_cmd$errcheck" + + [ -n "$timeout" -a -z "${timeout%%*[^0-9]*}" ] && + echo "WARNING: unsupported timeout '$timeout'" >&2 + else + daemon=none + pidfile=none + : ${name:=SERVICE_NAME} + unset daemon_args start_args stop_args + execstart=$ini_service_execstart + runstart=$run + fi + + need_do_start=$need_do_start$execstart + start_args=${start_args# } + stop_args=${stop_args# } + + aliases=$(get_provides "$ini_install_alias") + + [ -z "$ini_unit_defaultdependencies" ] || + is_true "$ini_unit_defaultdependencies" && + defdep=sysinit.target + + req_start=$(get_depends "$ini_unit_requires $defdep") + should_start=$(get_depends "$ini_unit_wants $ini_unit_after" "$req_start") + + default_start=$(get_runlevel "$req_start $should_start") + [ "$default_start" = S ] && default_stop='0 6' || default_stop='0 1 6' + [ -z "$execstop$ini_service_execstoppost" ] && + [ "$service_type" = oneshot -o "$ini_service_killmode" = none ] && + default_stop= + + [ "$default_start" = S ] && ignore=\$remote_fs + start_before=$(get_depends "$ini_unit_requiredby $ini_install_wantedby + $ini_unit_before" "$req_start $should_start \$all $ignore") + + cat <<EOF +#!/bin/sh +# Generated by sysd2v v0.3 -- http://www.trek.eu.org/devel/sysd2v +# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. +if [ true != "\$INIT_D_SCRIPT_SOURCED" ] ; then + set "\$0" "\$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script +fi +### BEGIN INIT INFO +# Provides: ${name:-${daemon##*/}}${aliases:+ $aliases} +# Required-Start: $req_start +# Required-Stop: ${default_stop:+$req_start} +${should_start:+# Should-Start: $should_start +${default_stop:+# Should-Stop: $should_start +}}${start_before:+# X-Start-Before: $start_before +${default_stop:+# X-Stop-After: $start_before +}}# Default-Start: $default_start +# Default-Stop: $default_stop +# Description: ${ini_unit_description:-SERVICE_DESCRIPTION} +### END INIT INFO +EOF + + if [ -n "$ini_service_environment$ini_service_environmentfile$need_install" ] + then + echo set -a + write_path RUNTIME_DIRECTORY /run "$ini_service_runtimedirectory" + write_path STATE_DIRECTORY /var/lib "$ini_service_statedirectory" + write_path CACHE_DIRECTORY /var/cache "$ini_service_cachedirectory" + write_path LOGS_DIRECTORY /var/log "$ini_service_logsdirectory" + write_path CONFIGURATION_DIRECTORY /etc \ + "$ini_service_configurationdirectory" + printf '%s' "${ini_service_environment:+$ini_service_environment$nl}" + write_env "$ini_service_environmentfile" + printf 'set +a\n\n' + fi + + cat <<EOF +${name:+DESC=\"$name\" +}DAEMON=$daemon +${daemon_args:+DAEMON_ARGS=\"$daemon_args\" +}${pidfile:+PIDFILE=$pidfile +}${start_args:+START_ARGS=\"$start_args\" +}${stop_args:+STOP_ARGS=\"$stop_args\" +}${limitnofile:+ulimit -n $limitnofile +}${ini_service_umask:+umask $ini_service_umask +} +EOF + + if [ -n "$need_do_start" ] + then + { + write_install /run "$ini_service_runtimedirectory" \ + "$ini_service_user" "$ini_service_group" \ + "$ini_service_runtimedirectorymode" + write_install /var/lib "$ini_service_statedirectory" \ + "$ini_service_user" "$ini_service_group" \ + "$ini_service_statedirectorymode" + write_install /var/cache "$ini_service_cachedirectory" \ + "$ini_service_user" "$ini_service_group" \ + "$ini_service_cachedirectorymode" + write_install /var/log "$ini_service_logsdirectory" \ + "$ini_service_user" "$ini_service_group" \ + "$ini_service_logsdirectorymode" + write_install /etc "$ini_service_configurationdirectory" '' '' \ + "$ini_service_configurationdirectorymode" + write_commands "$chdir" + write_commands "$ini_service_execstartpre" "$run" "$runpriv" + write_commands "$execstart" "$runstart" "$runprivstart" + write_commands "$ini_service_execstartpost" "$run" "$runpriv" + } | write_function start_cmd + else + [ "$service_type" = oneshot ] && write_function start : + fi + + if [ -n "$execstop$ini_service_execstoppost" ] + then + { + write_commands "$chdir" + write_commands "$execstop" "$run" "$runpriv" + write_commands "$killstop" + write_commands "$ini_service_execstoppost" "$run" "$runpriv" + } | write_function stop_cmd + else + [ "$service_type" = oneshot -o "$ini_service_killmode" = none ] && + write_function stop : + fi + + if [ "$ini_service_execreload" = '/bin/kill -HUP $MAINPID' -a \ + -z "$run$runpriv" ] + then + printf 'alias do_reload=do_reload_sigusr1\n\n' + elif [ -n "$ini_service_execreload" ] + then + { + write_commands "$chdir" + write_commands "$ini_service_execreload" "$run" "$runpriv" + } | write_function reload_cmd + + cat <<"EOF" +do_reload () +{ + log_daemon_msg "Reloading $DESC configuration files" "$NAME" + MAINPID=$(cat $PIDFILE) + do_reload_cmd_override + log_end_msg $? +} +EOF + fi + + [ "$service_type" = oneshot ] && write_function status : +} + + +# parse command line +while getopts di:n: opt +do + case $opt in + d) debug=1;; + i) instance=$OPTARG;; + n) name=$OPTARG;; + ?) printf "Usage: %s [-d] [-i instance] [-n servicename] [filename]\n" \ + "$0" + exit 2;; + esac +done + +: ${instance=INSTANCE_NAME} +shift $(($OPTIND - 1)) + + +# convert unit file +read_unit "${1:--}" "$instance" +write_init "${name-$inifile_unit_name}" "$instance" + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/doc/Changelog new/sysvinit-2.97/doc/Changelog --- old/sysvinit-2.96/doc/Changelog 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/doc/Changelog 2020-07-07 01:53:15.000000000 +0200 @@ -1,3 +1,25 @@ +sysvinit (2.97) unreleased; urgency=low + + * Check $(ROOT) filesystem for libcrypt instead of a hardcoded path to /usr. + Added logsave and readbootlog to list of files git ignores. + - Patches provided by Petr Ovtchenkov. + + * Code clean-up and making sure we avoid freeing unused memory. + Patch provided by David Hoyer. + + * Added shell script from Trek which converts systemd unit files + into init.d style scripts. + + * Added patch from Didier Gaudin which allows init to load configuration + data from files stored in /etc/inittab.d/ + + * Added patch from William Shipley which allows shutdown time to be specified + in the format +hh:mm. This is in addition to the existing formats such as + hh:mm, +m, and "now". + + * Fixed typos in manual pages. Submitted by Helge Kreutzmann. + + sysvinit (2.96) released; urgency=low [ Jesse Smith ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/man/initscript.5 new/sysvinit-2.97/man/initscript.5 --- old/sysvinit-2.96/man/initscript.5 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/man/initscript.5 2020-07-07 01:53:15.000000000 +0200 @@ -58,7 +58,7 @@ .sp .RE .SH NOTES -This script is not meant as startup script for daemons or somesuch. +This script is not meant as startup script for daemons or services. It has nothing to do with a \fIrc.local\fP style script. It's just a handler for things executed from \fB/etc/inittab\fP. Experimenting with this can make your system un(re)bootable. @@ -68,4 +68,4 @@ .SH AUTHOR Miquel van Smoorenburg ,<[email protected]> .SH "SEE ALSO" -init(8), inittab(5). +inittab(5), init(8). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/man/shutdown.8 new/sysvinit-2.97/man/shutdown.8 --- old/sysvinit-2.96/man/shutdown.8 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/man/shutdown.8 2020-07-07 01:53:15.000000000 +0200 @@ -142,7 +142,9 @@ absolute time in the format \fIhh:mm\fP, in which \fIhh\fP is the hour (1 or 2 digits) and \fImm\fP is the minute of the hour (in two digits). Second, it can be in the format \fB+\fP\fIm\fP, in which \fIm\fP is the -number of minutes to wait. The word \fBnow\fP is an alias for \fB+0\fP. +number of minutes to wait. Third, it can be in the format \fB+\fP\fIhh:mm\fP, +in which \fIhh:mm\fP is the number of hours and minutes to wait. +The word \fBnow\fP is an alias for \fB+0\fP. .PP If shutdown is called with a delay, it will create the advisory file .I /etc/nologin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/src/.gitignore new/sysvinit-2.97/src/.gitignore --- old/sysvinit-2.96/src/.gitignore 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/src/.gitignore 2020-07-07 01:53:15.000000000 +0200 @@ -4,7 +4,9 @@ init killall5 last +logsave mesg +readbootlog runlevel shutdown sulogin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/src/Makefile new/sysvinit-2.97/src/Makefile --- old/sysvinit-2.96/src/Makefile 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/src/Makefile 2020-07-07 01:53:15.000000000 +0200 @@ -90,14 +90,16 @@ endif # Additional libs for GNU libc. -ifneq ($(wildcard /usr/lib*/libcrypt.*),) +ifneq ($(wildcard $(ROOT)/usr/lib*/libcrypt.*),) SULOGINLIBS += -lcrypt endif # Additional libs for GNU libc / multiarch on Debian based systems. -ifneq ($(wildcard /usr/lib/*/libcrypt.*),) +ifneq ($(wildcard $(ROOT)/usr/lib/*/libcrypt.*),) +ifneq ($(findstring -lcrypt, $(SULOGINLIBS)), -lcrypt) SULOGINLIBS += -lcrypt endif +endif all: $(BIN) $(SBIN) $(USRBIN) @@ -201,6 +203,7 @@ $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \ done # $(INSTALL_DIR) $(ROOT)/etc/ + $(INSTALL_DIR) $(ROOT)/etc/inittab.d # $(INSTALL_EXEC) ../doc/initscript.sample $(ROOT)/etc/ ln -sf halt $(ROOT)/sbin/reboot ln -sf halt $(ROOT)/sbin/poweroff diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/src/dowall.c new/sysvinit-2.97/src/dowall.c --- old/sysvinit-2.96/src/dowall.c 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/src/dowall.c 2020-07-07 01:53:15.000000000 +0200 @@ -163,7 +163,7 @@ struct utmp *utmp; time_t t; char term[UT_LINESIZE+ strlen(_PATH_DEV) + 1]; - char line[81]; + char line[256]; char hostname[HOST_NAME_MAX+1]; char *date, *p; char *user, *tty; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/src/init.c new/sysvinit-2.97/src/init.c --- old/sysvinit-2.96/src/init.c 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/src/init.c 2020-07-07 01:53:15.000000000 +0200 @@ -63,6 +63,11 @@ #include <sys/ttydefaults.h> #include <sys/syslog.h> #include <sys/time.h> +/* + * inittab.d + */ +#include <sys/types.h> +#include <dirent.h> #ifdef WITH_SELINUX # include <selinux/selinux.h> @@ -1431,6 +1436,7 @@ void read_inittab(void) { FILE *fp; /* The INITTAB file */ + FILE *fp_tab; /* The INITTABD files */ CHILD *ch, *old, *i; /* Pointers to CHILD structure */ CHILD *head = NULL; /* Head of linked list */ #ifdef INITLVL @@ -1448,7 +1454,10 @@ int round; /* round 0 for SIGTERM, 1 for SIGKILL */ int foundOne = 0; /* No killing no sleep */ int talk; /* Talk to the user */ - int done = 0; /* Ready yet? */ + int done = -1; /* Ready yet? , 2 level : -1 nothing done, 0 inittab done, 1 inittab and inittab.d done */ + DIR *tabdir=NULL; /* the INITTAB.D dir */ + struct dirent *file_entry; /* inittab.d entry */ + char f_name[272]; /* size d_name + strlen /etc/inittad.d/ */ #if DEBUG if (newFamily != NULL) { @@ -1464,22 +1473,73 @@ if ((fp = fopen(INITTAB, "r")) == NULL) initlog(L_VB, "No inittab file found"); - while(!done) { + /* + * Open INITTAB.D directory + */ + if( (tabdir = opendir(INITTABD))==NULL) + initlog(L_VB, "No inittab.d directory found"); + + while(done!=1) { /* * Add single user shell entry at the end. */ - if (fp == NULL || fgets(buf, sizeof(buf), fp) == NULL) { - done = 1; - /* - * See if we have a single user entry. - */ - for(old = newFamily; old; old = old->next) - if (strpbrk(old->rlevel, "S")) break; - if (old == NULL) - snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", SULOGIN); - else + if(done == -1) { + if (fp == NULL || fgets(buf, sizeof(buf), fp) == NULL) { + done = 0; + /* + * See if we have a single user entry. + */ + for(old = newFamily; old; old = old->next) + if (strpbrk(old->rlevel, "S")) break; + if (old == NULL) + snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", SULOGIN); + else + continue; + } + } /* end if( done==-1) */ + else if ( done == 0 ){ + /* parse /etc/inittab.d and read all .tab files */ + if(tabdir!=NULL){ + if( (file_entry = readdir(tabdir))!=NULL){ + /* ignore files not like *.tab */ + if (!strcmp(file_entry->d_name, ".") || !strcmp(file_entry->d_name, "..")) + continue; + if (strlen(file_entry->d_name) < 5 || strcmp(file_entry->d_name + strlen(file_entry->d_name) - 4, ".tab")) + continue; + /* + * initialize filename + */ + memset(f_name,0,sizeof(char)*272); + snprintf(f_name,272,"/etc/inittab.d/%s",file_entry->d_name); + initlog(L_VB, "Reading: %s",f_name); + /* + * read file in inittab.d only one entry per file + */ + if ((fp_tab = fopen(f_name, "r")) == NULL) + continue; + /* read the file while the line contain comment */ + while( fgets(buf, sizeof(buf), fp_tab) != NULL) { + for(p = buf; *p == ' ' || *p == '\t'; p++); + if (*p != '#' && *p != '\n') + break; + } + fclose(fp_tab); + /* do some checks */ + if( buf == NULL ) + continue; + if( strlen( p ) == 0 ) + continue; + } /* end of readdir, all is done */ + else { + done = 1; + continue; + } + } /* end of if(tabdir!=NULL) */ + else { + done = 1; continue; - } + } + } /* end of if ( done == 0 ) */ lineNo++; /* * Skip comments and empty lines @@ -1630,10 +1690,12 @@ break; } } + /* * We're done. */ if (fp) fclose(fp); + if(tabdir) closedir(tabdir); #ifdef __linux__ check_kernel_console(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/src/killall5.c new/sysvinit-2.97/src/killall5.c --- old/sysvinit-2.96/src/killall5.c 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/src/killall5.c 2020-07-07 01:53:15.000000000 +0200 @@ -513,7 +513,7 @@ if (p->argv0) free(p->argv0); if (p->argv1) free(p->argv1); if (p->statname) free(p->statname); - free(p->pathname); + if (p->pathname) free(p->pathname); free(p); } plist = NULL; @@ -562,7 +562,7 @@ if (p->argv0) free(p->argv0); if (p->argv1) free(p->argv1); if (p->statname) free(p->statname); - free(p->pathname); + if (p->pathname) free(p->pathname); free(p); continue; } @@ -578,19 +578,12 @@ /* Get session, startcode, endcode. */ startcode = endcode = 0; - /* - if (sscanf(q, "%*c %*d %*d %d %*d %*d %*u %*u " + if (sscanf(q, "%10s %*d %*d %d %*d %*d %*u %*u " "%*u %*u %*u %*u %*u %*d %*d " "%*d %*d %*d %*d %*u %*u %*d " "%*u %lu %lu", - &p->sid, &startcode, &endcode) != 3) { - */ - if (sscanf(q, "%10s %*d %*d %d %*d %*d %*u %*u " - "%*u %*u %*u %*u %*u %*d %*d " - "%*d %*d %*d %*d %*u %*u %*d " - "%*u %lu %lu", - process_status, - &p->sid, &startcode, &endcode) != 4) { + process_status, + &p->sid, &startcode, &endcode) != 4) { p->sid = 0; nsyslog(LOG_ERR, "can't read sid from %s\n", @@ -624,7 +617,7 @@ if (p->argv0) free(p->argv0); if (p->argv1) free(p->argv1); if (p->statname) free(p->statname); - free(p->pathname); + if (p->pathname) free(p->pathname); free(p); continue; } @@ -672,7 +665,7 @@ if (p->argv0) free(p->argv0); if (p->argv1) free(p->argv1); if (p->statname) free(p->statname); - free(p->pathname); + if (p->pathname) free(p->pathname); free(p); continue; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/src/paths.h new/sysvinit-2.97/src/paths.h --- old/sysvinit-2.96/src/paths.h 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/src/paths.h 2020-07-07 01:53:15.000000000 +0200 @@ -27,6 +27,7 @@ #define SECURETTY "/etc/securetty" /* List of root terminals */ #define SDALLOW "/etc/shutdown.allow" /* Users allowed to shutdown */ #define INITTAB "/etc/inittab" /* Location of inittab */ +#define INITTABD "/etc/inittab.d" /* Location of inittab.d directory */ #define INIT "/sbin/init" /* Location of init itself. */ #define NOLOGIN "/etc/nologin" /* Stop user logging in. */ #define FASTBOOT "/fastboot" /* Enable fast boot. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysvinit-2.96/src/shutdown.c new/sysvinit-2.97/src/shutdown.c --- old/sysvinit-2.96/src/shutdown.c 2019-09-11 19:43:12.000000000 +0200 +++ new/sysvinit-2.97/src/shutdown.c 2020-07-07 01:53:15.000000000 +0200 @@ -788,13 +788,21 @@ wt = atoi(when); if (wt == 0 && when[0] != '0') usage(); } else { - /* Time in hh:mm format. */ if (sscanf(when, "%d:%2d", &hours, &mins) != 2) usage(); - if (hours > 23 || mins > 59) usage(); - time(&t); - lt = localtime(&t); - wt = (60*hours + mins) - (60*lt->tm_hour + lt->tm_min); - if (wt < 0) wt += 1440; + /* Time in hh:mm format. */ + if (when[0] == '+') { + /* Hours and minutes from now */ + if (hours > 99999 || mins > 59) usage(); + wt = (60*hours + mins); + if (wt < 0) usage(); + } else { + /* Time of day */ + if (hours > 23 || mins > 59) usage(); + time(&t); + lt = localtime(&t); + wt = (60*hours + mins) - (60*lt->tm_hour + lt->tm_min); + if (wt < 0) wt += 1440; + } } /* Shutdown NOW if time == 0 */ if (wt == 0) issue_shutdown(halttype);
