3 echo "pl_sysinit: bringing system online"
5 echo "pl_sysinit: mounting file systems"
8 echo "pl_sysinit: invoking hardware initialization script"
14 if [ -f /usr/isolinux/pl_version ] ; then
15 # it mounted, but we should probably make sure its our boot cd
16 # this can be done by making sure the /pl_version file (on initrd)
17 # matches /usr/isolinux/pl_version
18 initrd_version=$(/bin/cat /pl_version)
19 cd_version=$(/bin/cat /usr/isolinux/pl_version)
20 if [ "$initrd_version" == "$cd_version" ]; then
30 # so that * expands to empty string if there are no block devices
33 for device in /sys/block/*; do
34 device=$(/bin/basename $device)
36 # skipping any devices that start with md or ra (ram) or lo
37 # (loop) or fd (floppy)
39 start_device=${device:0:2}
40 if [ "$start_device" == "ra" ] || [ "$start_device" == "md" ] ||
41 [ "$start_device" == "lo" ] || [ "$start_device" == "fd" ]; then
45 # If this is a removable (e.g., USB flash) device, then try to
46 # look for an ISO image on each of its partitions.
47 if [ "$(cat /sys/block/$device/removable)" = "1" ] ; then
48 partitions=$(/bin/awk "\$4 ~ /${device}[0-9]*/ { print \$4 }" /proc/partitions)
49 for partition in $partitions ; do
50 echo "pl_sysinit: checking $partition for iso image"
51 mkdir -p /tmp/$partition
52 if /bin/mount -o ro -t msdos,ext2 /dev/$partition /tmp/$partition 2>&1 > /dev/null ; then
53 # Look for the first ISO image
54 for iso in /tmp/$partition/*.iso ; do
55 if /sbin/losetup /dev/loop0 $iso ; then
56 echo "pl_sysinit: using $(basename $iso) on $partition"
61 if [ "$device" != "loop0" ] ; then
62 /bin/umount /tmp/$partition 2>&1 > /dev/null
68 echo "pl_sysinit: checking $device for /usr contents"
69 /bin/mount -o ro -t iso9660 /dev/$device /usr 2>&1 > /dev/null
71 # it mounted, but we should probably make sure its our boot cd
72 # this can be done by making sure the /pl_version file (on initrd)
73 # matches /usr/isolinux/pl_version
74 initrd_version=$(/bin/cat /pl_version)
75 cd_version=$(/bin/cat /usr/isolinux/pl_version)
77 if [ "$initrd_version" != "$cd_version" ]; then
78 # eh, wrong cd, keep trying
79 /bin/umount /usr 2>&1 /dev/null
81 echo "pl_sysinit: found cd and mounted on /usr"
90 echo "pl_sysinit: finding cd to mount on /usr"
96 [ ! -d /usr ] && mkdir /usr
98 [ $? -eq 1 ] && mounted=1
101 if [ $mounted -eq 0 ]; then
102 echo "pl_sysinit: unable to find boot cdrom, cannot continue."
103 # todo: maybe we can put a staticly linked sshd here
104 /sbin/shutdown -h now
108 # parts of this were copied from devmap_mknod.sh from the device-mapper
109 # source. Since fedora decided not to include it in the rpm, it is
111 echo "pl_sysinit: creating device mapper control node"
114 DM_NAME="device-mapper"
116 CONTROL="$DIR/control"
118 MAJOR=$(sed -n 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices)
119 MINOR=$(sed -n "s/^ *\([0-9]\+\) \+$DM_NAME\$/\1/p" /proc/misc)
121 if [ -n "$MAJOR" ] && [ -n "$MINOR" ]; then
122 /bin/mkdir -p --mode=755 $DIR
124 /bin/mknod --mode=600 $CONTROL c $MAJOR $MINOR
126 echo "pl_sysinit: unable to create device mapper control node, continuing"
129 echo "pl_sysinit: configuring kernel parameters"
130 /sbin/sysctl -e -p /etc/sysctl.conf
132 echo "pl_sysinit: bringing network online"
133 /etc/init.d/pl_netinit