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"
12 test_devices=/sys/block/*
14 initrd_version=$(/bin/cat /pl_version)
17 for device in $test_devices; do
18 device=$(/bin/basename $device)
20 # skipping any devices that start with md or ra (ram) or lo (loop) or
22 start_device=${device:0:2}
23 if [ "$start_device" == "ra" ] || [ "$start_device" == "md" ] ||
24 [ "$start_device" == "lo" ] || [ "$start_device" == "fd" ]; then
28 echo "pl_sysinit: checking $device for /usr contents"
29 /bin/mount -o ro -t iso9660 /dev/$device /usr 2>&1 > /dev/null
31 # it mounted, but we should probably make sure its our boot cd
32 # this can be done by making sure the /pl_version file (on initrd)
33 # matches /usr/isolinux/pl_version
34 cd_version=$(/bin/cat /usr/isolinux/pl_version)
36 if [ "$initrd_version" != "$cd_version" ]; then
37 # eh, wrong cd, keep trying
38 /bin/umount /usr 2>&1 /dev/null
40 echo "pl_sysinit: found cd and mounted on /usr"
47 echo "pl_sysinit: configuring kernel parameters"
48 /sbin/sysctl -e -p /etc/sysctl.conf
50 echo "pl_sysinit: bringing network online"
51 /etc/init.d/pl_netinit
54 if [ $mounted -eq 0 -a -f "/etc/planetlab/nfs_server" ]; then
55 echo "pl_sysinit: starting portmap"
58 nfs_server=$(cat /etc/planetlab/nfs_server)
59 /bin/mount -t nfs -o nfsvers=2 ${nfs_server}:/planetlab/bootcd /usr
63 # it mounted, but we should probably make sure its our boot cd
64 # this can be done by making sure the /pl_version file (on initrd)
65 # matches /usr/isolinux/pl_version
66 cd_version=$(/bin/cat /usr/isolinux/pl_version)
68 if [ "$initrd_version" != "$cd_version" ]; then
69 # eh, wrong cd, keep trying
70 echo "pl_sysinit: wrong version $initrd_version != $cd_version"
71 /bin/umount /usr 2>&1 /dev/null
73 echo "pl_sysinit: found cd on nfs server and mounted on /usr"
76 if [ $mounted -eq 1 ] ; then
77 read i0 i1 i2 i3 m0 m1 m2 m3 < \
78 <(IFS=. ; echo $(ifconfig eth0 | sed -ne "s/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1.\2/p"))
79 realaddr="$i0.$i1.$i2.$i3"
80 mkdir -p /tmp/conffilemount
81 /bin/mount -t nfs -o nfsvers=2 ${nfs_server}:/planetlab/nodes/${realaddr} /tmp/conffilemount
82 if [ $? -eq 0 ] ; then
83 cp /tmp/conffilemount/plnode.txt /tmp
85 /bin/umount /usr 2>&1 /dev/null
92 if [ $mounted -eq 0 ]; then
93 echo "pl_sysinit: unable to find boot cdrom, cannot continue."
94 # todo: maybe we can put a staticly linked sshd here
99 # parts of this were copied from devmap_mknod.sh from the device-mapper
100 # source. Since fedora decided not to include it in the rpm, it is
102 echo "pl_sysinit: creating device mapper control node"
105 DM_NAME="device-mapper"
107 CONTROL="$DIR/control"
109 MAJOR=$(sed -n 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices)
110 MINOR=$(sed -n "s/^ *\([0-9]\+\) \+$DM_NAME\$/\1/p" /proc/misc)
112 if [ -n "$MAJOR" ] && [ -n "$MINOR" ]; then
113 /bin/mkdir -p --mode=755 $DIR
115 /bin/mknod --mode=600 $CONTROL c $MAJOR $MINOR
117 echo "pl_sysinit: unable to create device mapper control node, continuing"