3 echo "pl_sysinit: bringing system online"
5 echo "pl_sysinit: mounting file systems"
8 echo "pl_sysinit: invoking hardware initialization script"
11 echo "pl_sysinit: finding cd to mount on /usr"
13 initrd_version=$(/bin/cat /pl_version)
16 # so that * expands to empty string if there are no block
20 for device in /sys/block/*; do
21 device=$(/bin/basename $device)
23 # skipping any devices that start with md or ra (ram) or lo (loop) or
25 start_device=${device:0:2}
26 if [ "$start_device" == "ra" ] || [ "$start_device" == "md" ] ||
27 [ "$start_device" == "lo" ] || [ "$start_device" == "fd" ]; then
31 # If this is a removable (e.g., USB flash) device, then try to
32 # look for an ISO image on each of its partitions.
33 if [ "$(cat /sys/block/$device/removable)" = "1" ] ; then
34 partitions=$(/bin/awk "\$4 ~ /${device}[0-9]*/ { print \$4 }" /proc/partitions)
35 for partition in $partitions ; do
36 echo "pl_sysinit: checking $partition for iso image"
37 mkdir -p /tmp/$partition
38 if /bin/mount -o ro -t msdos,ext2 /dev/$partition /tmp/$partition 2>&1 > /dev/null ; then
39 # Look for the first ISO image
40 for iso in /tmp/$partition/*.iso ; do
41 if /sbin/losetup /dev/loop0 $iso ; then
42 echo "pl_sysinit: using $(basename $iso) on $partition"
47 if [ "$device" != "loop0" ] ; then
48 /bin/umount /tmp/$partition 2>&1 > /dev/null
54 echo "pl_sysinit: checking $device for /usr contents"
55 /bin/mount -o ro -t iso9660 /dev/$device /usr 2>&1 > /dev/null
57 # it mounted, but we should probably make sure its our boot cd
58 # this can be done by making sure the /pl_version file (on initrd)
59 # matches /usr/isolinux/pl_version
60 cd_version=$(/bin/cat /usr/isolinux/pl_version)
62 if [ "$initrd_version" != "$cd_version" ]; then
63 # eh, wrong cd, keep trying
64 /bin/umount /usr 2>&1 /dev/null
66 echo "pl_sysinit: found cd and mounted on /usr"
73 if [ $mounted -eq 0 ]; then
74 echo "pl_sysinit: unable to find boot cdrom, cannot continue."
75 # todo: maybe we can put a staticly linked sshd here
80 # parts of this were copied from devmap_mknod.sh from the device-mapper
81 # source. Since fedora decided not to include it in the rpm, it is
83 echo "pl_sysinit: creating device mapper control node"
86 DM_NAME="device-mapper"
88 CONTROL="$DIR/control"
90 MAJOR=$(sed -n 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices)
91 MINOR=$(sed -n "s/^ *\([0-9]\+\) \+$DM_NAME\$/\1/p" /proc/misc)
93 if [ -n "$MAJOR" ] && [ -n "$MINOR" ]; then
94 /bin/mkdir -p --mode=755 $DIR
96 /bin/mknod --mode=600 $CONTROL c $MAJOR $MINOR
98 echo "pl_sysinit: unable to create device mapper control node, continuing"
101 echo "pl_sysinit: configuring kernel parameters"
102 /sbin/sysctl -e -p /etc/sysctl.conf
104 echo "pl_sysinit: bringing network online"
105 /etc/init.d/pl_netinit