From ae0e97e233c57d01e5c1fcb05e6243535d5f061f Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 11 Feb 2009 15:26:41 +0000 Subject: move win32 code in detect_and_resize_win32 --- rescue/restore-image.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'rescue/restore-image.sh') diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh index c59113f9c..7ad4d17e8 100755 --- a/rescue/restore-image.sh +++ b/rescue/restore-image.sh @@ -94,19 +94,10 @@ function detect_root() fi devs_found=$(($(echo $devices | wc -w)/2)) - # we might use it later again - fdisk -l | grep "^/dev/" | grep -v ${inst_source_dev} > /tmp/fdisk.log - # get the last created windows partition information - set -f - first_win32_part_dev=$(grep -e "FAT\|NTFS\|HPFS" /tmp/fdisk.log | tail -1 | sed 's/ .*$//') - set +f - - # won't handle complex layouts + # win32 detection won't handle complex layouts if [ "${devs_found}" = 1 ]; then - if [ -n "${first_win32_part_dev}" ]; then - root=$(detect_and_resize_win32 $first_win32_part_dev) - fi + root=$(detect_and_resize_win32 ${inst_source_dev}) fi if [ -z "${root}" ]; then @@ -134,7 +125,18 @@ function detect_root() function detect_and_resize_win32() { # from detect_root() - device=${1} + skip_dev=${1} + + # we might use it later again + fdisk -l | grep "^/dev/" | grep -v ${inst_source_dev} > /tmp/fdisk.log + # get the last created windows partition information + set -f + first_win32_part_dev=$(grep -e "FAT\|NTFS\|HPFS" /tmp/fdisk.log | tail -1 | sed 's/ .*$//') + set +f + + if [ -z "${first_win32_part_dev}" ]; then + exit + fi # it might be needed, for safety device_type=$(vol_id --type ${device}) -- cgit v1.2.1