Sorry about that. My editor died during an xterm resize, and somehow reportbug interpreted that to mean "send immediately!", which it did.

In bug #26784, it was discussed whether /sbin/init should be statically-compiled. Nothing came of it (which is good; I don't think it should be statically-compiled on every installed machine). However, I have a situation where I need to umount the partition that /sbin is on, and init is the only process left with files open on that partition. In that situation, I created a package (sysvinit-static) with statically-compiled init and sulogin that diverts the original dynamically-compiled init/sulogin out of the way.

Attached is a diff against the current 2.86.ds1-4.

RF
diff -r -u -N sysvinit-2.86.ds1.orig/debian/control 
sysvinit-2.86.ds1/debian/control
--- sysvinit-2.86.ds1.orig/debian/control       2005-11-09 01:12:08.000000000 
-0800
+++ sysvinit-2.86.ds1/debian/control    2005-11-09 01:12:52.000000000 -0800
@@ -20,6 +20,18 @@
  your system. All processes are descended from init. For more information,
  see the manual page init(8).
 
+Package: sysvinit-static
+Architecture: any
+Pre-Depends: sysvinit
+Depends: coreutils
+Replaces: sysvinit
+Description: System-V like init (static binaries)
+ Init is the first program to run after your system is booted, and
+ continues to run as process number 1 until your system halts. Init's
+ job is to start other programs that are essential to the operation of
+ your system. All processes are descended from init. For more information,
+ see the manual page init(8).
+
 Package: sysv-rc
 Architecture: all
 Conflicts: file-rc
diff -r -u -N sysvinit-2.86.ds1.orig/debian/rules sysvinit-2.86.ds1/debian/rules
--- sysvinit-2.86.ds1.orig/debian/rules 2005-11-09 01:12:08.000000000 -0800
+++ sysvinit-2.86.ds1/debian/rules      2005-11-09 01:18:45.000000000 -0800
@@ -98,6 +98,26 @@
        dpkg --build $(tmp) ..
        rm -rf $(tmp)
        #
+       #       Static Sysvinit.
+       #
+       (cd src; make clean)
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+       (cd src; make STATIC=-static DISTRO=Debian WITH_SELINUX="yes" init 
sulogin)
+else
+       (cd src; make STATIC=-static DISTRO=Debian init sulogin)
+endif
+       -rm -rf $(tmp)
+       install -d -g root -m 755 -o root $(tmp)
+       install -d -g root -m 755 -o root $(tmp)/DEBIAN
+       install -d -g root -m 755 -o root $(tmp)/sbin
+       install -g root -m 755 -o root src/init $(tmp)/sbin/init
+       install -g root -m 755 -o root src/sulogin $(tmp)/sbin/sulogin
+       install -g root -m 755 debian/sysvinit-static/preinst 
$(tmp)/DEBIAN/preinst
+       install -g root -m 755 debian/sysvinit-static/postrm 
$(tmp)/DEBIAN/postrm
+       dpkg-gencontrol -psysvinit-static -P$(tmp) -isp
+       dpkg --build $(tmp) ..
+       rm -rf $(tmp)
+       #
        #       Initscripts.
        #
        -rm -rf $(tmp)
diff -r -u -N sysvinit-2.86.ds1.orig/debian/sysvinit-static/postrm 
sysvinit-2.86.ds1/debian/sysvinit-static/postrm
--- sysvinit-2.86.ds1.orig/debian/sysvinit-static/postrm        1969-12-31 
16:00:00.000000000 -0800
+++ sysvinit-2.86.ds1/debian/sysvinit-static/postrm     2005-11-09 
01:12:52.000000000 -0800
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+       if [ remove = "$1" ]; then
+          dpkg-divert --package sysvinit-static --remove --rename \
+             --divert /sbin/init.dyn /sbin/init
+          dpkg-divert --package sysvinit-static --remove --rename \
+             --divert /sbin/sulogin.dyn /sbin/sulogin
+       fi
diff -r -u -N sysvinit-2.86.ds1.orig/debian/sysvinit-static/preinst 
sysvinit-2.86.ds1/debian/sysvinit-static/preinst
--- sysvinit-2.86.ds1.orig/debian/sysvinit-static/preinst       1969-12-31 
16:00:00.000000000 -0800
+++ sysvinit-2.86.ds1/debian/sysvinit-static/preinst    2005-11-09 
01:12:52.000000000 -0800
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+       if [ install = "$1"  ]; then
+          dpkg-divert --package sysvinit-static --add --rename \
+             --divert /sbin/init.dyn /sbin/init
+          dpkg-divert --package sysvinit-static --add --rename \
+             --divert /sbin/sulogin.dyn /sbin/sulogin
+       fi

Reply via email to