summaryrefslogtreecommitdiff
path: root/source/installer/sources/initrd/etc/rc.d
diff options
context:
space:
mode:
Diffstat (limited to 'source/installer/sources/initrd/etc/rc.d')
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.S250
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.dropbear58
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.font45
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.ieee139448
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.inet128
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.pcmcia65
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.udev133
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.usb71
8 files changed, 698 insertions, 0 deletions
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.S b/source/installer/sources/initrd/etc/rc.d/rc.S
new file mode 100755
index 00000000..38317b4d
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.S
@@ -0,0 +1,250 @@
+#!/bin/sh
+# rc.S: Basic system initialization.
+
+# Any /etc/mtab that exists here is old, so we start with a new one:
+/bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab
+
+# Add (fake) entry for / to /etc/mtab:
+/sbin/mount -f -w /dev/initramfs / -t tmpfs 1> /dev/null
+
+# Mount /proc:
+/sbin/mount -v proc /proc -t proc 1> /dev/null
+
+# Mount sysfs next:
+/sbin/mount -v sysfs /sys -t sysfs 1> /dev/null
+
+# Activate swap:
+/sbin/swapon -a 1> /dev/null
+
+if [ -x /sbin/ldconfig ]; then
+ /sbin/ldconfig 1> /dev/null
+fi
+
+## Detect serial console from kernel command line:
+#if cat /proc/cmdline | grep console=ttyS 1> /dev/null 2> /dev/null ; then
+# SERIAL_CONSOLE="true"
+#fi
+
+# System logger (mostly to eat annoying messages):
+/sbin/syslogd 2> /dev/null
+sleep 1
+/sbin/klogd -c 3 1> /dev/null
+
+# Try to load the loop module:
+modprobe loop 1> /dev/null 2> /dev/null
+
+# Run udev:
+if ! grep -wq noudev /proc/cmdline ; then
+ /bin/bash /etc/rc.d/rc.udev start
+
+ # Re-assemble RAID volumes:
+ /sbin/mdadm -E -s > /etc/mdadm.conf
+ /sbin/mdadm -S -s
+ /sbin/mdadm -A -s
+ # This seems to make the kernel see partitions more reliably:
+ fdisk -l /dev/md* 1> /dev/null 2> /dev/null
+else
+ # Run our old detection routines:
+
+ # Look for USB keyboard or storage:
+ /etc/rc.d/rc.usb start
+ sleep 3
+
+ # Look for IEEE1394 devices:
+ if grep 1394 /proc/pci 1> /dev/null 2> /dev/null ; then
+ /etc/rc.d/rc.ieee1394 start
+ #sleep 3
+ fi
+
+ # Load additional install floppies:
+ for NEWDISK in 2 ; do
+ if [ ! -r /etc/disk${NEWDISK} ]; then
+ while [ 0 ]; do
+ echo
+ echo -n "Insert install.${NEWDISK} floppy disk to be loaded into RAM disk and press ENTER"
+ read readfoo;
+ if [ "$readfoo" = "Q" -o "$readfoo" = "q" ]; then
+ break;
+ fi
+ echo -n "Loading install.${NEWDISK} floppy into RAM disk... "
+ ( cd / ; cat /dev/fd0 | zcat 2> /dev/null | tar xf - )
+ if [ -r /etc/disk${NEWDISK} ]; then
+ echo "done."
+ echo
+ break;
+ else
+ echo "Error. (reload or enter Q)"
+ echo
+ continue;
+ fi
+ done
+ fi
+ done
+
+ ### PROBABLY USELESS WITHOUT SOME TIMED DELAY ABOVE
+ ## Start USB again (in case we missed a USB keyboard)
+ #/etc/rc.d/rc.usb start
+
+ # Make detected partitions:
+ /dev/makedevs.sh
+
+ ## Not needed with CONFIG_SCSI_MULTI_LUN=y
+ #unset SCAN
+ ## Now we should rescan the "SCSI" bus to look for new USB or firewire devices
+ ## that look like SCSI devices:
+ #if [ -r /proc/bus/usb/devices ]; then
+ # if cat /proc/bus/usb/devices | grep -w usb-storage 1> /dev/null 2> /dev/null ; then
+ # SCAN="true"
+ # fi
+ #fi
+ #if [ -r /proc/bus/ieee1394/devices ]; then
+ # if cat /proc/bus/ieee1394/devices | grep -w SBP2 1> /dev/null 2> /dev/null ; then
+ # SCAN="true"
+ # fi
+ #fi
+ #if [ "$SCAN" = "true" ]; then
+ # if ! cat /proc/cmdline | grep -q noscanluns 2> /dev/null ; then
+ # echo "Detected new USB/IEEE1394 storage devices... scanning all LUNs."
+ # echo "(to skip, give a 'noscanluns' kernel option at boot)"
+ # #sleep 5
+ # sh /sbin/rescan-scsi-bus -l
+ # #sleep 1
+ # fi
+ #fi
+ #unset SCAN
+
+ # Re-assemble RAID volumes:
+ /sbin/mdadm -E -s > /etc/mdadm.conf
+ /sbin/mdadm -S -s
+ /sbin/mdadm -A -s
+ # This seems to make the kernel see partitions more reliably:
+ fdisk -l /dev/md* 1> /dev/null 2> /dev/null
+
+ # Check /proc/partitions again:
+ /dev/makedevs.sh
+
+ # Create LVM nodes:
+ /dev/devmap_mknod.sh
+
+fi # End Run udev:
+
+# Here's the situation. Because of the practice of keeping the local
+# time (rather than UTC) in the system's clock, at any given time half
+# of the people doing an install will be creating files that upon
+# reboot will appear to have been created in the future.
+#
+# There are a lot of things that aren't happy when that happens. The
+# one that screams the most loudly is e2fsck, and we don't want to
+# anger that! Sometimes it even proceeds to check the partitions just
+# to be sure the user is fully punished.
+#
+# But, there's a simple solution. If we set the (temporary) Linux clock
+# to yesterday (-24h), then there's no way that could occur. Everything
+# on the system will be in the past (but not too far in the past).
+# Since files will quickly be put into use and given the correct after
+# reboot, this really shouldn't have a negative impact. Plus, it affects
+# only newly created files during installation -- any file shipped in a
+# package will have an accurate time of creation. (for its timezone ;-)
+#
+# Update: We have to use 2 days ago, or chroot()+timezone offset might
+# still be in the future... <sigh>
+#
+touch /.today
+/bin/sh /sbin/fakedate
+
+if [ -x /etc/rc.d/rc.inet1 ]; then
+ /bin/sh /etc/rc.d/rc.inet1
+fi
+
+# pcmciautils is installing rc.pcmcia as chmod 644, so we'll change that.
+# It won't be run at boot time, but it'll make it easy for the pcmcia script
+# or to run it from the command line.
+chmod 755 /etc/rc.d/rc.pcmcia
+
+# Scan for existing LVM partitions:
+# We will run 'vgscan -ay' in the setup to prevent a 10 second sleep;
+vgscan --mknodes 2> /tmp/foo
+cat /tmp/foo | uniq
+rm -f /tmp/foo
+
+if [ -x /etc/rc.d/rc.font ]; then
+ /bin/sh /etc/rc.d/rc.font
+fi
+
+# Don't automatically blank the screen, or it will go black during the install
+# process when stray keystrokes might be dangerous:
+/bin/setterm -blank 0
+
+echo > /etc/motd
+echo "`/bin/uname -a | /bin/cut -d\ -f1,3`." >> /etc/motd
+echo >> /etc/motd
+cat << EOF >> /etc/motd
+If you're upgrading an existing Slackware system, you might want to
+remove old packages before you run 'setup' to install the new ones. If
+you don't, your system will still work but there might be some old files
+left laying around on your drive.
+
+Just mount your Linux partitions under /mnt and type 'pkgtool'. If you
+don't know how to mount your partitions, type 'pkgtool' and it will tell
+you how it's done.
+
+To partition your hard drive(s), use 'cfdisk' or 'fdisk'.
+To start the main installation (after partitioning), type 'setup'.
+
+EOF
+
+# Dropbear seems to handle the $PATH correctly now...
+#echo > /etc/motd.net
+#echo "First command to run is 'source /etc/profile'." >> /etc/motd.net
+#echo "This will setup the PATH for you." >> /etc/motd.net
+#echo >> /etc/motd.net
+
+# If possible, figure out what kernel we just booted with:
+unset SLACK_KERNEL
+for ARG in `cat /proc/cmdline` ; do
+ if [ "`echo $ARG | cut -f 1 -d =`" = "SLACK_KERNEL" ]; then
+ IMAGE="`echo $ARG | cut -f 2 -d =`"
+ SLACK_KERNEL=$IMAGE
+ fi
+done
+export SLACK_KERNEL
+
+. /etc/profile
+
+clear
+if ! cat /proc/cmdline | grep -q 'kbd=' 2> /dev/null ; then
+ echo
+ echo
+ echo "<OPTION TO LOAD SUPPORT FOR NON-US KEYBOARD>"
+ echo
+ echo "If you are not using a US keyboard, you may now load a different"
+ echo "keyboard map. To select a different keyboard map, please enter 1"
+ echo "now. To continue using the US map, just hit enter."
+ echo
+ echo -n "Enter 1 to select a keyboard map: "
+ read ONE
+ if [ "$ONE" = "1" ]; then
+ /usr/lib/setup/SeTkeymap
+ fi
+else
+ for ARG in `cat /proc/cmdline` ; do
+ if [ "`echo $ARG | cut -f1 -d=`" = "kbd" ]; then
+ BMAP="`echo $ARG | cut -f2 -d=`.bmap"
+ fi
+ done
+ tar xzOf /etc/keymaps.tar.gz $BMAP | loadkmap
+ unset BMAP
+fi
+clear
+
+# Provision for unattended network configuration:
+/usr/lib/setup/SeTnet boot
+# Start dropbear ssh server (only if a configured interface is present):
+/etc/rc.d/rc.dropbear start
+
+# Fake login: (fooled ya! ;^)
+
+cat /etc/issue
+echo -n "slackware login: "
+read BOGUS_LOGIN
+cat /etc/motd
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.dropbear b/source/installer/sources/initrd/etc/rc.d/rc.dropbear
new file mode 100755
index 00000000..a9ed47fd
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.dropbear
@@ -0,0 +1,58 @@
+#!/bin/sh
+# Start/stop/restart the dropbear secure shell server:
+
+# Terminate the script now if we have no interface with an IP address:
+if ! `ip -f inet -o addr show | grep -v " lo " 1>/dev/null 2>/dev/null` ; then
+ exit 1
+fi
+
+dropbear_start() {
+ # Create host keys if needed.
+ if [ ! -f /etc/dropbear/dropbear_rsa_host_key ]; then
+ /bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+ fi
+ if [ ! -f /etc/dropbear/dropbear_dss_host_key ]; then
+ /bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
+ fi
+ touch /var/log/lastlog # The file is missing in the installer
+ /sbin/dropbear 2>> /var/log/dropbear.log
+}
+
+dropbear_stop() {
+ killall dropbear
+}
+
+dropbear_restart() {
+ if [ -r /var/run/dropbear.pid ]; then
+ echo "WARNING: killing listener process only. To kill every dropbear process, you "
+ echo " must use 'rc.dropbear stop'. 'rc.dropbear restart' kills only the "
+ echo " parent dropbear to allow an admin logged in through dropbear to use "
+ echo " 'rc.dropbear restart' without being cut off. If dropbear has been "
+ echo " upgraded, new connections will now use the new version, which should "
+ echo " be a safe enough approach."
+ kill `cat /var/run/dropbear.pid`
+ else
+ echo "WARNING: There does not appear to be a parent instance of dropbear running."
+ echo " If you really want to kill all running instances of dropbear "
+ echo " (including any sessions currently in use), run "
+ echo " '/etc/rc.d/rc.dropbear stop' instead."
+ exit 1
+ fi
+ sleep 1
+ dropbear_start
+}
+
+case "$1" in
+'start')
+ dropbear_start
+ ;;
+'stop')
+ dropbear_stop
+ ;;
+'restart')
+ dropbear_restart
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
+
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.font b/source/installer/sources/initrd/etc/rc.d/rc.font
new file mode 100755
index 00000000..69e69baa
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.font
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Load terminus font. This is either to resize the terminal to be close to default,
+# or to simply load a better looking font for the installer.
+
+# In case udev has not yet prepared the tty devices, create them:
+create_tty() {
+ if [ ! -r /dev/tty1 ]; then
+ mknod /dev/tty1 c 4 1
+ chown root:tty /dev/tty1
+ chmod 620 /dev/tty1
+ fi
+ if [ ! -r /dev/tty2 ]; then
+ mknod /dev/tty2 c 4 2
+ chown root:tty /dev/tty2
+ chmod 620 /dev/tty2
+ fi
+ if [ ! -r /dev/tty3 ]; then
+ mknod /dev/tty3 c 4 3
+ chown root:tty /dev/tty3
+ chmod 620 /dev/tty3
+ fi
+ if [ ! -r /dev/tty4 ]; then
+ mknod /dev/tty4 c 4 4
+ chown root:tty /dev/tty4
+ chmod 620 /dev/tty4
+ fi
+}
+
+if ! grep -wq nofont /proc/cmdline ; then
+ if [ ! "$(cat /proc/fb)" = "" ] ; then
+ if [ -r /usr/share/kbd/consolefonts/ter-120b.psf.gz ]; then
+ create_tty
+ for tty in /dev/tty{1,2,3,4} ; do
+ setfont -C $tty /usr/share/kbd/consolefonts/ter-120b.psf.gz
+ done
+ fi
+ else
+ if [ -r /usr/share/kbd/consolefonts/ter-c14v.psf.gz ]; then
+ create_tty
+ for tty in /dev/tty{1,2,3,4} ; do
+ setfont -C $tty /usr/share/kbd/consolefonts/ter-c14v.psf.gz
+ done
+ fi
+ fi
+fi
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.ieee1394 b/source/installer/sources/initrd/etc/rc.d/rc.ieee1394
new file mode 100755
index 00000000..2701229d
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.ieee1394
@@ -0,0 +1,48 @@
+#!/bin/sh
+# rc.ieee1394: search for IEEE1394 (firewire) devices needed for installation.
+
+# This is a function to unload the IEEE1394 (firewire) modules:
+ieee1394_stop() {
+ modprobe -r sbp2 ohci1394
+ modprobe -r ieee1394
+}
+
+# This is a function to attempt to enable a IEEE1394 storage device.
+# If this causes problems for you, use "noieee1394" as a kernel
+# command line option at boot time.
+ieee1394_start() {
+ # If noieee1394 was given at boot, skip.
+ if ! cat /proc/cmdline | grep noieee1394 1> /dev/null 2> /dev/null ; then
+ # If there aren't even any modules for this kernel, skip.
+ if [ -d /lib/modules/`uname -r` ]; then
+ # If ieee1394 is already loaded, skip.
+ if ! grep ieee1394 /proc/modules 1> /dev/null 2> /dev/null ; then
+ echo "Probing for IEEE1394 (Firewire) controllers."
+ echo "(to skip, give a 'noieee1394' kernel option at boot)"
+ #sleep 5
+ modprobe -q ieee1394 >/dev/null 2>&1
+ # Try to load hub module:
+ modprobe -q ohci1394 >/dev/null 2>&1
+ # Attempt to load storage support.
+ modprobe -q sbp2 >/dev/null 2>&1
+ fi
+ fi
+ fi
+}
+
+case "$1" in
+'start')
+ ieee1394_start
+ ;;
+'stop')
+ ieee1394_stop
+ ;;
+'restart')
+ ieee1394_stop
+ sleep 5
+ ieee1394_start
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
+
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.inet1 b/source/installer/sources/initrd/etc/rc.d/rc.inet1
new file mode 100755
index 00000000..370de006
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.inet1
@@ -0,0 +1,28 @@
+#! /bin/sh
+#
+# rc.inet1 This shell script boots up the base INET system.
+#
+# Version: @(#)/etc/rc.d/rc.inet1 1.01 05/27/93
+#
+
+TMP=/var/log/setup/tmp
+mkdir -p $TMP/dhcpc
+
+HOSTNAME=`cat /etc/HOSTNAME`
+/bin/hostname `cat /etc/HOSTNAME | cut -f1 -d .`
+
+# Attach the loopback device.
+/sbin/ifconfig lo 127.0.0.1
+/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
+
+# In case we use udev -
+# Try to get information from a local DHCP server and store that for later:
+if ! grep -wq nodhcp /proc/cmdline ; then
+ for EDEV in $(cat /proc/net/dev | grep ':' | sed -e "s/^ *//" | cut -f1 -d: | grep -v lo) ; do
+ if grep -q $(echo ${EDEV}: | cut -f 1 -d :): /proc/net/wireless ; then
+ continue # skip wireless interfaces
+ fi
+ /sbin/dhcpcd -t 35 -L -T $EDEV 1>/etc/dhcpc/dhcpcd-${EDEV}.info 2>/dev/null &
+ done
+fi
+
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.pcmcia b/source/installer/sources/initrd/etc/rc.d/rc.pcmcia
new file mode 100755
index 00000000..1f21be84
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.pcmcia
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# rc.pcmcia: Script to initialize PCMCIA subsystem.
+# Based in an example found in cardmgr-to-pcmciautils.txt
+# and in Slackware rc.pcmcia found in pcmcia-cs package.
+#
+
+# Set this to the driver to use, one of:
+# probe, yenta_socket, i82365, i82092, pd6729, tcic, etc.
+#
+DRIVER=probe
+DRIVER_OPTS=
+
+case "$1" in
+ start)
+ echo "Starting PCMCIA services:"
+ fgrep -q pcmcia /proc/devices
+ if [ $? -ne 0 ] ; then
+ if [ "$DRIVER" = "probe" ]; then
+ echo " <Probing for PCIC: edit /etc/rc.d/rc.pcmcia>"
+ for DRV in yenta_socket i82365 tcic ; do
+ /sbin/modprobe $DRV > /dev/null 2>&1
+ /sbin/pccardctl status | grep -q Socket && break
+ /sbin/modprobe -r $DRV > /dev/null 2>&1
+ done
+ else
+ echo " <Loading PCIC: $DRIVER>"
+ /sbin/modprobe $DRIVER $DRIVER_OPTS > /dev/null 2>&1
+ fi
+ /sbin/modprobe pcmcia > /dev/null 2>&1 # just in case it's not auto-loaded
+ else
+ echo " <PCIC already loaded>"
+ fi
+ ;;
+
+ stop)
+ echo -n "Shutting down PCMCIA services: "
+ echo -n "cards "
+ /sbin/pccardctl eject
+ MODULES=`/sbin/lsmod | grep "pcmcia " | awk '{print $4}' | tr , ' '`
+ for i in $MODULES ; do
+ echo -n "$i "
+ /sbin/modprobe -r $i > /dev/null 2>&1
+ done
+ echo -n "pcmcia "
+ /sbin/modprobe -r pcmcia > /dev/null 2>&1
+ if [ "$DRIVER" = "probe" ]; then
+ for DRV in yenta_socket i82365 tcic ; do
+ grep -qw $DRV /proc/modules && modprobe -r $DRV && \
+ echo -n "$DRV " && break
+ done
+ else
+ /sbin/modprobe -r $DRIVER > /dev/null 2>&1
+ fi
+ echo -n "rsrc_nonstatic "
+ /sbin/modprobe -r rsrc_nonstatic > /dev/null 2>&1
+ echo "pcmcia_core"
+ /sbin/modprobe -r pcmcia_core > /dev/null 2>&1
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+esac
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.udev b/source/installer/sources/initrd/etc/rc.d/rc.udev
new file mode 100755
index 00000000..8c238b0d
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.udev
@@ -0,0 +1,133 @@
+#!/bin/sh
+# This is a script to initialize udev, which populates the /dev
+# directory with device nodes, scans for devices, loads the
+# appropriate kernel modules, and configures the devices.
+
+PATH="/sbin:/bin"
+OPT=""
+
+. /etc/udev/udev.conf
+
+# remove trailing slash from udev_root
+UDEV_ROOT=$(echo "${udev_root}" |sed 's/\/*$//')
+
+case "$1" in
+ start)
+ # Sanity check #1, udev requires that the kernel support tmpfs:
+ if ! grep -wq tmpfs /proc/filesystems ; then
+ echo "Sorry, but you need tmpfs support in the kernel to use udev."
+ echo
+ echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
+ exit 1
+ fi
+
+ # Sanity check #2, make sure that a 2.6.x kernel is new enough:
+ if [ "$(uname -r | cut -f 1,2 -d .)" = "2.6" ]; then
+ if [ "$(uname -r | cut -f 3 -d . | sed 's/[^[:digit:]].*//')" -lt "15" ]; then
+ echo "Sorry, but you need a 2.6.15+ kernel to use udev."
+ echo "Your kernel version is only $(uname -r)."
+ echo
+ echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
+ exit 1
+ fi
+ fi
+
+ # Sanity check #3, make sure the udev package was not removed. If udevd
+ # is not there, this will also shut off this script to prevent further
+ # problems:
+ if [ ! -x /sbin/udevd ]; then
+ chmod 644 /etc/rc.d/rc.udev
+ echo "No udevd daemon found."
+ echo "Turning off udev: chmod 644 /etc/rc.d/rc.udev"
+ echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
+ exit 1
+ fi
+
+ # Disable hotplug helper since udevd listens to netlink:
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo "" > /proc/sys/kernel/hotplug
+ fi
+
+ # if udevd is already running, rc.udev start will try to re-run
+ # failed events. Else, it will start udevd.
+ if ps axc | grep -q udevd ; then
+ OPT="--type=failed $OPT"
+ ( cd ${UDEV_ROOT}/.udev
+ for TMPFILE in tmp-rules-*.rules ; do
+ mv $TMPFILE /etc/udev/rules.d/${TMPFILE/tmp-rules--/} 2>/dev/null
+ done
+ )
+ else
+ # Mount tmpfs on $UDEV_ROOT:
+ if ! grep -E -q "^[^[:space:]]+ $UDEV_ROOT tmpfs" /proc/mounts; then
+ # umount shm if needed
+ if grep -E -q "^[^[:space:]]+ $UDEV_ROOT/shm tmpfs" /proc/mounts; then
+ umount -l $UDEV_ROOT/shm
+ fi
+
+ # Umount pts if needed, we will remount it later:
+ if grep -E -q "^[^[:space:]]+ $UDEV_ROOT/pts devpts" /proc/mounts; then
+ umount -l $UDEV_ROOT/pts
+ fi
+
+ # Mount tmpfs on $UDEV_ROOT:
+ # the -n is because we don't want $UDEV_ROOT umounted when
+ # someone (rc.[06]) calls umount -a
+ mount -n -o mode=0755 -t tmpfs tmpfs $UDEV_ROOT
+
+ # Remount pts:
+ mkdir $UDEV_ROOT/pts 2> /dev/null
+ mount -n -o mode=0620,gid=5 -t devpts devpts $UDEV_ROOT/pts
+ fi
+
+ # Add the static nodes to $UDEV_ROOT:
+ cp --preserve=all --recursive --remove-destination /lib/udev/devices/* $UDEV_ROOT
+
+ # Start udevd:
+ echo "Starting udevd: /sbin/udevd --daemon"
+ /sbin/udevd --daemon
+
+ # Create rootdev rules
+ DEVICENUMBER=$( /bin/stat -c %d / )
+ MAJORNUMBER=$(($DEVICENUMBER / 256))
+ MINORNUMBER=$(($DEVICENUMBER % 256))
+
+ echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$MAJORNUMBER'", ENV{MINOR}=="'$MINORNUMBER'", SYMLINK+="root"' > /dev/.udev/rules.d/61-dev-root-link.rules
+
+ fi
+
+ echo "Triggering udev events: /sbin/udevadm trigger $OPT"
+ # Call udevtrigger and udevsettle to do the device configuration:
+ /sbin/udevadm trigger $OPT && /sbin/udevadm settle --timeout=120
+
+ ;;
+ stop)
+ echo "Stopping udevd"
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo /sbin/hotplug > /proc/sys/kernel/hotplug
+ fi
+ killall udevd
+ ;;
+ restart)
+ echo "Restarting udevd"
+ killall udevd
+ sleep 5
+ udevd --daemon
+ ;;
+ reload)
+ echo "Reloading udev rules"
+ udevadm control --reload-rules
+ cp --preserve=all --recursive --update /lib/udev/devices/* $UDEV_ROOT
+ ;;
+ force-reload)
+ echo "Updating all available device nodes in $UDEV_ROOT"
+ udevadm control --reload-rules
+ rm -rf $UDEV_ROOT/.udev $UDEV_ROOT/disk
+ cp --preserve=all --recursive --update /lib/udev/devices/* $UDEV_ROOT
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|force-reload}"
+ exit 1
+ ;;
+esac
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.usb b/source/installer/sources/initrd/etc/rc.d/rc.usb
new file mode 100755
index 00000000..0c40b5b4
--- /dev/null
+++ b/source/installer/sources/initrd/etc/rc.d/rc.usb
@@ -0,0 +1,71 @@
+#!/bin/sh
+# rc.usb: search for USB devices needed for installation.
+
+# This is a function to unload the USB modules:
+usb_stop() {
+ modprobe -r usb-storage keybdev mousedev usbmouse hid usbkbd \
+ input uhci usb-uhci usb-ohci uhci-hcd ohci-hcd ehci-hcd 2> /dev/null
+ umount usbfs 2> /dev/null
+ modprobe -r usbcore 2> /dev/null
+}
+
+# This is a function to attempt to enable a USB keyboard,
+# mouse, and storage (CD or hard drive).
+# If this causes problems for you, use "nousb" as a kernel
+# command line option at boot time.
+usb_start() {
+ # If nousb was given at boot, skip.
+ if ! cat /proc/cmdline | grep nousb 1> /dev/null 2> /dev/null ; then
+ # If there aren't even any modules for this kernel, skip.
+ if [ -d /lib/modules/`uname -r` ]; then
+ # If usbcore is already loaded, skip.
+ if ! grep usbcore /proc/modules 1> /dev/null 2> /dev/null ; then
+ echo "Probing for USB controllers."
+ echo "(to skip, give a 'nousb' kernel option at boot)"
+ #sleep 5
+ modprobe -q usbcore >/dev/null 2>&1
+ # Try to mount usbfs:
+ if [ -d /proc/bus/usb -a ! -f /proc/bus/usb/devices ]; then
+ mount -t usbfs usbfs /proc/bus/usb
+ fi
+ # Try to load all the hub modules:
+ modprobe -q ehci-hcd >/dev/null 2>&1
+ modprobe -q ohci-hcd >/dev/null 2>&1
+ modprobe -q uhci-hcd >/dev/null 2>&1
+ modprobe -q usb-ohci >/dev/null 2>&1
+ # NOTE: this prefers "uhci"; you may prefer "usb-uhci".
+ #modprobe -q usb-uhci >/dev/null 2>&1 || modprobe -q uhci >/dev/null 2>&1
+ modprobe -q uhci >/dev/null 2>&1 || modprobe -q usb-uhci >/dev/null 2>&1
+ # Load input core:
+ modprobe -q input >/dev/null 2>&1
+ # Load USB keyboard:
+ modprobe -q usbkbd >/dev/null 2>&1
+ # Load Human Interface Device (HID) USB module:
+ modprobe -q hid >/dev/null 2>&1
+ # Load mouse (just in case (TM)) and keyboard USB input modules:
+ modprobe -q mousedev >/dev/null 2>&1
+ modprobe -q keybdev >/dev/null 2>&1
+ # Attempt to load storage support. Some funny USB ports (non-0 LUN) might not work
+ # so well, but most are well-behaved.
+ modprobe -q usb-storage >/dev/null 2>&1
+ fi
+ fi
+ fi
+}
+
+case "$1" in
+'start')
+ usb_start
+ ;;
+'stop')
+ usb_stop
+ ;;
+'restart')
+ usb_stop
+ sleep 5
+ usb_start
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
+