System ist mittels LFS Bootscripte startbar.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sat, 2 Dec 2006 22:38:39 +0000 (22:38 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sat, 2 Dec 2006 22:38:39 +0000 (22:38 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@354 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

39 files changed:
config/etc/fstab
config/etc/inittab
config/rootfiles/common/initscripts
config/rootfiles/common/ncurses
config/rootfiles/common/procps
config/rootfiles/common/setup [new file with mode: 0644]
config/rootfiles/common/slang [new file with mode: 0644]
config/rootfiles/common/stage2
config/rootfiles/common/util-linux
doc/packages-list.txt
lfs/cdrom
lfs/initscripts
lfs/udev
make.sh
src/initscripts/init.d/checkfs [new file with mode: 0644]
src/initscripts/init.d/cleanfs [new file with mode: 0644]
src/initscripts/init.d/console [new file with mode: 0644]
src/initscripts/init.d/functions [new file with mode: 0644]
src/initscripts/init.d/halt [new file with mode: 0644]
src/initscripts/init.d/localnet [new file with mode: 0644]
src/initscripts/init.d/modules [new file with mode: 0644]
src/initscripts/init.d/mountfs [new file with mode: 0644]
src/initscripts/init.d/mountkernfs [new file with mode: 0644]
src/initscripts/init.d/rc [new file with mode: 0644]
src/initscripts/init.d/reboot [new file with mode: 0644]
src/initscripts/init.d/sendsignals [new file with mode: 0644]
src/initscripts/init.d/setclock [new file with mode: 0644]
src/initscripts/init.d/swap [new file with mode: 0644]
src/initscripts/init.d/sysctl [new file with mode: 0644]
src/initscripts/init.d/sysklogd [new file with mode: 0644]
src/initscripts/init.d/template [new file with mode: 0644]
src/initscripts/init.d/udev [new file with mode: 0644]
src/initscripts/init.d/udev_retry [new file with mode: 0644]
src/initscripts/sysconfig/clock [new file with mode: 0644]
src/initscripts/sysconfig/createfiles [new file with mode: 0644]
src/initscripts/sysconfig/modules [new file with mode: 0644]
src/initscripts/sysconfig/network [new file with mode: 0644]
src/initscripts/sysconfig/rc [new file with mode: 0644]
src/install+setup/install/main.c

index ba5a7f3..5ec3489 100644 (file)
@@ -1,8 +1,14 @@
-#
-# $Id: fstab,v 1.4 2006/02/11 15:42 ms Exp $
-#
-/dev/harddisk1         /boot                   ext3    nodev,nosuid,noatime,data=journal               1 2
-/dev/harddisk2         /var/log                ext3    nodev,nosuid,noatime,data=journal               1 2
-/dev/harddisk4          /                       ext3    noatime                1 1
-none                    /proc                   proc    defaults        0 0
-none                   /dev/pts                devpts  gid=5,mode=620  0 0
+# Begin /etc/fstab
+
+# file system  mount-point  type     options         dump  fsck
+#                                                        order
+
+DEVICE1        /boot        ext2     defaults        1     2
+DEVICE2        swap         swap     pri=1           0     0
+DEVICE3        /            reiserfs defaults        1     1
+DEVICE4        /var         reiserfs defaults        1     1
+proc           /proc        proc     defaults        0     0
+sysfs          /sys         sysfs    defaults        0     0
+devpts         /dev/pts     devpts   gid=4,mode=620  0     0
+shm            /dev/shm     tmpfs    defaults        0     0
+# End /etc/fstab
index d699e10..7697daa 100644 (file)
@@ -1,19 +1,24 @@
 #
 # IPFire inittab
 #
+# Begin /etc/inittab
+
 id:3:initdefault:
 
-l0:0:wait:/etc/rc.d/rc.halt halt
-l6:6:wait:/etc/rc.d/rc.halt reboot
+si::sysinit:/etc/rc.d/init.d/rc sysinit
 
-si::sysinit:/etc/rc.d/rc.sysinit
+l0:0:wait:/etc/rc.d/init.d/rc 0
+l1:S1:wait:/etc/rc.d/init.d/rc 1
+l2:2:wait:/etc/rc.d/init.d/rc 2
+l3:3:wait:/etc/rc.d/init.d/rc 3
+l4:4:wait:/etc/rc.d/init.d/rc 4
+l5:5:wait:/etc/rc.d/init.d/rc 5
+l6:6:wait:/etc/rc.d/init.d/rc 6
 
-# Trap CTRL-ALT-DELETE
 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
 
 su:S016:once:/sbin/sulogin
 
-# Run gettys in standard runlevels
 1:2345:respawn:/sbin/agetty tty1 9600
 2:2345:respawn:/sbin/agetty tty2 9600
 3:2345:respawn:/sbin/agetty tty3 9600
@@ -21,5 +26,4 @@ su:S016:once:/sbin/sulogin
 5:2345:respawn:/sbin/agetty tty5 9600
 6:2345:respawn:/sbin/agetty tty6 9600
 
-# Going single user mode for maintenance
-xx:S1:respawn:/bin/bash
+# End /etc/inittab
index dfdd575..1898fec 100644 (file)
@@ -63,3 +63,56 @@ etc/rc.d
 #etc/rc.d/rc.red
 #etc/rc.d/rc.sysinit
 #etc/rc.d/rc.updatered
+etc/rc.d/init.d/checkfs
+etc/rc.d/init.d/cleanfs
+etc/rc.d/init.d/console
+etc/rc.d/init.d/functions
+etc/rc.d/init.d/halt
+etc/rc.d/init.d/localnet
+etc/rc.d/init.d/modules
+etc/rc.d/init.d/mountfs
+etc/rc.d/init.d/mountkernfs
+etc/rc.d/init.d/rc
+etc/rc.d/init.d/reboot
+etc/rc.d/init.d/sendsignals
+etc/rc.d/init.d/setclock
+etc/rc.d/init.d/swap
+etc/rc.d/init.d/sysctl
+etc/rc.d/init.d/sysklogd
+etc/rc.d/init.d/template
+etc/rc.d/init.d/udev
+etc/rc.d/init.d/udev_retry
+etc/rc.d/rc0.d/K90sysklogd
+etc/rc.d/rc0.d/S60sendsignals
+etc/rc.d/rc0.d/S70mountfs
+etc/rc.d/rc0.d/S80swap
+etc/rc.d/rc0.d/S90localnet
+etc/rc.d/rc0.d/S99halt
+etc/rc.d/rc1.d/K90sysklogd
+etc/rc.d/rc2.d/K90sysklogd
+etc/rc.d/rc3.d/S10sysklogd
+etc/rc.d/rc4.d/S10sysklogd
+etc/rc.d/rc5.d/S10sysklogd
+etc/rc.d/rc6.d/K90sysklogd
+etc/rc.d/rc6.d/S60sendsignals
+etc/rc.d/rc6.d/S70mountfs
+etc/rc.d/rc6.d/S80swap
+etc/rc.d/rc6.d/S90localnet
+etc/rc.d/rc6.d/S99reboot
+etc/rc.d/rcsysinit.d/S00mountkernfs
+etc/rc.d/rcsysinit.d/S05modules
+etc/rc.d/rcsysinit.d/S10udev
+etc/rc.d/rcsysinit.d/S20swap
+etc/rc.d/rcsysinit.d/S30checkfs
+etc/rc.d/rcsysinit.d/S40mountfs
+etc/rc.d/rcsysinit.d/S45udev_retry
+etc/rc.d/rcsysinit.d/S50cleanfs
+etc/rc.d/rcsysinit.d/S60setclock
+etc/rc.d/rcsysinit.d/S70console
+etc/rc.d/rcsysinit.d/S80localnet
+etc/rc.d/rcsysinit.d/S90sysctl
+etc/sysconfig/createfiles
+etc/sysconfig/modules
+etc/sysconfig/rc
+etc/sysconfig/clock
+etc/sysconfig/network
index 27bb6bd..e5a5319 100644 (file)
@@ -1947,16 +1947,16 @@ usr/lib/libpanel.so
 #usr/share/terminfo/l/layer
 #usr/share/terminfo/l/lft
 #usr/share/terminfo/l/lft-pc850
-#usr/share/terminfo/l/linux
-#usr/share/terminfo/l/linux-basic
+usr/share/terminfo/l/linux
+usr/share/terminfo/l/linux-basic
 #usr/share/terminfo/l/linux-c
 #usr/share/terminfo/l/linux-c-nc
 #usr/share/terminfo/l/linux-koi8
 #usr/share/terminfo/l/linux-koi8r
-#usr/share/terminfo/l/linux-lat
-#usr/share/terminfo/l/linux-m
-#usr/share/terminfo/l/linux-nic
-#usr/share/terminfo/l/linux-vt
+usr/share/terminfo/l/linux-lat
+usr/share/terminfo/l/linux-m
+usr/share/terminfo/l/linux-nic
+usr/share/terminfo/l/linux-vt
 #usr/share/terminfo/l/lisa
 #usr/share/terminfo/l/lisaterm
 #usr/share/terminfo/l/lisaterm-w
@@ -3198,16 +3198,16 @@ usr/share/terminfo/v/vt200-w
 #usr/share/terminfo/x/xnuppc-m-f
 #usr/share/terminfo/x/xnuppc-m-f2
 #usr/share/terminfo/x/xtalk
-#usr/share/terminfo/x/xterm
-#usr/share/terminfo/x/xterm#pcfkeys
-#usr/share/terminfo/x/xterm#sl
-#usr/share/terminfo/x/xterm#sl-twm
+usr/share/terminfo/x/xterm
+usr/share/terminfo/x/xterm+pcfkeys
+#usr/share/terminfo/x/xterm+sl
+#usr/share/terminfo/x/xterm+sl-twm
 #usr/share/terminfo/x/xterm-1002
 #usr/share/terminfo/x/xterm-1003
 #usr/share/terminfo/x/xterm-16color
 #usr/share/terminfo/x/xterm-24
-#usr/share/terminfo/x/xterm-256color
-#usr/share/terminfo/x/xterm-88color
+usr/share/terminfo/x/xterm-256color
+usr/share/terminfo/x/xterm-88color
 #usr/share/terminfo/x/xterm-8bit
 #usr/share/terminfo/x/xterm-basic
 #usr/share/terminfo/x/xterm-bold
@@ -3222,8 +3222,8 @@ usr/share/terminfo/v/vt200-w
 #usr/share/terminfo/x/xterm-r6
 #usr/share/terminfo/x/xterm-sco
 #usr/share/terminfo/x/xterm-sun
-#usr/share/terminfo/x/xterm-vt220
-#usr/share/terminfo/x/xterm-vt52
+usr/share/terminfo/x/xterm-vt220
+usr/share/terminfo/x/xterm-vt52
 #usr/share/terminfo/x/xterm-xf86-v32
 #usr/share/terminfo/x/xterm-xf86-v33
 #usr/share/terminfo/x/xterm-xf86-v333
index 51c0380..267e8be 100644 (file)
@@ -1,7 +1,7 @@
 bin/kill
 bin/ps
 lib/libproc-3.2.6.so
-#sbin/sysctl
+sbin/sysctl
 usr/bin/free
 #usr/bin/pgrep
 #usr/bin/pkill
diff --git a/config/rootfiles/common/setup b/config/rootfiles/common/setup
new file mode 100644 (file)
index 0000000..6f693fb
--- /dev/null
@@ -0,0 +1 @@
+usr/local/sbin/setup
diff --git a/config/rootfiles/common/slang b/config/rootfiles/common/slang
new file mode 100644 (file)
index 0000000..2ee8da4
--- /dev/null
@@ -0,0 +1,78 @@
+#etc/slsh.rc
+#usr/bin/slsh
+#usr/include/slang.h
+#usr/include/slcurses.h
+#usr/lib/libslang.a
+usr/lib/libslang.so
+usr/lib/libslang.so.2
+usr/lib/libslang.so.2.0.6
+#usr/lib/slang
+#usr/lib/slang/v2
+#usr/lib/slang/v2/modules
+#usr/lib/slang/v2/modules/fcntl-module.so
+#usr/lib/slang/v2/modules/pcre-module.so
+#usr/lib/slang/v2/modules/png-module.so
+#usr/lib/slang/v2/modules/select-module.so
+#usr/lib/slang/v2/modules/slsmg-module.so
+#usr/lib/slang/v2/modules/termios-module.so
+#usr/lib/slang/v2/modules/varray-module.so
+#usr/man/man1/slsh.1
+#usr/share/doc/slang
+#usr/share/doc/slang/v2
+#usr/share/doc/slang/v2/COPYING
+#usr/share/doc/slang/v2/changes.txt
+#usr/share/doc/slang/v2/cref.txt
+#usr/share/doc/slang/v2/cslang.txt
+#usr/share/doc/slang/v2/slang.txt
+#usr/share/doc/slang/v2/slangdoc.html
+#usr/share/doc/slang/v2/slangfun.txt
+#usr/share/slsh
+#usr/share/slsh/arrayfuns.sl
+#usr/share/slsh/autoload.sl
+#usr/share/slsh/cmaps
+#usr/share/slsh/cmaps/cool.map
+#usr/share/slsh/cmaps/copper.map
+#usr/share/slsh/cmaps/drywet.map
+#usr/share/slsh/cmaps/gebco.map
+#usr/share/slsh/cmaps/globe.map
+#usr/share/slsh/cmaps/gray.map
+#usr/share/slsh/cmaps/haxby.map
+#usr/share/slsh/cmaps/hot.map
+#usr/share/slsh/cmaps/jet.map
+#usr/share/slsh/cmaps/no_green.map
+#usr/share/slsh/cmaps/ocean.map
+#usr/share/slsh/cmaps/polar.map
+#usr/share/slsh/cmaps/rainbow.map
+#usr/share/slsh/cmaps/red2green.map
+#usr/share/slsh/cmaps/relief.map
+#usr/share/slsh/cmaps/sealand.map
+#usr/share/slsh/cmaps/seis.map
+#usr/share/slsh/cmaps/split.map
+#usr/share/slsh/cmaps/topo.map
+#usr/share/slsh/cmaps/wysiwyg.map
+#usr/share/slsh/fcntl.sl
+#usr/share/slsh/glob.sl
+#usr/share/slsh/help
+#usr/share/slsh/help/pcrefuns.hlp
+#usr/share/slsh/help/pngfuns.hlp
+#usr/share/slsh/local-packages
+#usr/share/slsh/pcre.sl
+#usr/share/slsh/png.sl
+#usr/share/slsh/print.sl
+#usr/share/slsh/profile.sl
+#usr/share/slsh/require.sl
+#usr/share/slsh/scripts
+#usr/share/slsh/scripts/jpegsize
+#usr/share/slsh/scripts/lsrpm
+#usr/share/slsh/scripts/sldb
+#usr/share/slsh/scripts/slprof
+#usr/share/slsh/scripts/svnsh
+#usr/share/slsh/select.sl
+#usr/share/slsh/sldb.sl
+#usr/share/slsh/sldbcore.sl
+#usr/share/slsh/slshrl.sl
+#usr/share/slsh/slsmg.sl
+#usr/share/slsh/stkcheck.sl
+#usr/share/slsh/structfuns.sl
+#usr/share/slsh/termios.sl
+#usr/share/slsh/varray.sl
index 297eb59..5d1c599 100644 (file)
@@ -1,8 +1,8 @@
-#bin/bash
-#bin/cat
-#bin/grep
-#bin/pwd
-#bin/stty
+bin/bash
+bin/cat
+bin/grep
+bin/pwd
+bin/stty
 #boot
 dev/null
 dev/console
@@ -36,8 +36,9 @@ media/floppy
 mnt
 #opt
 root
-sbin
+#sbin
 #srv
+#sys
 tmp
 #usr/bin/perl
 #usr/include
@@ -101,9 +102,9 @@ tmp
 #var
 var/cache
 var/empty
-var/lib
-var/lib/locate
-var/lib/misc
+#var/lib
+#var/lib/locate
+#var/lib/misc
 #var/local
 var/lock
 var/log
index 2417f0e..8a13986 100644 (file)
@@ -4,7 +4,7 @@ bin/more
 bin/mount
 bin/umount
 etc/fdprm
-#sbin/agetty
+sbin/agetty
 sbin/blockdev
 sbin/cfdisk
 sbin/ctrlaltdel
index 5888389..1cfef40 100644 (file)
@@ -96,6 +96,7 @@
 * ibod
 * iftop-0.17
 * inetutils-1.4.2
+* initscripts_old
 * ipac-ng-1.31
 * ipaddr-1.2
 * iproute2-2.6.16-060323
index 439b9a4..0a82f45 100644 (file)
--- a/lfs/cdrom
+++ b/lfs/cdrom
@@ -85,6 +85,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        rm -f /tmp/ROOTFILES
        tar -x -C /tmp -f /$(SNAME).tar
        rm -f /$(SNAME).tar
+       mkdir /tmp/sys
        cd /tmp && tar jcf /install/cdrom/$(SNAME)-$(VERSION).tbz2 * && rm -rf *
 
        # Other files
index 152618d..4a41c13 100644 (file)
@@ -50,22 +50,89 @@ md5 :
 
 $(TARGET) :
        @$(PREBUILD)
-       -mkdir -p /etc/rc.d/helper
-       for i in $(DIR_SRC)/src/rc.d/* ; do \
-           if [ -f $$i ]; then \
-               sed "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" $$i > /etc/rc.d/`basename $$i`; \
-           fi; \
-       done
-       for i in $(DIR_SRC)/src/rc.d/helper/* ; do \
-           if [ -f $$i ]; then \
-               sed "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" $$i > /etc/rc.d/helper/`basename $$i`; \
-           fi; \
-       done
-       chmod -R 755 /etc/rc.d
-       chgrp nobody /etc/rc.d/rc.red
-       chmod 4750 /etc/rc.d/rc.red
 
-       -mkdir -p /etc/boot.d
-       cp -f $(DIR_SRC)/src/boot.d/* /etc/boot.d
+       # Make directories
+       install -d -m 755 /etc/rc.d/rc0.d
+       install -d -m 755 /etc/rc.d/rc1.d
+       install -d -m 755 /etc/rc.d/rc2.d
+       install -d -m 755 /etc/rc.d/rc3.d
+       install -d -m 755 /etc/rc.d/rc4.d
+       install -d -m 755 /etc/rc.d/rc5.d
+       install -d -m 755 /etc/rc.d/rc6.d
+       install -d -m 755 /etc/rc.d/rcsysinit.d
+       install -d -m 755 /etc/rc.d/init.d
+       install -d -m 755 /etc/sysconfig
+
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/checkfs       /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/cleanfs       /etc/rc.d/init.d/
+       install -m 644 $(DIR_SRC)/src/initscripts/init.d/functions     /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/halt          /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/console       /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/localnet      /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/modules       /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/mountfs       /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/mountkernfs   /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/rc            /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/reboot        /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/sendsignals   /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/setclock      /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/sysklogd      /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/swap          /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/sysctl        /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/template      /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/udev          /etc/rc.d/init.d/
+       install -m 754 $(DIR_SRC)/src/initscripts/init.d/udev_retry    /etc/rc.d/init.d/
+       ln -sf ../init.d/sysklogd    /etc/rc.d/rc0.d/K90sysklogd
+       ln -sf ../init.d/sendsignals /etc/rc.d/rc0.d/S60sendsignals
+       ln -sf ../init.d/mountfs     /etc/rc.d/rc0.d/S70mountfs
+       ln -sf ../init.d/swap        /etc/rc.d/rc0.d/S80swap
+       ln -sf ../init.d/localnet    /etc/rc.d/rc0.d/S90localnet
+       ln -sf ../init.d/halt        /etc/rc.d/rc0.d/S99halt
+       ln -sf ../init.d/sysklogd    /etc/rc.d/rc1.d/K90sysklogd
+       ln -sf ../init.d/sysklogd    /etc/rc.d/rc2.d/K90sysklogd
+       ln -sf ../init.d/sysklogd    /etc/rc.d/rc3.d/S10sysklogd
+       ln -sf ../init.d/sysklogd    /etc/rc.d/rc4.d/S10sysklogd
+       ln -sf ../init.d/sysklogd    /etc/rc.d/rc5.d/S10sysklogd
+       ln -sf ../init.d/sysklogd    /etc/rc.d/rc6.d/K90sysklogd
+       ln -sf ../init.d/sendsignals /etc/rc.d/rc6.d/S60sendsignals
+       ln -sf ../init.d/mountfs     /etc/rc.d/rc6.d/S70mountfs
+       ln -sf ../init.d/swap        /etc/rc.d/rc6.d/S80swap
+       ln -sf ../init.d/localnet    /etc/rc.d/rc6.d/S90localnet
+       ln -sf ../init.d/reboot      /etc/rc.d/rc6.d/S99reboot
+       ln -sf ../init.d/mountkernfs /etc/rc.d/rcsysinit.d/S00mountkernfs
+       ln -sf ../init.d/modules     /etc/rc.d/rcsysinit.d/S05modules
+       ln -sf ../init.d/udev        /etc/rc.d/rcsysinit.d/S10udev
+       ln -sf ../init.d/swap        /etc/rc.d/rcsysinit.d/S20swap
+       ln -sf ../init.d/checkfs     /etc/rc.d/rcsysinit.d/S30checkfs
+       ln -sf ../init.d/mountfs     /etc/rc.d/rcsysinit.d/S40mountfs
+       ln -sf ../init.d/udev_retry  /etc/rc.d/rcsysinit.d/S45udev_retry
+       ln -sf ../init.d/cleanfs     /etc/rc.d/rcsysinit.d/S50cleanfs
+       ln -sf ../init.d/setclock    /etc/rc.d/rcsysinit.d/S60setclock
+       ln -sf ../init.d/console     /etc/rc.d/rcsysinit.d/S70console
+       ln -sf ../init.d/localnet    /etc/rc.d/rcsysinit.d/S80localnet
+       ln -sf ../init.d/sysctl      /etc/rc.d/rcsysinit.d/S90sysctl
+       install -m 644 $(DIR_SRC)/src/initscripts/sysconfig/createfiles /etc/sysconfig/
+       install -m 644 $(DIR_SRC)/src/initscripts/sysconfig/modules     /etc/sysconfig/
+       install -m 644 $(DIR_SRC)/src/initscripts/sysconfig/rc          /etc/sysconfig/
+       install -m 644 $(DIR_SRC)/src/initscripts/sysconfig/clock       /etc/sysconfig/
+       install -m 644 $(DIR_SRC)/src/initscripts/sysconfig/network     /etc/sysconfig/
+
+#      -mkdir -p /etc/rc.d/helper
+#      for i in $(DIR_SRC)/src/rc.d/* ; do \
+#          if [ -f $$i ]; then \
+#              sed "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" $$i > /etc/rc.d/`basename $$i`; \
+#          fi; \
+#      done
+#      for i in $(DIR_SRC)/src/rc.d/helper/* ; do \
+#          if [ -f $$i ]; then \
+#              sed "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" $$i > /etc/rc.d/helper/`basename $$i`; \
+#          fi; \
+#      done
+#      chmod -R 755 /etc/rc.d
+#      chgrp nobody /etc/rc.d/rc.red
+#      chmod 4750 /etc/rc.d/rc.red
+#
+#      -mkdir -p /etc/boot.d
+#      cp -f $(DIR_SRC)/src/boot.d/* /etc/boot.d
 
        @$(POSTBUILD)
index 0d9258c..2deb67e 100644 (file)
--- a/lfs/udev
+++ b/lfs/udev
@@ -79,10 +79,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
 ifeq "$(LFS_PASS)" "install"
-       cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/bin udevdir=/dev
-       cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/bin udevdir=/dev install
-       rm -f /install/initrd/bin/udev* /install/initrd/usr/sbin/udev* /install/initrd/usr/bin/udev*
-       cd $(DIR_APP) && install udevstart /install/initrd/bin
+       cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev
+       cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev install
+       rm -f /install/initrd/sbin/udev* /install/initrd/usr/sbin/udev* /install/initrd/usr/bin/udev*
+       cd $(DIR_APP) && install udevstart /install/initrd/sbin
        cd /install/initrd/usr/share && rm -rf man
        cd /install/initrd/dev && rm -f console
        cd /install/initrd/dev && mknod -m 0600 console c 5 1
diff --git a/make.sh b/make.sh
index 82b324b..da6b4b4 100644 (file)
--- a/make.sh
+++ b/make.sh
@@ -935,10 +935,9 @@ svn)
                clear
                if [ -f /usr/bin/mcedit ]; then
                        export EDITOR=/usr/bin/mcedit
-               else
-                       if [ -f /usr/bin/nano ]; then
-                               export EDITOR=/usr/bin/nano
-                       fi
+               fi
+               if [ -f /usr/bin/nano ]; then
+                       export EDITOR=/usr/bin/nano
                fi
                echo -ne "Selecting editor $EDITOR..."
                beautify message DONE
diff --git a/src/initscripts/init.d/checkfs b/src/initscripts/init.d/checkfs
new file mode 100644 (file)
index 0000000..fe0f435
--- /dev/null
@@ -0,0 +1,131 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/checkfs
+#
+# Description : File System Check
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#              A. Luebke - luebke@users.sourceforge.net
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+# Based on checkfs script from LFS-3.1 and earlier.
+#
+# From man fsck
+# 0    - No errors
+# 1    - File system errors corrected
+# 2    - System should be rebooted
+# 4    - File system errors left uncorrected
+# 8    - Operational error
+# 16   - Usage or syntax error
+# 32   - Fsck canceled by user request
+# 128  - Shared library error
+#
+#########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               if [ -f /fastboot ]; then
+                       boot_mesg -n "/fastboot found, will not perform" ${INFO}
+                       boot_mesg " file system checks as requested."
+                       echo_ok
+                       exit 0
+               fi
+
+               boot_mesg "Mounting root file system in read-only mode..."
+               mount -n -o remount,ro / >/dev/null
+               evaluate_retval
+
+               if [ ${?} != 0 ]; then
+                       echo_failure
+                       boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE}
+                       boot_mesg -n " filesystem because it could not be mounted"
+                       boot_mesg -n " in read-only mode.\n\nAfter you"
+                       boot_mesg -n " press Enter, this system will be"
+                       boot_mesg -n " halted and powered off."
+                       boot_mesg -n "\n\nPress enter to continue..." ${INFO}
+                       boot_mesg "" ${NORMAL}
+                       read ENTER
+                       ${rc_base}/init.d/halt stop
+               fi
+
+               if [ -f /forcefsck ]; then
+                       boot_mesg -n "/forcefsck found, forcing file" ${INFO}
+                       boot_mesg " system checks as requested."
+                       echo_ok
+                       options="-f"
+               else
+                       options=""
+               fi
+
+               boot_mesg "Checking file systems..."
+               # Note: -a option used to be -p; but this fails e.g.
+               # on fsck.minix
+               fsck ${options} -a -A -C -T 2>/dev/null
+               error_value=${?}
+
+               if [ "${error_value}" = 0 ]; then
+                       echo_ok
+               fi
+
+               if [ "${error_value}" = 1 ]; then
+                       echo_warning
+                       boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
+                       boot_mesg -n " were found and have been corrected."
+                       boot_mesg -n "  You may want to double-check that"
+                       boot_mesg -n " everything was fixed properly."
+                       boot_mesg "" ${NORMAL}
+               fi
+
+               if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
+                       echo_warning
+                       boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
+                       boot_mesg -n " were found and have been been"
+                       boot_mesg -n " corrected, but the nature of the"
+                       boot_mesg -n " errors require this system to be"
+                       boot_mesg -n " rebooted.\n\nAfter you press enter,"
+                       boot_mesg -n " this system will be rebooted"
+                       boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+                       boot_mesg "" ${NORMAL}
+                       read ENTER
+                       reboot -f
+               fi
+
+               if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
+                       echo_failure
+                       boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}
+                       boot_mesg -n " were encountered that could not be"
+                       boot_mesg -n " fixed automatically.  This system"
+                       boot_mesg -n " cannot continue to boot and will"
+                       boot_mesg -n " therefore be halted until those"
+                       boot_mesg -n " errors are fixed manually by a"
+                       boot_mesg -n " System Administrator.\n\nAfter you"
+                       boot_mesg -n " press Enter, this system will be"
+                       boot_mesg -n " halted and powered off."
+                       boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+                       boot_mesg "" ${NORMAL}
+                       read ENTER
+                 ${rc_base}/init.d/halt stop
+               fi
+
+               if [ "${error_value}" -ge 16 ]; then
+                       echo_failure
+                       boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
+                       boot_mesg -n " running fsck.  Exited with error"
+                       boot_mesg -n " code: ${error_value}."
+                       boot_mesg "" ${NORMAL}
+                       exit ${error_value}
+               fi
+               ;;
+       *)
+               echo "Usage: ${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/checkfs
diff --git a/src/initscripts/init.d/cleanfs b/src/initscripts/init.d/cleanfs
new file mode 100644 (file)
index 0000000..9a4e186
--- /dev/null
@@ -0,0 +1,110 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/cleanfs
+#
+# Description : Clean file system
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+# Function to create files/directory on boot.
+create_files() {
+       # Read in the configuration file.
+       exec 9>&0 < /etc/sysconfig/createfiles
+               while read name type perm usr grp dtype maj min junk
+               do
+
+                       # Ignore comments and blank lines.
+                               case "${name}" in
+                               ""|\#*) continue ;;
+                       esac
+
+                       # Ignore existing files.
+                       if [ ! -e "${name}" ]; then
+                               # Create stuff based on its type.
+                               case "${type}" in
+                                       dir)
+                                               mkdir "${name}"
+                                               ;;
+                                       file)
+                                               :> "${name}"
+                                               ;;
+                                       dev)
+                                               case "${dtype}" in
+                                                       char)
+                                                               mknod "${name}" c ${maj} ${min}
+                                                               ;;
+                                                       block)
+                                                               mknod "${name}" b ${maj} ${min}
+                                                               ;;
+                                                       pipe)
+                                                               mknod "${name}" p
+                                                               ;;
+                                                       *) 
+                                                               boot_mesg -n "\nUnknown device type: ${dtype}" ${WARNING}
+                                                               boot_mesg "" ${NORMAL}
+                                                               ;;
+                                               esac
+                                               ;;
+                                       *)
+                                               boot_mesg -n "\nUnknown type: ${type}" ${WARNING}
+                                               boot_mesg "" ${NORMAL}
+                                               continue
+                                               ;;
+                               esac
+
+                               # Set up the permissions, too.
+                               chown ${usr}:${grp} "${name}"
+                               chmod ${perm} "${name}"
+                       fi
+               done
+       exec 0>&9 9>&-
+}
+
+case "${1}" in
+       start)
+               boot_mesg -n "Cleaning file systems:" ${INFO}
+
+               boot_mesg -n " /tmp" ${NORMAL}
+               cd /tmp &&
+               find . -xdev -mindepth 1 ! -name lost+found \
+                       -delete || failed=1
+
+               boot_mesg -n " /var/lock" ${NORMAL}
+               cd /var/lock &&
+               find . -type f ! -newer /proc -exec rm -f {} \; || failed=1
+
+               boot_mesg " /var/run" ${NORMAL}
+               cd /var/run &&
+               find . ! -type d ! -name utmp ! -newer /proc \
+                       -exec rm -f {} \; || failed=1
+               > /var/run/utmp
+               if grep -q '^utmp:' /etc/group ; then
+                       chmod 664 /var/run/utmp
+                       chgrp utmp /var/run/utmp
+               fi
+
+               (exit ${failed})
+               evaluate_retval
+
+               if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then
+                       boot_mesg "Creating files and directories..."
+                       create_files
+                       evaluate_retval
+               fi
+               ;;
+       *)
+               echo "Usage: ${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/cleanfs
diff --git a/src/initscripts/init.d/console b/src/initscripts/init.d/console
new file mode 100644 (file)
index 0000000..bc1f4e0
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/console
+#
+# Description : Sets keymap and screen font
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#              Alexander E. Patrakov
+#
+# Version     : 00.03
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+# Native English speakers probably don't have /etc/sysconfig/console at all
+if [ -f /etc/sysconfig/console ]
+then
+       . /etc/sysconfig/console
+else
+        exit 0
+fi
+
+is_true() {
+       [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
+}
+
+failed=0
+trap failed=1 ERR
+
+case "${1}" in
+       start)
+               boot_mesg "Setting up Linux console..."
+               # There should be no bogus failures below this line!
+               
+               # Figure out if a framebuffer console is used
+               [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
+               
+               # Figure out the command to set the console into the
+               # desired mode
+               is_true "${UNICODE}" &&
+                       MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
+                       MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a"
+               
+               # On framebuffer consoles, font has to be set for each vt in
+               # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
+               
+               ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
+                       MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
+
+               # Apply that command to all consoles mentioned in
+               # /etc/inittab. Important: in the UTF-8 mode this should
+               # happen before setfont, otherwise a kernel bug will
+               # show up and the unicode map of the font will not be
+               # used.
+               # FIXME: Fedora Core also initializes two spare consoles
+               # - do we want that?
+               
+               for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
+                       grep -o '\btty[[:digit:]]*\b'`
+               do
+                       openvt -f -w -c ${TTY#tty} -- \
+                               /bin/sh -c "${MODE_COMMAND}"
+               done
+
+               # Set the font (if not already set above) and the keymap
+               is_true "${USE_FB}" ||  [ -z "${FONT}" ] || setfont $FONT
+               [ -z "${KEYMAP}" ] || loadkeys ${KEYMAP} &>/dev/null
+               [ -z "${KEYMAP_CORRECTIONS}" ] ||
+                       loadkeys ${KEYMAP_CORRECTIONS} &>/dev/null
+
+               # Linux kernel generates wrong bytes when composing
+               # in Unicode mode. That's why we disable dead keys in Unicode
+               # mode by default. If you need them, download and apply
+               # http://www.linuxfromscratch.org/~alexander/patches/linux-2.6.12.5-utf8_input-2.patch
+               # After patching, add "-m charset_of_your_keymap" to the FONT
+               # variable and set BROKEN_COMPOSE=false
+               # in /etc/sysconfig/console
+
+               [ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE="$UNICODE"
+               ! is_true "$BROKEN_COMPOSE" ||
+                       echo "" | loadkeys -c &>/dev/null
+               
+               # Convert the keymap from $LEGACY_CHARSET to UTF-8
+               [ -z "$LEGACY_CHARSET" ] ||
+                       dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u &>/dev/null
+
+               # If any of the commands above failed, the trap at the
+               # top would set $failed to 1
+               ( exit $failed )
+               evaluate_retval
+               ;;
+       *)
+               echo $"Usage:" "${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/console
diff --git a/src/initscripts/init.d/functions b/src/initscripts/init.d/functions
new file mode 100644 (file)
index 0000000..d50421d
--- /dev/null
@@ -0,0 +1,682 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/functions
+#
+# Description : Run Level Control Functions
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       : With code based on Matthias Benkmann's simpleinit-msb
+#              http://winterdrache.de/linux/newboot/index.html
+#
+########################################################################
+
+## Environmental setup
+# Setup default values for environment
+umask 022
+export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
+
+# Signal sent to running processes to refresh their configuration
+RELOADSIG="HUP"
+
+# Number of seconds between STOPSIG and FALLBACK when stopping processes
+KILLDELAY="3"
+
+## Screen Dimensions
+# Find current screen size
+if [ -z "${COLUMNS}" ]; then
+       COLUMNS=$(stty size)
+       COLUMNS=${COLUMNS##* }
+fi
+
+# When using remote connections, such as a serial port, stty size returns 0
+if [ "${COLUMNS}" = "0" ]; then 
+       COLUMNS=80
+fi
+
+## Measurements for positioning result messages
+COL=$((${COLUMNS} - 8))
+WCOL=$((${COL} - 2))
+
+## Set Cursor Position Commands, used via echo -e
+SET_COL="\\033[${COL}G"      # at the $COL char
+SET_WCOL="\\033[${WCOL}G"    # at the $WCOL char
+CURS_UP="\\033[1A\\033[0G"   # Up one line, at the 0'th char
+
+## Set color commands, used via echo -e
+# Please consult `man console_codes for more information
+# under the "ECMA-48 Set Graphics Rendition" section
+#
+# Warning: when switching from a 8bit to a 9bit font,
+# the linux console will reinterpret the bold (1;) to
+# the top 256 glyphs of the 9bit font.  This does
+# not affect framebuffer consoles
+NORMAL="\\033[0;39m"         # Standard console grey
+SUCCESS="\\033[1;32m"        # Success is green
+WARNING="\\033[1;33m"        # Warnings are yellow
+FAILURE="\\033[1;31m"        # Failures are red
+INFO="\\033[1;36m"           # Information is light cyan
+BRACKET="\\033[1;34m"        # Brackets are blue
+
+STRING_LENGTH="0"   # the length of the current message
+
+#*******************************************************************************
+# Function - boot_mesg()
+#
+# Purpose:      Sending information from bootup scripts to the console
+#
+# Inputs:       $1 is the message
+#               $2 is the colorcode for the console
+#
+# Outputs:      Standard Output
+#
+# Dependencies: - sed for parsing strings.
+#              - grep for counting string length.
+#               
+# Todo:         
+#*******************************************************************************
+boot_mesg()
+{
+       local ECHOPARM=""
+
+       while true
+       do
+               case "${1}" in
+                       -n)
+                               ECHOPARM=" -n "
+                               shift 1
+                               ;;
+                       -*)
+                               echo "Unknown Option: ${1}"
+                               return 1
+                               ;;
+                       *)
+                               break
+                               ;;
+               esac
+       done
+
+       ## Figure out the length of what is to be printed to be used
+        ## for warning messges. 
+       STRING_LENGTH="`echo "${1}" | sed \
+               -e 's,.,.,g' -e 'l 1' | grep -c \$`"
+
+       # Print the message to the screen
+       echo ${ECHOPARM} -e "${2}${1}"
+       
+}
+
+boot_mesg_flush()
+{
+       # Reset STRING_LENGTH for next message
+       STRING_LENGTH="0"
+}
+
+boot_log()
+{
+       # Left in for backwards compatibility
+       echo -n ""
+}
+
+echo_ok()
+{
+       echo -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS}  OK  ${BRACKET}]"
+       echo -e "${NORMAL}"
+        boot_mesg_flush
+}
+
+echo_failure()
+{
+       echo -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
+       echo -e "${NORMAL}"
+        boot_mesg_flush
+}
+
+echo_warning()
+{
+       echo -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
+       echo -e "${NORMAL}"
+        boot_mesg_flush
+}
+
+print_error_msg()
+{
+       echo_failure
+       # $i is inherited by the rc script
+       boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE}
+       boot_mesg -n " It means that an unforeseen error took"
+       boot_mesg -n " place in ${i}, which exited with a return value of"
+       boot_mesg " ${error_value}.\n"
+       boot_mesg_flush
+       boot_mesg -n "If you're able to track this"
+       boot_mesg -n " error down to a bug in one of the files provided by"
+       boot_mesg -n " the LFS book, please be so kind to inform us at"
+       boot_mesg " lfs-dev@linuxfromscratch.org.\n"
+       boot_mesg_flush
+       boot_mesg -n "Press Enter to continue..." ${INFO}
+       boot_mesg "" ${NORMAL}
+       read ENTER
+}
+
+check_script_status()
+{
+       # $i is inherited by the rc script
+       if [ ! -f ${i} ]; then
+               boot_mesg "${i} is not a valid symlink." ${WARNING}
+               echo_warning
+               continue
+       fi
+
+       if [ ! -x ${i} ]; then
+               boot_mesg "${i} is not executable, skipping." ${WARNING}
+               echo_warning
+               continue
+       fi
+}
+
+evaluate_retval()
+{
+       error_value="${?}"
+
+       if [ ${error_value} = 0 ]; then
+               echo_ok
+       else
+               echo_failure
+       fi
+
+       # This prevents the 'An Unexpected Error Has Occurred' from trivial
+       # errors.
+       return 0
+}
+
+print_status()
+{
+       if [ "${#}" = "0" ]; then
+               echo "Usage: ${0} {success|warning|failure}"
+               return 1
+       fi
+
+       case "${1}" in
+
+               success)
+                       echo_ok
+                       ;;
+
+               warning)
+                       # Leave this extra case in because old scripts
+                       # may call it this way.
+                       case "${2}" in
+                               running)
+                                       echo -e -n "${CURS_UP}"
+                                       echo -e -n "\\033[${STRING_LENGTH}G   "
+                                       boot_mesg "Already running." ${WARNING}
+                                       echo_warning
+                                       ;;
+                               not_running)
+                                       echo -e -n "${CURS_UP}"
+                                       echo -e -n "\\033[${STRING_LENGTH}G   "
+                                       boot_mesg "Not running." ${WARNING}
+                                       echo_warning
+                                       ;;
+                               not_available)
+                                       echo -e -n "${CURS_UP}"
+                                       echo -e -n "\\033[${STRING_LENGTH}G   "
+                                       boot_mesg "Not available." ${WARNING}
+                                       echo_warning
+                                       ;;
+                               *)
+                                       # This is how it is supposed to
+                                       # be called
+                                       echo_warning
+                                       ;;
+                       esac
+               ;;
+
+               failure)
+                       echo_failure
+               ;;
+
+       esac
+
+}
+
+reloadproc()
+{
+       if [ "${#}" = "0" ]; then
+               echo "Usage: reloadproc [{program}]"
+               exit 1
+       fi
+
+       getpids "${1}"
+
+       if [ -n "${pidlist}" ]; then
+               failure="0"
+               for pid in ${pidlist}
+               do
+                       kill -"${RELOADSIG}" "${pid}" || failure="1"
+               done
+
+               (exit ${failure})
+               evaluate_retval
+
+       else
+               boot_mesg "Process ${1} not running." ${WARNING}
+               echo_warning
+       fi
+}
+
+statusproc()
+{
+       if [ "${#}" = "0" ]
+       then
+               echo "Usage: statusproc {program}"
+               exit 1
+       fi
+
+       getpids "${1}"
+
+       if [ -n "${pidlist}" ]; then
+               echo -e "${INFO}${base} is running with Process"\
+                       "ID(s) ${pidlist}.${NORMAL}"
+       else
+               if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
+                       echo -e "${WARNING}${1} is not running but"\
+                               "/var/run/${base}.pid exists.${NORMAL}"
+               else
+                       if [ -n "${PIDFILE}" -a -e "${PIDFILE}" ]; then
+                               echo -e "${WARNING}${1} is not running"\
+                                       "but ${PIDFILE} exists.${NORMAL}"
+                       else
+                               echo -e "${INFO}${1} is not running.${NORMAL}"
+                       fi
+               fi
+       fi
+}
+
+# The below functions are documented in the LSB-generic 2.1.0
+
+#*******************************************************************************
+# Function - pidofproc [-s] [-p pidfile] pathname
+#
+# Purpose: This function returns one or more pid(s) for a particular daemon
+#
+# Inputs: -p pidfile, use the specified pidfile instead of pidof
+#         pathname, path to the specified program
+#
+# Outputs: return 0 - Success, pid's in stdout
+#          return 1 - Program is dead, pidfile exists
+#          return 2 - Invalid or excessive number of arguments, 
+#                     warning in stdout
+#          return 3 - Program is not running
+#
+# Dependencies: pidof, echo, head
+#
+# Todo: Remove dependency on head
+#       This depreciates getpids
+#       Test changes to pidof
+#
+#*******************************************************************************
+pidofproc()
+{
+       local pidfile=""
+       local lpids=""
+       local silent=""
+       pidlist=""
+       while true
+       do
+               case "${1}" in
+                       -p)
+                               pidfile="${2}"
+                               shift 2
+                               ;;
+
+                       -s)
+                               # Added for legacy opperation of getpids
+                               # eliminates several '> /dev/null'
+                               silent="1"
+                               shift 1
+                               ;;
+                       -*)
+                               log_failure_msg "Unknown Option: ${1}"
+                               return 2
+                               ;;
+                       *)
+                               break
+                               ;;
+               esac
+       done
+
+       if [ "${#}" != "1" ]; then
+               shift 1
+               log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
+               return 2
+       fi
+
+       if [ -n "${pidfile}" ]; then
+               if [ ! -r "${pidfile}" ]; then
+                       return 3 # Program is not running
+               fi
+
+               lpids=`head -n 1 ${pidfile}`
+               for pid in ${lpids}
+               do
+                       if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
+                               kill -0 "${pid}" > /dev/null &&
+                               pidlist="${pidlist} ${pid}"
+                       fi
+                       
+                       if [ "${silent}" -ne "1" ]; then
+                               echo "${pidlist}"
+                       fi
+
+                       test -z "${pidlist}" && 
+                       # Program is dead, pidfile exists
+                       return 1
+                       # else
+                       return 0
+               done
+
+       else
+               pidlist=`pidof -o $$ -o $PPID -x "$1"`
+               if [ "x${silent}" != "x1" ]; then
+                       echo "${pidlist}"
+               fi
+
+               # Get provide correct running status
+               if [ -n "${pidlist}" ]; then
+                       return 0
+               else
+                       return 3
+               fi
+
+       fi
+
+       if [ "$?" != "0" ]; then
+               return 3 # Program is not running
+       fi
+}
+
+# This will ensure compatibility with previous LFS Bootscripts
+getpids()
+{
+       if [ -z "${PIDFILE}" ]; then
+               pidofproc -s -p "${PIDFILE}" $@
+       else
+               pidofproc -s $@
+       fi
+       base="${1##*/}"
+}
+
+#*******************************************************************************
+# Function - loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]
+#
+# Purpose: This runs the specified program as a daemon
+#
+# Inputs: -f, run the program even if it is already running
+#         -n nicelevel, specifies a nice level. See nice(1).
+#         -p pidfile, uses the specified pidfile
+#         pathname, pathname to the specified program
+#         args, arguments to pass to specified program
+#
+# Outputs: return 0 - Success
+#          return 2 - Invalid of excessive number of arguments, 
+#                     warning in stdout
+#          return 4 - Program or service status is unknown
+#
+# Dependencies: nice
+#
+# Todo: LSB says this should be called start_daemon
+#       LSB does not say that it should call evaluate_retval
+#       It checks for PIDFILE, which is deprecated.
+#         Will be removed after BLFS 6.0
+#       loadproc returns 0 if program is already running, not LSB compliant
+#
+#*******************************************************************************
+loadproc()
+{
+       local pidfile=""
+       local forcestart=""
+       local nicelevel="10"
+
+# This will ensure compatibility with previous LFS Bootscripts
+       if [ -n "${PIDFILE}" ]; then
+               pidfile="${PIDFILE}"
+       fi
+
+  while true
+       do
+               case "${1}" in
+                       -f)
+                               forcestart="1"
+                               shift 1
+                               ;;
+                       -n)
+                               nicelevel="${2}"
+                               shift 2
+                               ;;
+                       -p)
+                               pidfile="${2}"
+                               shift 2
+                               ;;
+                       -*)
+                               log_failure_msg "Unknown Option: ${1}"
+                               return 2 #invalid or excess argument(s)
+                               ;;
+                       *)
+                               break
+                               ;;
+               esac
+       done
+
+       if [ "${#}" = "0" ]; then
+               log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
+               return 2 #invalid or excess argument(s)
+       fi
+
+       if [ -z "${forcestart}" ]; then
+               if [ -z "${pidfile}" ]; then
+                       pidofproc -s "${1}"
+               else
+                       pidofproc -s -p "${pidfile}" "${1}"
+               fi
+
+               case "${?}" in
+                       0)
+                               log_warning_msg "Unable to continue: ${1} is running"
+                               return 0 # 4
+                               ;;
+                       1)
+                               log_warning_msg "Unable to continue: ${pidfile} exists"
+                               return 0 # 4
+                               ;;
+                       3)
+                               ;;
+                       *)
+                               log_failure_msg "Unknown error code from pidofproc: ${?}"
+                               return 4
+                               ;;
+               esac
+       fi
+
+       nice -n "${nicelevel}" "${@}"
+       evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts
+       return 0
+}
+
+#*******************************************************************************
+# Function - killproc  [-p pidfile] pathname [signal]
+#
+# Purpose:
+#
+# Inputs: -p pidfile, uses the specified pidfile
+#         pathname, pathname to the specified program
+#         signal, send this signal to pathname
+#
+# Outputs: return 0 - Success
+#          return 2 - Invalid of excessive number of arguments, 
+#                     warning in stdout
+#          return 4 - Unknown Status
+#
+# Dependencies: kill
+#
+# Todo: LSB does not say that it should call evaluate_retval
+#       It checks for PIDFILE, which is deprecated.
+#         Will be removed after BLFS 6.0
+#
+#*******************************************************************************
+killproc()
+{
+       local pidfile=""
+       local killsig=""
+       pidlist=""
+
+# This will ensure compatibility with previous LFS Bootscripts
+       if [ -n "${PIDFILE}" ]; then
+               pidfile="${PIDFILE}"
+       fi
+
+       while true
+       do
+               case "${1}" in
+                       -p)
+                               pidfile="${2}"
+                               shift 2
+                               ;;
+                       -*)
+                               log_failure_msg "Unknown Option: ${1}"
+                               return 2
+                       ;;
+                       *)
+                               break
+                               ;;
+               esac
+       done
+
+       if [ "${#}" = "2" ]; then
+               killsig="${2}"
+       elif [ "${#}" != "1" ]; then
+               shift 2
+               log_failure_msg "Usage: killproc  [-p pidfile] pathname [signal]"
+               return 2
+       fi
+
+       if [ -z "${pidfile}" ]; then
+               pidofproc -s "${1}"
+       else
+               pidofproc -s -p "${pidfile}" "${1}"
+       fi
+
+    # Change....
+    if [ -n "${pidlist}" ]; then
+       for pid in ${pidlist}
+       do
+               kill -${killsig:-TERM} ${pid} 2>/dev/null
+               if [ -z "${killsig}" ]; then
+                       # Wait up to 3 seconds, for ${pid} to terminate
+                       local dtime=${KILLDELAY}
+                       while [ "${dtime}" != "0" ]
+                       do
+                               kill -0 ${pid} 2>/dev/null || break
+                               sleep 1
+                               dtime=$(( ${dtime} - 1))
+                       done
+                       # If ${pid} is still running, kill it
+                       kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
+               fi
+       done
+
+       if [ -z "${killsig}" ]; then
+               pidofproc -s "${1}"
+
+               # Program was terminated
+               if [ "$?" != "0" ]; then
+                       # Pidfile Exists
+                       if [ -f "${pidfile}" ]; then
+                               rm -f "${pidfile}"
+                       fi
+                       echo_ok
+                       return 0
+               else # Program is still running
+                       echo_failure
+                       return 4 # Unknown Status
+               fi
+       else
+               if [ -z "${pidfile}" ]; then
+                       pidofproc -s "${1}"
+               else
+                       pidofproc -s -p "${pidfile}" "${1}"
+               fi
+       fi
+
+       evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts
+
+    else
+       print_status warning not_running
+    fi
+}
+
+
+#*******************************************************************************
+# Function - log_success_msg "message"
+#
+# Purpose: Print a success message
+#
+# Inputs: $@ - Message
+#
+# Outputs: Text output to screen
+#
+# Dependencies: echo
+#
+# Todo: logging
+#
+#*******************************************************************************
+log_success_msg()
+{
+       echo -n -e "${BOOTMESG_PREFIX}${@}"
+       echo -e "${SET_COL}""${BRACKET}""[""${SUCCESS}""  OK  ""${BRACKET}""]""${NORMAL}"
+       return 0
+}
+
+#*******************************************************************************
+# Function - log_failure_msg "message"
+#
+# Purpose: Print a failure message
+#
+# Inputs: $@ - Message
+#
+# Outputs: Text output to screen
+#
+# Dependencies: echo
+#
+# Todo: logging
+#
+#*******************************************************************************
+log_failure_msg() {
+       echo -n -e "${BOOTMESG_PREFIX}${@}"
+       echo -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
+       return 0
+}
+
+#*******************************************************************************
+# Function - log_warning_msg "message"
+#
+# Purpose: print a warning message
+#
+# Inputs: $@ - Message
+#
+# Outputs: Text output to screen
+#
+# Dependencies: echo
+#
+# Todo: logging
+#
+#*******************************************************************************
+log_warning_msg() {
+       echo -n -e "${BOOTMESG_PREFIX}${@}"
+       echo -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
+       return 0
+}
+
+# End $rc_base/init.d/functions
diff --git a/src/initscripts/init.d/halt b/src/initscripts/init.d/halt
new file mode 100644 (file)
index 0000000..f3b016c
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/halt
+#
+# Description : Halt Script
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       stop)
+               halt -d -f -i -p
+               ;;
+       *)
+               echo "Usage: {stop}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/halt
diff --git a/src/initscripts/init.d/localnet b/src/initscripts/init.d/localnet
new file mode 100644 (file)
index 0000000..4e50102
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/localnet
+#
+# Description : Loopback device
+#
+# Authors     : Gerard Beekmans  - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+. /etc/sysconfig/network
+
+case "${1}" in
+       start)
+               boot_mesg "Bringing up the loopback interface..."
+               ip addr add 127.0.0.1/8 label lo dev lo
+               ip link set lo up
+               evaluate_retval
+
+               boot_mesg "Setting hostname to ${HOSTNAME}..."
+               hostname ${HOSTNAME}
+               evaluate_retval
+               ;;
+
+       stop)
+               boot_mesg "Bringing down the loopback interface..."
+               ip link set lo down
+               evaluate_retval
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+
+       status)
+               echo "Hostname is: $(hostname)"
+               ip link show lo
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/localnet
diff --git a/src/initscripts/init.d/modules b/src/initscripts/init.d/modules
new file mode 100644 (file)
index 0000000..6be87f4
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/modules
+#
+# Description : Module auto-loading script
+#
+# Authors     : Zack Winkles
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+# Assure that the kernel has module support.
+[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
+
+case "${1}" in
+       start)
+
+               # If proc is mounted, find the current kernel
+               # message level 
+               if [ -f /proc/sys/kernel/printk ]; then
+                       prev_msg=`cat /proc/sys/kernel/printk | \
+                                       sed 'l 1' | sed -n '2~0p' | \
+                                       sed 's/\\\//'`
+               else 
+                       prev_msg="6"
+               fi
+
+               # Now set the message level to 1 so not to make too 
+               # much noise when loading modules
+               dmesg -n 1
+
+               # Only try to load modules if the user has actually given us
+               # some modules to load.
+               if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null
+               then
+
+                       # Read in the configuration file.
+                       exec 9>&0 < /etc/sysconfig/modules
+
+                               boot_mesg -n "Loading modules:" ${INFO}
+
+                               while read module args
+                               do
+                                       # Ignore comments and blank lines.
+                                       case "${module}" in
+                                               ""|\#*) continue ;;
+                                       esac
+
+                                       # Attempt to load the module, making
+                                       # sure to pass any arguments provided.
+                                       modprobe ${module} ${args} 2>&1 > /dev/null
+
+                                       # Print the module name if successful,
+                                       # otherwise take note.
+                                       if [ ${?} -eq 0 ]; then
+                                               boot_mesg -n " ${module}" ${NORMAL}
+                                       else
+                                               failedmod="${failedmod} ${module}"
+                                       fi
+                               done
+
+                               boot_mesg "" ${NORMAL}
+                               # Print a message about successfully loaded
+                               # modules on the correct line.
+                               echo_ok
+
+                               # Print a failure message with a list of any
+                               # modules that may have failed to load.
+                               if [ "${failedmod}" ]; then
+                                       boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
+                                       echo_failure
+                               fi
+
+                       exec 0>&9 9>&-
+
+               fi
+               # Set the kernel message level back to it's previous value.
+               dmesg -n "${prev_msg}"
+               ;;
+       *)
+               echo "Usage: ${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/modules
diff --git a/src/initscripts/init.d/mountfs b/src/initscripts/init.d/mountfs
new file mode 100644 (file)
index 0000000..43ef02d
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/mountfs
+#
+# Description : File System Mount Script
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg "Remounting root file system in read-write mode..."
+               mount -n -o remount,rw / &>/dev/null
+               evaluate_retval
+
+               # Remove fsck-related file system watermarks.
+               rm -f /fastboot /forcefsck
+
+               boot_mesg "Recording existing mounts in /etc/mtab..."
+               > /etc/mtab
+               mount -f / || failed=1
+               mount -f /proc || failed=1
+               mount -f /sys || failed=1
+               (exit ${failed})
+               evaluate_retval
+
+               # This will mount all filesystems that do not have _netdev in
+               # their option list.  _netdev denotes a network filesystem.
+               boot_mesg "Mounting remaining file systems..."
+               mount -a -O no_netdev &>/dev/null
+               evaluate_retval
+               ;;
+
+       stop)
+               boot_mesg "Unmounting all other currently mounted file systems..."
+               umount -a -d -r &>/dev/null
+               evaluate_retval
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/mountfs
diff --git a/src/initscripts/init.d/mountkernfs b/src/initscripts/init.d/mountkernfs
new file mode 100644 (file)
index 0000000..1e5be05
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/mountkernfs
+#
+# Description : Mount proc and sysfs
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg -n "Mounting kernel-based file systems:" ${INFO}
+
+               if ! mountpoint /proc &> /dev/null; then
+                       boot_mesg -n " /proc" ${NORMAL}
+                       mount -n /proc || failed=1
+               fi
+
+               if ! mountpoint /sys &> /dev/null; then
+                       boot_mesg -n " /sys" ${NORMAL}
+                       mount -n /sys || failed=1
+               fi
+
+               boot_mesg "" ${NORMAL}
+
+               (exit ${failed})
+               evaluate_retval
+               ;;
+
+       *)
+               echo "Usage: ${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/mountkernfs
diff --git a/src/initscripts/init.d/rc b/src/initscripts/init.d/rc
new file mode 100644 (file)
index 0000000..38d4ae2
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/rc
+#
+# Description : Main Run Level Control Script
+#
+# Authors     : Gerard Beekmans  - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+# This sets a few default terminal options.
+stty sane
+
+# These 3 signals will not cause our script to exit
+trap "" INT QUIT TSTP
+
+[ "${1}" != "" ] && runlevel=${1}
+
+if [ "${runlevel}" = "" ]; then
+       echo "Usage: ${0} <runlevel>" >&2
+       exit 1
+fi
+
+previous=${PREVLEVEL}
+[ "${previous}" = "" ] && previous=N
+
+if [ ! -d ${rc_base}/rc${runlevel}.d ]; then
+       boot_mesg "${rc_base}/rc${runlevel}.d does not exist." ${WARNING}
+       boot_mesg_flush
+       exit 1
+fi
+
+# Attempt to stop all service started by previous runlevel,
+# and killed in this runlevel
+if [ "${previous}" != "N" ]; then
+       for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null)
+       do
+               check_script_status
+
+               suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]}
+               prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
+               sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix
+
+               if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
+                       if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
+                               boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING}
+                               boot_mesg -n " executed because it was not"
+                               boot_mesg -n " not started in the previous"
+                               boot_mesg -n " runlevel (${previous})."
+                               boot_mesg "" ${NORMAL}
+                               boot_mesg_flush
+                               continue
+                       fi
+               fi
+               ${i} stop
+               error_value=${?}
+
+               if [ "${error_value}" != "0" ]; then
+                       print_error_msg
+               fi
+       done
+fi
+
+#Start all functions in this runlevel
+for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null)
+do
+       if [ "${previous}" != "N" ]; then
+               suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]}
+               stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix
+               prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
+
+               [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue
+       fi
+
+       check_script_status
+
+       case ${runlevel} in
+               0|6)
+                       ${i} stop
+                       ;;
+               *)
+                       ${i} start
+                       ;;
+       esac
+       error_value=${?}
+
+       if [ "${error_value}" != "0" ]; then
+               print_error_msg
+       fi
+done
+
+# End $rc_base/init.d/rc
diff --git a/src/initscripts/init.d/reboot b/src/initscripts/init.d/reboot
new file mode 100644 (file)
index 0000000..fec0c1f
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/reboot
+#
+# Description : Reboot Scripts
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       stop)
+               boot_mesg "Restarting system..."
+               reboot -d -f -i
+               ;;
+
+       *)
+               echo "Usage: ${0} {stop}"
+               exit 1
+               ;;
+
+esac
+
+# End $rc_base/init.d/reboot
diff --git a/src/initscripts/init.d/sendsignals b/src/initscripts/init.d/sendsignals
new file mode 100644 (file)
index 0000000..4c3d05e
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/sendsignals
+#
+# Description : Sendsignals Script
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       stop)
+               boot_mesg "Sending all processes the TERM signal..."
+               killall5 -15
+               error_value=${?}
+
+               sleep ${KILLDELAY}
+
+               if [ "${error_value}" = 0 ]; then
+                       echo_ok
+               else
+                       echo_failure
+               fi
+
+               boot_mesg "Sending all processes the KILL signal..."
+               killall5 -9
+               error_value=${?}
+
+               sleep ${KILLDELAY}
+
+               if [ "${error_value}" = 0 ]; then
+                       echo_ok
+               else
+                       echo_failure
+               fi
+               ;;
+
+       *)
+               echo "Usage: ${0} {stop}"
+               exit 1
+               ;;
+
+esac
+
+# End $rc_base/init.d/sendsignals
diff --git a/src/initscripts/init.d/setclock b/src/initscripts/init.d/setclock
new file mode 100644 (file)
index 0000000..2b97d68
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/setclock
+#
+# Description : Setting Linux Clock
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+. /etc/sysconfig/clock
+
+CLOCKPARAMS=
+
+case "${UTC}" in
+       yes|true|1)
+               CLOCKPARAMS="${CLOCKPARAMS} --utc"
+               ;;
+
+       no|false|0)
+               CLOCKPARAMS="${CLOCKPARAMS} --localtime"
+               ;;
+
+esac
+
+case ${1} in
+       start)
+               boot_mesg "Setting system clock..."
+               hwclock --hctosys ${CLOCKPARAMS} &>/dev/null
+               evaluate_retval
+               ;;
+
+       stop)
+               boot_mesg "Setting hardware clock..."
+               hwclock --systohc ${CLOCKPARAMS} &>/dev/null
+               evaluate_retval
+               ;;
+
+       *)
+               echo "Usage: ${0} {start}"
+               ;;
+
+esac
diff --git a/src/initscripts/init.d/swap b/src/initscripts/init.d/swap
new file mode 100644 (file)
index 0000000..edc63f3
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/swap
+#
+# Description : Swap Control Script
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg "Activating all swap files/partitions..."
+               swapon -a
+               evaluate_retval
+               ;;
+
+       stop)
+               boot_mesg "Deactivating all swap files/partitions..."
+               swapoff -a
+               evaluate_retval
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+
+       status)
+               boot_mesg "Retrieving swap status." ${INFO}
+               echo_ok
+               echo
+               swapon -s
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/swap
diff --git a/src/initscripts/init.d/sysctl b/src/initscripts/init.d/sysctl
new file mode 100644 (file)
index 0000000..0d0b5c1
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/sysctl
+#
+# Description : File uses /etc/sysctl.conf to set kernel runtime
+#               parameters
+#
+# Authors     : Nathan Coulson (nathan@linuxfromscratch.org)
+#               Matthew Burgress (matthew@linuxfromscratch.org)
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               if [ -f "/etc/sysctl.conf" ]; then
+                       boot_mesg "Setting kernel runtime parameters..."
+                       sysctl -q -p
+                       evaluate_retval
+               fi
+               ;;
+
+       status)
+               sysctl -a       
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/sysctl
diff --git a/src/initscripts/init.d/sysklogd b/src/initscripts/init.d/sysklogd
new file mode 100644 (file)
index 0000000..1912df4
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/sysklogd
+#
+# Description : Sysklogd loader
+#
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg "Starting system log daemon..."
+               loadproc syslogd -m 0
+
+               boot_mesg "Starting kernel log daemon..."
+               loadproc klogd
+               ;;
+
+       stop)
+               boot_mesg "Stopping kernel log daemon..."
+               killproc klogd
+
+               boot_mesg "Stopping system log daemon..."
+               killproc syslogd
+               ;;
+
+       reload)
+               boot_mesg "Reloading system log daemon config file..."
+               reloadproc syslogd 1
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+
+       status)
+               statusproc syslogd
+               statusproc klogd
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|reload|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/sysklogd
diff --git a/src/initscripts/init.d/template b/src/initscripts/init.d/template
new file mode 100644 (file)
index 0000000..69dc2a6
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/
+#
+# Description :
+#
+# Authors     :
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg "Starting..."
+               loadproc
+               ;;
+
+       stop)
+               boot_mesg "Stopping..."
+               killproc
+               ;;
+
+       reload)
+               boot_mesg "Reloading..."
+               reloadproc
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+
+       status)
+               statusproc
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|reload|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/
diff --git a/src/initscripts/init.d/udev b/src/initscripts/init.d/udev
new file mode 100644 (file)
index 0000000..0cb97cd
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/udev
+#
+# Description : Udev cold-plugging script
+#
+# Authors     : Zack Winkles, Alexander E. Patrakov
+#
+# Version     : 00.02
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg "Populating /dev with device nodes..."
+               if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
+                       echo_failure
+                       boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
+                       boot_mesg -n " devices without a SysFS filesystem"
+                       boot_mesg -n "\n\nAfter you press Enter, this system"
+                       boot_mesg -n " will be halted and powered off."
+                       boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+                       boot_mesg "" ${NORMAL}
+                       read ENTER
+                       /etc/rc.d/init.d/halt stop
+               fi
+
+               # Mount a temporary file system over /dev, so that any devices
+               # made or removed during this boot don't affect the next one.
+               # The reason we don't write to mtab is because we don't ever
+               # want /dev to be unavailable (such as by `umount -a').
+               mount -n -t tmpfs tmpfs /dev -o mode=755
+               if [ ${?} != 0 ]; then
+                       echo_failure
+                       boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
+                       boot_mesg -n " onto /dev, this system will be halted."
+                       boot_mesg -n "\n\nAfter you press Enter, this system"
+                       boot_mesg -n " will be halted and powered off."
+                       boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+                       boot_mesg "" ${NORMAL}
+                       read ENTER
+                       /etc/rc.d/init.d/halt stop
+               fi
+
+               # Udev handles uevents itself, so we don't need to have
+               # the kernel call out to any binary in response to them
+               echo > /proc/sys/kernel/hotplug
+
+               # Copy static device nodes to /dev
+               cp -a /lib/udev/devices/* /dev
+
+               # Start the udev daemon to continually watch for, and act on,
+               # uevents
+               /sbin/udevd --daemon
+
+               # Now traverse /sys in order to "coldplug" devices that have
+               # already been discovered
+               /sbin/udevtrigger
+
+               # Now wait for udevd to process the uevents we triggered
+               /sbin/udevsettle
+               evaluate_retval
+
+               ;;
+
+       *)
+               echo "Usage ${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/udev
diff --git a/src/initscripts/init.d/udev_retry b/src/initscripts/init.d/udev_retry
new file mode 100644 (file)
index 0000000..82f0580
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/udev_retry
+#
+# Description : Udev cold-plugging script (retry)
+#
+# Authors     : Alexander E. Patrakov
+#
+# Version     : 00.02
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg "Retrying failed uevents, if any..."
+               # Re-trigger the failed uevents in hope they will succeed now
+               # If there are none, the "No such file or directory" error
+               # goes to /dev/null
+               for file in /dev/.udev/failed/*/uevent ; do
+                       echo "add" >"${file}"
+               done 2>/dev/null
+               
+               # Now wait for udevd to process the uevents we triggered
+               /sbin/udevsettle
+               evaluate_retval
+               ;;
+
+       *)
+               echo "Usage ${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/udev_retry
diff --git a/src/initscripts/sysconfig/clock b/src/initscripts/sysconfig/clock
new file mode 100644 (file)
index 0000000..d5d1c2f
--- /dev/null
@@ -0,0 +1,5 @@
+# Begin /etc/sysconfig/clock
+
+UTC=1
+
+# End /etc/sysconfig/clock
diff --git a/src/initscripts/sysconfig/createfiles b/src/initscripts/sysconfig/createfiles
new file mode 100644 (file)
index 0000000..8d1f89d
--- /dev/null
@@ -0,0 +1,28 @@
+########################################################################
+# Begin /etc/sysconfig/createfiles
+#
+# Description : Createfiles script config file
+#
+# Authors     :
+#
+# Version     : 00.00
+#
+# Notes       : The syntax of this file is as follows:
+#              if type is equal to "file" or "dir"
+#              <filename> <type> <permissions> <user> <group>
+#              if type is equal to "dev"
+#              <filename> <type> <permissions> <user> <group> <devtype> <major> <minor>
+#
+#              <filename> is the name of the file which is to be created
+#              <type> is either file, dir, or dev.
+#                      file creates a new file
+#                      dir creates a new directory
+#                      dev creates a new device
+#              <devtype> is either block, char or pipe
+#                      block creates a block device
+#                      char creates a character deivce
+#                      pipe creates a pipe, this will ignore the <major> and <minor> fields
+#              <major> and <minor> are the major and minor numbers used for the device.
+########################################################################
+
+# End /etc/sysconfig/createfiles
diff --git a/src/initscripts/sysconfig/modules b/src/initscripts/sysconfig/modules
new file mode 100644 (file)
index 0000000..1c8493d
--- /dev/null
@@ -0,0 +1,18 @@
+########################################################################
+# Begin /etc/sysconfig/modules
+#
+# Description : Module auto-loading configuration
+#
+# Authors     :
+#
+# Version     : 00.00
+#
+# Notes       : The syntax of this file is as follows:
+#              <module> [<arg1> <arg2> ...]
+#
+# Each module should be on it's own line, and any options that you want
+# passed to the module should follow it.  The line deliminator is either
+# a space or a tab.
+########################################################################
+
+# End /etc/sysconfig/modules
diff --git a/src/initscripts/sysconfig/network b/src/initscripts/sysconfig/network
new file mode 100644 (file)
index 0000000..3061057
--- /dev/null
@@ -0,0 +1 @@
+HOSTNAME=ipfirebox
diff --git a/src/initscripts/sysconfig/rc b/src/initscripts/sysconfig/rc
new file mode 100644 (file)
index 0000000..2333ff4
--- /dev/null
@@ -0,0 +1,18 @@
+########################################################################
+# Begin /etc/sysconfig/rc
+#
+# Description : rc script configuration
+#
+# Authors     :
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+rc_base=/etc/rc.d
+rc_functions=${rc_base}/init.d/functions
+network_devices=/etc/sysconfig/network-devices
+
+# End /etc/sysconfig/rc
index 9cffcea..b18e221 100644 (file)
@@ -760,8 +760,11 @@ int main(int argc, char *argv[])
        mysystem("/bin/mount -t proc none /harddisk/proc");
        mysystem("/bin/mount --bind /dev /harddisk/dev");
 
+
+
        /* if we detected SCSI then fixup */
-       mysystem("/bin/probecntrl.sh");
+       /* doesn't really work cause it sometimes creates a ramdisk on ide systems */
+/*     mysystem("/bin/probecntrl.sh");
        if ((handle = fopen("/cntrldriver", "r")))
        {
                char *driver;
@@ -780,7 +783,7 @@ int main(int argc, char *argv[])
                        runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
                        mysystem("/bin/chroot /harddisk /bin/mv /boot/grub/scsigrub.conf /boot/grub/grub.conf");
                }
-       }
+       } */
 
        /* Build cache lang file */
        snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
@@ -808,6 +811,9 @@ int main(int argc, char *argv[])
                goto EXIT;
        }
 
+       /* Update /etc/fstab */
+       replace( "/harddisk/etc/fstab", "DEVICE", hdparams.devnode);
+
        /* Install bootsplash */
        mysystem("/bin/installbootsplash.sh");
 
@@ -815,9 +821,11 @@ int main(int argc, char *argv[])
        mysystem("umount /harddisk/proc");
        mysystem("umount /harddisk/dev");
 
-       sprintf(message, ctr[TR_CONGRATULATIONS_LONG],
-                       NAME, SNAME, SNAME, NAME, NAME, NAME);
-       newtWinMessage(ctr[TR_CONGRATULATIONS], ctr[TR_OK], message);
+       if (!unattended) {
+               sprintf(message, ctr[TR_CONGRATULATIONS_LONG],
+                               NAME, SNAME, SNAME, NAME, NAME, NAME);
+               newtWinMessage(ctr[TR_CONGRATULATIONS], ctr[TR_OK], message);
+       }
                 
        allok = 1;