summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts
diff options
context:
space:
mode:
authorDrew Moseley <drew_moseley@mentor.com>2014-07-02 18:09:28 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-10 17:38:33 +0100
commit2f7c92c4b5ec780cde4bce866a5095f5472ad88e (patch)
treea352d7646bb64da704c2263209536a08b311f49b /meta/recipes-core/initrdscripts
parentae724e46f477a389096da077167114ea54affa7a (diff)
downloadpoky-2f7c92c4b5ec780cde4bce866a5095f5472ad88e.tar.gz
init-install-efi.sh: improve hard drive searching process
(This patch was originally done against init-install.sh in OE-Core rev 358f0584d779825307eec08c023b5ff14e72cf9e) Previously, only unremovable hard drives are searched and are treated as candidates of target disks to intall into. However, it's possible that we're going to install the live image into a removable media such as an USB. This patch enables this possibility. In addition, this patch presents more information about the hard drives so that user may have more knowledge about which hard drive they are going to install their image into. (From OE-Core rev: 7386acf4ab63a5959e4907b29459b767f2bf2fdb) Signed-off-by: Drew Moseley <drew_moseley@mentor.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi.sh85
1 files changed, 53 insertions, 32 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 34c2ae3066..fcf21cd2f9 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -14,46 +14,67 @@ boot_size=20
14# 5% for swap 14# 5% for swap
15swap_ratio=5 15swap_ratio=5
16 16
17found="no" 17# Get a list of hard drives
18 18hdnamelist=""
19echo "Searching for a hard drive..." 19live_dev_name=${1%%/*}
20for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1' 20
21do 21echo "Searching for hard drives ..."
22 if [ -e /sys/block/${device}/removable ]; then 22
23 if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then 23for device in `ls /sys/block/`; do
24 found="yes" 24 case $device in
25 25 loop*)
26 while true; do 26 # skip loop device
27 # Try sleeping here to avoid getting kernel messages 27 ;;
28 # obscuring/confusing user 28 ram*)
29 sleep 5 29 # skip ram device
30 echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]" 30 ;;
31 read answer 31 *)
32 if [ "$answer" = "y" ] ; then 32 # skip the device LiveOS is on
33 break 33 # Add valid hard drive name to the list
34 fi 34 if [ $device != $live_dev_name -a -e /dev/$device ]; then
35 35 hdnamelist="$hdnamelist $device"
36 if [ "$answer" = "n" ] ; then 36 fi
37 found=no 37 ;;
38 break 38 esac
39 fi 39done
40
41 echo "Please answer y or n"
42 done
43 fi
44 fi
45 40
46 if [ "$found" = "yes" ]; then 41TARGET_DEVICE_NAME=""
47 break; 42for hdname in $hdnamelist; do
43 # Display found hard drives and their basic info
44 echo "-------------------------------"
45 echo /dev/$hdname
46 if [ -r /sys/block/$hdname/device/vendor ]; then
47 echo -n "VENDOR="
48 cat /sys/block/$hdname/device/vendor
49 fi
50 echo -n "MODEL="
51 cat /sys/block/$hdname/device/model
52 cat /sys/block/$hdname/device/uevent
53 echo
54 # Get user choice
55 while true; do
56 echo -n "Do you want to install this image there? [y/n] "
57 read answer
58 if [ "$answer" = "y" -o "$answer" = "n" ]; then
59 break
60 fi
61 echo "Please answer y or n"
62 done
63 if [ "$answer" = "y" ]; then
64 TARGET_DEVICE_NAME=$hdname
65 break
48 fi 66 fi
49 67
50done 68done
51 69
52if [ "$found" = "no" ]; then 70if [ -n "$TARGET_DEVICE_NAME" ]; then
71 echo "Installing image on /dev/$TARGET_DEVICE_NAME ..."
72else
73 echo "No hard drive selected. Installation aborted."
53 exit 1 74 exit 1
54fi 75fi
55 76
56echo "Installing image on /dev/${device}" 77device=$TARGET_DEVICE_NAME
57 78
58# 79#
59# The udev automounter can cause pain here, kill it 80# The udev automounter can cause pain here, kill it