diff options
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 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 |
15 | swap_ratio=5 | 15 | swap_ratio=5 |
16 | 16 | ||
17 | found="no" | 17 | # Get a list of hard drives |
18 | 18 | hdnamelist="" | |
19 | echo "Searching for a hard drive..." | 19 | live_dev_name=${1%%/*} |
20 | for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1' | 20 | |
21 | do | 21 | echo "Searching for hard drives ..." |
22 | if [ -e /sys/block/${device}/removable ]; then | 22 | |
23 | if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then | 23 | for 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 | 39 | done |
40 | |||
41 | echo "Please answer y or n" | ||
42 | done | ||
43 | fi | ||
44 | fi | ||
45 | 40 | ||
46 | if [ "$found" = "yes" ]; then | 41 | TARGET_DEVICE_NAME="" |
47 | break; | 42 | for 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 | ||
50 | done | 68 | done |
51 | 69 | ||
52 | if [ "$found" = "no" ]; then | 70 | if [ -n "$TARGET_DEVICE_NAME" ]; then |
71 | echo "Installing image on /dev/$TARGET_DEVICE_NAME ..." | ||
72 | else | ||
73 | echo "No hard drive selected. Installation aborted." | ||
53 | exit 1 | 74 | exit 1 |
54 | fi | 75 | fi |
55 | 76 | ||
56 | echo "Installing image on /dev/${device}" | 77 | device=$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 |