summaryrefslogtreecommitdiffstats
path: root/rescue/restore-image.sh
diff options
context:
space:
mode:
authorCaio Begotti <caio1982@mandriva.org>2009-01-22 17:57:02 +0000
committerCaio Begotti <caio1982@mandriva.org>2009-01-22 17:57:02 +0000
commitb3514197e1bb1ba57e2b5e4156d9d7ccb551615b (patch)
tree00384847acc0872b2714794066841b2310db3b8c /rescue/restore-image.sh
parentedc36a9016705faf32159af8893e48eff6a84a45 (diff)
downloaddrakx-backup-do-not-use-b3514197e1bb1ba57e2b5e4156d9d7ccb551615b.tar
drakx-backup-do-not-use-b3514197e1bb1ba57e2b5e4156d9d7ccb551615b.tar.gz
drakx-backup-do-not-use-b3514197e1bb1ba57e2b5e4156d9d7ccb551615b.tar.bz2
drakx-backup-do-not-use-b3514197e1bb1ba57e2b5e4156d9d7ccb551615b.tar.xz
drakx-backup-do-not-use-b3514197e1bb1ba57e2b5e4156d9d7ccb551615b.zip
adding a more dynamic partition types support
Diffstat (limited to 'rescue/restore-image.sh')
-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