diff options
Diffstat (limited to 'source/a/sysvinit')
-rw-r--r-- | source/a/sysvinit/doinst.sh | 48 | ||||
-rw-r--r-- | source/a/sysvinit/slack-desc | 19 | ||||
-rw-r--r-- | source/a/sysvinit/sysvinit-2.86-timeval.patch | 42 | ||||
-rwxr-xr-x | source/a/sysvinit/sysvinit.SlackBuild | 115 | ||||
-rw-r--r-- | source/a/sysvinit/sysvinit.diff | 125 | ||||
-rw-r--r-- | source/a/sysvinit/sysvinit.pidof.rhforkseverything.diff | 81 |
6 files changed, 430 insertions, 0 deletions
diff --git a/source/a/sysvinit/doinst.sh b/source/a/sysvinit/doinst.sh new file mode 100644 index 00000000..0e476e11 --- /dev/null +++ b/source/a/sysvinit/doinst.sh @@ -0,0 +1,48 @@ + +config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +# RH functions: +#config etc/rc.d/init.d/halt.new +#config etc/rc.d/init.d/killall.new +#config etc/rc.d/init.d/netfs.new +#config etc/rc.d/init.d/network.new +#config etc/rc.d/init.d/single.new + +if [ -r sbin/init ]; then + mv sbin/init sbin/init.old +fi + +mv sbin/init.new sbin/init + +# Add a btmp file to store login failure if one doesn't exist: +if [ ! -r var/log/btmp ]; then + ( cd var/log ; umask 077 ; touch btmp ) +fi + +# Notice we use an absolute path below, rather than usr/bin/last. This is because +# we're testing to see if we are on the bootdisk, which will not have /usr/bin/last. +# If we aren't, we will signal init to restart using the new binary. +# The presence of "/etc/slack-installer" is under consideration as a better test. +if [ -x /usr/bin/last -a ! -r /etc/slack-installer ]; then + /sbin/init u +fi + +( cd sbin ; rm -rf telinit ) +( cd sbin ; ln -sf init telinit ) +( cd sbin ; rm -rf reboot ) +( cd sbin ; ln -sf halt reboot ) +( cd sbin ; rm -rf pidof ) +( cd sbin ; ln -sf killall5 pidof ) +( cd sbin ; rm -rf poweroff ) +( cd sbin ; ln -sf halt poweroff ) + +rm -f sbin/init.old diff --git a/source/a/sysvinit/slack-desc b/source/a/sysvinit/slack-desc new file mode 100644 index 00000000..5fc2652c --- /dev/null +++ b/source/a/sysvinit/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +sysvinit: sysvinit (init, the parent of all processes) +sysvinit: +sysvinit: System V style init programs by Miquel van Smoorenburg that control +sysvinit: the booting and shutdown of your system. These support a number of +sysvinit: system runlevels, each with a specific set of utilities spawned. +sysvinit: For example, the normal system runlevel is 3, which starts agetty +sysvinit: on virtual consoles tty1 - tty6. Runlevel 4 starts xdm. +sysvinit: Runlevel 0 shuts the system down. +sysvinit: +sysvinit: +sysvinit: diff --git a/source/a/sysvinit/sysvinit-2.86-timeval.patch b/source/a/sysvinit/sysvinit-2.86-timeval.patch new file mode 100644 index 00000000..acb0d5b6 --- /dev/null +++ b/source/a/sysvinit/sysvinit-2.86-timeval.patch @@ -0,0 +1,42 @@ +--- sysvinit-2.86/src/utmp.c.timeval 1999-06-09 07:11:33.000000000 -0400 ++++ sysvinit-2.86/src/utmp.c 2006-08-09 19:46:26.000000000 -0400 +@@ -47,7 +47,8 @@ + int fd; + struct utmp utmp; + struct utsname uname_buf; +- ++ struct timeval tv; ++ + /* + * Try to open the wtmp file. Note that we even try + * this if we have updwtmp() so we can see if the +@@ -76,7 +77,9 @@ + */ + memset(&utmp, 0, sizeof(utmp)); + #if defined(__GLIBC__) +- gettimeofday(&utmp.ut_tv, NULL); ++ 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 +@@ -113,6 +116,7 @@ + struct utmp utmp; + struct utmp tmp; + struct utmp *utmptr; ++ struct timeval tv; + + /* + * Can't do much if UTMP_FILE is not present. +@@ -144,7 +148,9 @@ + utmp.ut_pid = pid; + strncpy(utmp.ut_id, id, sizeof(utmp.ut_id)); + #if defined(__GLIBC__) +- gettimeofday(&utmp.ut_tv, NULL); ++ 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 diff --git a/source/a/sysvinit/sysvinit.SlackBuild b/source/a/sysvinit/sysvinit.SlackBuild new file mode 100755 index 00000000..4916e695 --- /dev/null +++ b/source/a/sysvinit/sysvinit.SlackBuild @@ -0,0 +1,115 @@ +#!/bin/sh + +# Copyright 2005-2009 Patrick J. Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +VERSION=${VERSION:-2.86} +ARCH=${ARCH:-x86_64} +BUILD=${BUILD:-6} + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-sysvinit + +rm -rf $PKG +mkdir -p $TMP $PKG + +cd $TMP +rm -rf sysvinit-$VERSION +tar xzvf $CWD/sysvinit-$VERSION.tar.gz || exit 1 +cd sysvinit-$VERSION +chown -R root:root . +zcat $CWD/sysvinit.diff.gz | patch -p1 -E --verbose --backup --suffix=.orig || exit 1 +zcat $CWD/sysvinit.pidof.rhforkseverything.diff.gz | patch -p1 -E --verbose --backup --suffix=.orig || exit 1 +if [ "$ARCH" = "x86_64" ]; then + # Don't overwrite ut_addr_v6 in utmp records on 64-bit platforms + zcat $CWD/sysvinit-2.86-timeval.diff.gz | patch -p1 -E --verbose --backup --suffix=.orig || exit 1 +fi + +cd doc +mkdir -p $PKG/usr/doc/sysvinit-$VERSION +cp -a Install Propaganda sysvinit-$VERSION.lsm \ + $PKG/usr/doc/sysvinit-$VERSION +chmod -R 644 $PKG/usr/doc/sysvinit-$VERSION/* +chmod 755 $PKG/usr/doc/sysvinit-$VERSION + +cd ../src +if [ "$ARCH" = "x86_64" ]; then + # static 'init' segfaults, so your computer never reaches command prompt: + sed -i -e "s/-static//" Makefile +fi +make clobber +make || exit 1 + +mkdir -p $PKG/sbin +for program in bootlogd halt init killall5 shutdown runlevel ; do + strip --strip-unneeded $program + cat $program > $PKG/sbin/$program + chmod 755 $PKG/sbin/$program + chown root:root $PKG/sbin/$program +done +mkdir -p $PKG/usr/bin +for program in last mountpoint ; do + strip --strip-unneeded $program + cat $program > $PKG/usr/bin/$program + chmod 755 $PKG/usr/bin/$program + chown root:root $PKG/usr/bin/$program +done +( cd $PKG/usr/bin ; ln -sf last lastb ) +mv $PKG/sbin/init $PKG/sbin/init.new +chmod 755 $PKG/sbin/init.new +chown root:root $PKG/sbin/init.new + +# This version is old. We use genpower now. +#cat wall > $PKG/usr/bin/wall +#strip --strip-unneeded powerd +#cat powerd > $PKG/sbin/powerd +#chmod 755 $PKG/usr/bin/wall $PKG/sbin/powerd +#chown root:root $PKG/usr/bin/wall $PKG/sbin/powerd +cp initscript.sample $PKG/sbin/initscript.sample + +cd ../man +mkdir -p $PKG/usr/man/man{1,5,8} +for page in last.1 mountpoint.1 ; do + cat $page | gzip -9c > $PKG/usr/man/man1/$page.gz +done +for page in inittab.5 initscript.5 ; do + cat $page | gzip -9c > $PKG/usr/man/man5/$page.gz +done +for page in halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8 \ + shutdown.8 telinit.8 bootlogd.8 ; do + cat $page | gzip -9c > $PKG/usr/man/man8/$page.gz +done +( cd $PKG/usr/man/man1 ; ln -sf last.1.gz lastb.1.gz ) + +mkdir -p $PKG/install +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +# Build the package: +cd $PKG +makepkg -l y -c n $TMP/sysvinit-$VERSION-$ARCH-$BUILD.txz + +# Clean up the extra stuff: +if [ "$1" = "--cleanup" ]; then + rm -rf $TMP/sysvinit-$VERSION + rm -rf $PKG +fi diff --git a/source/a/sysvinit/sysvinit.diff b/source/a/sysvinit/sysvinit.diff new file mode 100644 index 00000000..11477be7 --- /dev/null +++ b/source/a/sysvinit/sysvinit.diff @@ -0,0 +1,125 @@ +diff -Naur sysvinit-2.86.orig/man/init.8 sysvinit-2.86/man/init.8 +--- sysvinit-2.86.orig/man/init.8 2004-07-29 13:21:31.000000000 +0200 ++++ sysvinit-2.86/man/init.8 2007-12-23 12:22:51.000000000 +0100 +@@ -76,7 +76,7 @@ + are processed. + .PP + When starting a new process, \fBinit\fP first checks whether the file +-\fI/etc/initscript\fP exists. If it does, it uses this script to ++\fI/sbin/initscript\fP exists. If it does, it uses this script to + start the process. + .PP + Each time a child terminates, \fBinit\fP records the fact and the reason +@@ -240,7 +240,7 @@ + .SH FILES + .nf + /etc/inittab +-/etc/initscript ++/sbin/initscript + /dev/console + /var/run/utmp + /var/log/wtmp +diff -Naur sysvinit-2.86.orig/man/initscript.5 sysvinit-2.86/man/initscript.5 +--- sysvinit-2.86.orig/man/initscript.5 2004-06-09 14:47:45.000000000 +0200 ++++ sysvinit-2.86/man/initscript.5 2007-12-23 12:22:51.000000000 +0100 +@@ -2,15 +2,15 @@ + .SH NAME + initscript \- script that executes inittab commands. + .SH SYNOPSIS +-/bin/sh /etc/initscript id runlevels action process ++/bin/sh /sbin/initscript id runlevels action process + .SH DESCRIPTION +-When the shell script \fI/etc/initscript\fP is present, \fBinit\fP ++When the shell script \fI/sbin/initscript\fP is present, \fBinit\fP + will use it to execute the commands from \fIinittab\fP. + This script can be used to set things like \fBulimit\fP and + \fBumask\fP default values for every process. + .SH EXAMPLES + This is a sample initscript, which might be installed on your +-system as \fI/etc/initscript.sample\fP. ++system as \fI/sbin/initscript.sample\fP. + .RS + .sp + .nf +@@ -20,7 +20,7 @@ + # initscript Executed by init(8) for every program it + # wants to spawn like this: + # +-# /bin/sh /etc/initscript <id> <level> <action> <process> ++# /bin/sh /sbin/initscript <id> <level> <action> <process> + # + + # Set umask to safe level, and enable core dumps. +@@ -48,7 +48,7 @@ + .RE + .SH FILES + /etc/inittab, +-/etc/initscript. ++/sbin/initscript. + .SH AUTHOR + Miquel van Smoorenburg ,<miquels@cistron.nl> + .SH "SEE ALSO" +diff -Naur sysvinit-2.86.orig/src/Makefile sysvinit-2.86/src/Makefile +--- sysvinit-2.86.orig/src/Makefile 2004-06-09 14:47:45.000000000 +0200 ++++ sysvinit-2.86/src/Makefile 2007-12-23 12:22:51.000000000 +0100 +@@ -11,7 +11,7 @@ + CC = gcc + CFLAGS = -Wall -O2 -fomit-frame-pointer -D_GNU_SOURCE + LDFLAGS = -s +-STATIC = ++STATIC = -static + + # For some known distributions we do not build all programs, otherwise we do. + BIN = +diff -Naur sysvinit-2.86.orig/src/initscript.sample sysvinit-2.86/src/initscript.sample +--- sysvinit-2.86.orig/src/initscript.sample 1997-11-26 14:06:33.000000000 +0100 ++++ sysvinit-2.86/src/initscript.sample 2007-12-23 12:22:51.000000000 +0100 +@@ -1,14 +1,14 @@ + # +-# initscript If this script is intalled as /etc/initscript, ++# initscript If this script is intalled as /sbin/initscript, + # it is executed by init(8) for every program it + # wants to spawn like this: + # +-# /bin/sh /etc/initscript <id> <level> <action> <process> ++# /bin/sh /sbin/initscript <id> <level> <action> <process> + # + # It can be used to set the default umask and ulimit + # of all processes. By default this script is installed +-# as /etc/initscript.sample, so to enable it you must +-# rename this script first to /etc/initscript. ++# as /sbin/initscript.sample, so to enable it you must ++# rename this script first to /sbin/initscript. + # + # Version: @(#)initscript 1.10 10-Dec-1995 MvS. + # +diff -Naur sysvinit-2.86.orig/src/paths.h sysvinit-2.86/src/paths.h +--- sysvinit-2.86.orig/src/paths.h 2004-06-09 14:47:45.000000000 +0200 ++++ sysvinit-2.86/src/paths.h 2007-12-23 12:23:50.000000000 +0100 +@@ -20,21 +20,21 @@ + #define INITTAB "/etc/inittab" /* Location of inittab */ + #define INIT "/sbin/init" /* Location of init itself. */ + #define NOLOGIN "/etc/nologin" /* Stop user logging in. */ +-#define FASTBOOT "/fastboot" /* Enable fast boot. */ +-#define FORCEFSCK "/forcefsck" /* Force fsck on boot */ ++#define FASTBOOT "/etc/fastboot" /* Enable fast boot. */ ++#define FORCEFSCK "/etc/forcefsck" /* Force fsck on boot */ + #define SDPID "/var/run/shutdown.pid" /* PID of shutdown program */ + #define SHELL "/bin/sh" /* Default shell */ + #define SULOGIN "/sbin/sulogin" /* Sulogin */ +-#define INITSCRIPT "/etc/initscript" /* Initscript. */ ++#define INITSCRIPT "/sbin/initscript" /* Initscript. */ + #define PWRSTAT "/etc/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */ + + #if 0 + #define INITLVL "/etc/initrunlvl" /* COMPAT: New runlevel */ + #define INITLVL2 "/var/log/initrunlvl" /* COMPAT: New runlevel */ + /* Note: INITLVL2 definition needs INITLVL */ +-#define HALTSCRIPT1 "/etc/init.d/halt" /* Called by "fast" shutdown */ ++#define HALTSCRIPT1 "/etc/init.d/rc.halt" /* Called by "fast" shutdown */ + #define HALTSCRIPT2 "/etc/rc.d/rc.0" /* Called by "fast" shutdown */ +-#define REBOOTSCRIPT1 "/etc/init.d/reboot" /* Ditto. */ ++#define REBOOTSCRIPT1 "/etc/init.d/rc.reboot" /* Ditto. */ + #define REBOOTSCRIPT2 "/etc/rc.d/rc.6" /* Ditto. */ + #endif + diff --git a/source/a/sysvinit/sysvinit.pidof.rhforkseverything.diff b/source/a/sysvinit/sysvinit.pidof.rhforkseverything.diff new file mode 100644 index 00000000..db94dcf1 --- /dev/null +++ b/source/a/sysvinit/sysvinit.pidof.rhforkseverything.diff @@ -0,0 +1,81 @@ +--- sysvinit-2.86/man/pidof.8.chroot 1998-09-02 08:49:33.000000000 -0400 ++++ sysvinit-2.86/man/pidof.8 2005-12-19 15:37:40.000000000 -0500 +@@ -4,6 +4,7 @@ + .SH SYNOPSIS + .B pidof + .RB [ \-s ] ++.RB [ \-c ] + .RB [ \-x ] + .RB [ \-o + .IR omitpid ] +@@ -24,6 +25,10 @@ + .SH OPTIONS + .IP -s + Single shot - this instructs the program to only return one \fIpid\fP. ++.IP -c ++Only return process ids that are running with the same root directory. ++This option does not make sense for non-root users, as they will be ++unable to check the current root directory of processes they do not own. + .IP -x + Scripts too - this causes the program to also return process id's of + shells running the named scripts. +--- sysvinit-2.86/src/killall5.c.chroot 2004-07-30 08:16:23.000000000 -0400 ++++ sysvinit-2.86/src/killall5.c 2005-12-19 15:38:47.000000000 -0500 +@@ -476,16 +476,22 @@ + int f; + int first = 1; + int i, oind, opt, flags = 0; ++ int chroot_check = 0; ++ struct stat st; ++ char tmp[512]; + + for (oind = PIDOF_OMITSZ-1; oind > 0; oind--) + opid[oind] = 0; + opterr = 0; + +- while ((opt = getopt(argc,argv,"ho:sx")) != EOF) switch (opt) { ++ while ((opt = getopt(argc,argv,"hco:sx")) != EOF) switch (opt) { + case '?': + nsyslog(LOG_ERR,"invalid options on command line!\n"); + closelog(); + exit(1); ++ case 'c': ++ chroot_check = 1; ++ break; + case 'o': + if (oind >= PIDOF_OMITSZ -1) { + nsyslog(LOG_ERR,"omit pid buffer size %d " +@@ -518,6 +524,16 @@ + argc -= optind; + argv += optind; + ++ /* Check if we are in a chroot */ ++ if (chroot_check) { ++ snprintf(tmp, 512, "/proc/%d/root", getpid()); ++ if (stat(tmp, &st) < 0) { ++ nsyslog(LOG_ERR, "stat failed for %s!\n", tmp); ++ closelog(); ++ exit(1); ++ } ++ } ++ + /* Print out process-ID's one by one. */ + readproc(); + for(f = 0; f < argc; f++) { +@@ -541,6 +557,16 @@ + else + spid = 1; + } ++ if (chroot_check) { ++ struct stat st2; ++ snprintf(tmp, 512, "/proc/%d/root", ++ p->pid); ++ if (stat(tmp, &st2) < 0 || ++ st.st_dev != st2.st_dev || ++ st.st_ino != st2.st_ino) { ++ continue; ++ } ++ } + if (!first) + printf(" "); + printf("%d", p->pid); |