diff options
author | Drew Moseley <drew_moseley@mentor.com> | 2014-07-02 18:09:28 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-10 17:38:33 +0100 |
commit | 2f7c92c4b5ec780cde4bce866a5095f5472ad88e (patch) | |
tree | a352d7646bb64da704c2263209536a08b311f49b /meta | |
parent | ae724e46f477a389096da077167114ea54affa7a (diff) | |
download | ast2050-yocto-poky-2f7c92c4b5ec780cde4bce866a5095f5472ad88e.zip ast2050-yocto-poky-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')
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-install-efi.sh | 85 |
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 34c2ae3..fcf21cd 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 # 5% for swap swap_ratio=5 -found="no" - -echo "Searching for a hard drive..." -for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1' -do - if [ -e /sys/block/${device}/removable ]; then - if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then - found="yes" - - while true; do - # Try sleeping here to avoid getting kernel messages - # obscuring/confusing user - sleep 5 - echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]" - read answer - if [ "$answer" = "y" ] ; then - break - fi - - if [ "$answer" = "n" ] ; then - found=no - break - fi - - echo "Please answer y or n" - done - fi - fi +# Get a list of hard drives +hdnamelist="" +live_dev_name=${1%%/*} + +echo "Searching for hard drives ..." + +for device in `ls /sys/block/`; do + case $device in + loop*) + # skip loop device + ;; + ram*) + # skip ram device + ;; + *) + # skip the device LiveOS is on + # Add valid hard drive name to the list + if [ $device != $live_dev_name -a -e /dev/$device ]; then + hdnamelist="$hdnamelist $device" + fi + ;; + esac +done - if [ "$found" = "yes" ]; then - break; +TARGET_DEVICE_NAME="" +for hdname in $hdnamelist; do + # Display found hard drives and their basic info + echo "-------------------------------" + echo /dev/$hdname + if [ -r /sys/block/$hdname/device/vendor ]; then + echo -n "VENDOR=" + cat /sys/block/$hdname/device/vendor + fi + echo -n "MODEL=" + cat /sys/block/$hdname/device/model + cat /sys/block/$hdname/device/uevent + echo + # Get user choice + while true; do + echo -n "Do you want to install this image there? [y/n] " + read answer + if [ "$answer" = "y" -o "$answer" = "n" ]; then + break + fi + echo "Please answer y or n" + done + if [ "$answer" = "y" ]; then + TARGET_DEVICE_NAME=$hdname + break fi done -if [ "$found" = "no" ]; then +if [ -n "$TARGET_DEVICE_NAME" ]; then + echo "Installing image on /dev/$TARGET_DEVICE_NAME ..." +else + echo "No hard drive selected. Installation aborted." exit 1 fi -echo "Installing image on /dev/${device}" +device=$TARGET_DEVICE_NAME # # The udev automounter can cause pain here, kill it |