summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh98
1 files changed, 55 insertions, 43 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index d2a0db3183..c892075145 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -13,46 +13,66 @@ boot_size=20
13# 5% for the swap 13# 5% for the swap
14swap_ratio=5 14swap_ratio=5
15 15
16found="no" 16# Get a list of hard drives
17 17hdnamelist=""
18echo "Searching for a hard drive..." 18live_dev_name=${1%%/*}
19for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1' 19
20 do 20echo "Searching for hard drives ..."
21 if [ -e /sys/block/${device}/removable ]; then 21
22 if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then 22for device in `ls /sys/block/`; do
23 found="yes" 23 case $device in
24 24 loop*)
25 while true; do 25 # skip loop device
26 # Try sleeping here to avoid getting kernel messages 26 ;;
27 # obscuring/confusing user 27 ram*)
28 sleep 5 28 # skip ram device
29 echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]" 29 ;;
30 read answer 30 *)
31 if [ "$answer" = "y" ] ; then 31 # skip the device LiveOS is on
32 break 32 # Add valid hard drive name to the list
33 fi 33 if [ $device != $live_dev_name -a -e /dev/$device ]; then
34 34 hdnamelist="$hdnamelist $device"
35 if [ "$answer" = "n" ] ; then 35 fi
36 found=no 36 ;;
37 break 37 esac
38 fi 38done
39
40 echo "Please answer by y or n"
41 done
42 fi
43 fi
44
45 if [ "$found" = "yes" ]; then
46 break;
47 fi
48 39
40TARGET_DEVICE_NAME=""
41for hdname in $hdnamelist; do
42 # Display found hard drives and their basic info
43 echo "-------------------------------"
44 echo /dev/$hdname
45 if [ -r /sys/block/$hdname/device/vendor ]; then
46 echo -n "VENDOR="
47 cat /sys/block/$hdname/device/vendor
48 fi
49 echo -n "MODEL="
50 cat /sys/block/$hdname/device/model
51 cat /sys/block/$hdname/device/uevent
52 echo
53 # Get user choice
54 while true; do
55 echo -n "Do you want to install this image there? [y/n] "
56 read answer
57 if [ "$answer" = "y" -o "$answer" = "n" ]; then
58 break
59 fi
60 echo "Please answer y or n"
61 done
62 if [ "$answer" = "y" ]; then
63 TARGET_DEVICE_NAME=$hdname
64 break
65 fi
49done 66done
50 67
51if [ "$found" = "no" ]; then 68if [ -n "$TARGET_DEVICE_NAME" ]; then
52 exit 1 69 echo "Installing image on /dev/$TARGET_DEVICE_NAME ..."
70else
71 echo "No hard drive selected. Installation aborted."
72 exit 1
53fi 73fi
54 74
55echo "Installing image on /dev/${device}" 75device=$TARGET_DEVICE_NAME
56 76
57# 77#
58# The udev automounter can cause pain here, kill it 78# The udev automounter can cause pain here, kill it
@@ -65,14 +85,6 @@ rm -f /etc/udev/scripts/mount*
65# 85#
66umount /dev/${device}* 2> /dev/null || /bin/true 86umount /dev/${device}* 2> /dev/null || /bin/true
67 87
68if [ ! -b /dev/sda ] ; then
69 mknod /dev/sda b 8 0
70fi
71
72if [ ! -b /dev/sdb ] ; then
73 mknod /dev/sdb b 8 16
74fi
75
76if [ ! -b /dev/loop0 ] ; then 88if [ ! -b /dev/loop0 ] ; then
77 mknod /dev/loop0 b 7 0 89 mknod /dev/loop0 b 7 0
78fi 90fi