2 # (c) 2007 Paul Sokolovsky
5 # If root is explicitly specified, skip interactive selection
6 if [ -z "$ROOT_DEVICE" ]; then
7 ##############################
13 if ! (echo " " | read -n1 foo) >/dev/null 2>&1; then
14 echo "'read' command lacks -n switch support, aborting"
24 if [ -n "$list" ]; then
36 if [ $cnt == $num ]; then
39 echo -e "$cnt: $l${E}0m"
47 sel=`echo -e $list | \
49 if [ $cnt == $num ]; then
59 # fstype=`mount -f --guess-fstype /dev/$dev $MOUNTLOC`
60 fstype=`fstype </dev/$dev`
61 fstype=`expr "$fstype" : 'FSTYPE=\([A-Za-z0-9]*\).*'`
66 # Scan a device for loopback images, add to the list if found
67 mount /dev/$dev $MOUNTLOC
70 for img in `ls -1 $LOOP_IMG_MASK 2>/dev/null`; do
71 add_menu_item "$dev/$img (loop img on vfat)"
77 # Scan all available device/partitions
78 while read maj min nblk dev; do
79 if [ -z "$maj" -o "$maj" == "major" ]; then
84 if [ "$fstype" != "ext2" -a "$fstype" != "ext3" -a "$fstype" != "vfat" -a "$fstype" != "jffs2" ]; then
89 if [ "$fstype" == "vfat" ]; then
94 add_menu_item "$dev ($fstype)"
95 done < /proc/partitions
97 add_menu_item "NFS (nfsroot=192.168.2.200:/srv/nfs/oe/image)"
100 total=`echo -e $list | wc -l`
106 echo -e -n "${E}0;0H"
107 echo "Select boot image:"
115 if [ $num -lt 0 ]; then
121 if [ $num -ge $total ]; then
138 # Process results of user selection, prepare input arguments
144 dev=`expr "$sel" : '\([^ /]*\)'`
145 path=`expr "$sel" : '[^/]*\([^ ]*\).*'`
146 fstype=`expr "$sel" : '[^ ]* *\(.*\)'`
148 if [ "$dev" == "Shell" ]; then
150 elif [ "$dev" == "NFS" ]; then
151 ROOT_DEVICE="/dev/nfs"
152 CMDLINE="$CMDLINE root=/dev/nfs nfsroot=192.168.2.200:/srv/nfs/oe/image"
153 elif [ -n "$path" ]; then
154 ROOT_DEVICE="/dev/loop"
155 CMDLINE="$CMDLINE root=/dev/loop looproot=/dev/$dev:$path"
157 ROOT_DEVICE="/dev/$dev"
158 # jffs2 is not recognized by mount automagically
159 if [ "$fstype" == "(jffs2)" ]; then
162 CMDLINE="$CMDLINE root=$ROOT_DEVICE"
165 echo ROOT_DEVICE=$ROOT_DEVICE
166 echo CMDLINE=$CMDLINE
168 ##############################