summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrescue/restore-image.sh16
1 files 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 <<EOF
@@ -154,7 +164,7 @@ $((${number}-1))
+$((${used}+${avail}))K
t
-87
+${device_id}
a
$((${number}-1))
w