From f14d5b327e70e7c622896911272d87fd3b63275d Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 11 Feb 2009 14:39:50 +0000 Subject: extract resize_win32 and set more win32 variables --- rescue/restore-image.sh | 61 ++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 24 deletions(-) (limited to 'rescue') diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh index c8b32f628..dbef9f0df 100755 --- a/rescue/restore-image.sh +++ b/rescue/restore-image.sh @@ -145,25 +145,46 @@ function detect_and_resize_win32() used=$(echo ${size} | awk '{ print $3 }') left=$(echo ${size} | awk '{ print $4 }') avail=$((${left}/2)) - # our install takes half of 'left' - new_win32_size=$(($((${used}+${avail}))*2)) if [ ! ${avail} -lt ${MIN_DISKSIZE} ]; then - # get the next partition integer - number=$(echo ${device} | sed 's@/dev/...@@g') - let number++ + win32_part_dev=${device} + win32_part_type=${device_type} + # our install takes half of 'left' + win32_part_new_size=$(($((${used}+${avail}))*2)) + resize_win32 ${win32_part_dev} ${win32_part_type} ${win32_part_new_size} + else + rm -f /tmp/fdisk.log + fi + else + rm -f /tmp/fdisk.log + fi + + echo "${disk}${number}" +} + +function resize_win32() +{ + device=${1} + device_type=${2} + new_win32_size=${3} - case ${device_type} in - vfat) device_id=b ;; - ntfs) device_id=7 ;; - hpfs) device_id=87 ;; - esac + disk=${device%[0-9]} - # wrapper around libdrakx by blino - diskdrake-resize ${device} ${device_type} ${new_win32_size} &>/dev/null + # get the next partition integer + number=$(echo ${device} | sed 's@/dev/...@@g') + let number++ - # we need some free sector here, rebuilding layout - fdisk /dev/${disk} &>/dev/null </dev/null + + # we need some free sector here, rebuilding layout + fdisk /dev/${disk} &>/dev/null </dev/null </dev/null <