From b3514197e1bb1ba57e2b5e4156d9d7ccb551615b Mon Sep 17 00:00:00 2001 From: Caio Begotti Date: Thu, 22 Jan 2009 17:57:02 +0000 Subject: adding a more dynamic partition types support --- rescue/restore-image.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh index d586d8cae..2fc6e0348 100755 --- a/rescue/restore-image.sh +++ b/rescue/restore-image.sh @@ -123,14 +123,24 @@ function resize_win32() if [ ! $(grep "^/dev" /tmp/fdisk.log | wc -l) -gt 1 ]; then set -f # get the last created windows partition information - partition=$(grep -e "FAT\|NTFS" /tmp/fdisk.log | tail -1) + partition=$(grep -e "FAT\|NTFS\|HPFS" /tmp/fdisk.log | tail -1) device=$(echo ${partition} | sed 's/ .*$//') set +f + # it might be needed, for safety + device_type=$(vol_id --type ${device}) + modprobe ${device_type} + # get the next partition integer number=$(echo ${device} | sed 's@/dev/...@@g') let number++ + case ${device_type} in + vfat) device_id=b ;; + ntfs) device_id=7 ;; + hpfs) device_id=87 ;; + esac + # df for that partition mount ${device} /mnt size=$(df ${device} | tail -1) @@ -143,7 +153,7 @@ function resize_win32() if [ ! ${avail} -lt ${MIN_DISKSIZE} ]; then # wrapper around libdrakx by blino (it takes half of 'left') - diskdrake-resize ${device} ntfs $(($((${used}+${avail}))*2)) &>/dev/null + diskdrake-resize ${device} ${device_type} $(($((${used}+${avail}))*2)) &>/dev/null # we need some free sector here, rebuilding layout fdisk /dev/${disk} &>/dev/null <