summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-02-11 14:39:50 +0000
committerOlivier Blin <oblin@mandriva.com>2009-02-11 14:39:50 +0000
commitf14d5b327e70e7c622896911272d87fd3b63275d (patch)
tree7ee62cbbf623cf05105c4ae9e9a858727f2f7e1a /rescue
parent63d58dd063b4565724f0b252bef30ec5ae3a4b6b (diff)
downloaddrakx-backup-do-not-use-f14d5b327e70e7c622896911272d87fd3b63275d.tar
drakx-backup-do-not-use-f14d5b327e70e7c622896911272d87fd3b63275d.tar.gz
drakx-backup-do-not-use-f14d5b327e70e7c622896911272d87fd3b63275d.tar.bz2
drakx-backup-do-not-use-f14d5b327e70e7c622896911272d87fd3b63275d.tar.xz
drakx-backup-do-not-use-f14d5b327e70e7c622896911272d87fd3b63275d.zip
extract resize_win32 and set more win32 variables
Diffstat (limited to 'rescue')
-rwxr-xr-xrescue/restore-image.sh61
1 files changed, 37 insertions, 24 deletions
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 <<EOF
+ case ${device_type} in
+ vfat) device_id=b ;;
+ ntfs) device_id=7 ;;
+ hpfs) device_id=87 ;;
+ esac
+
+ # wrapper around libdrakx by blino
+ diskdrake-resize ${device} ${device_type} ${new_win32_size} &>/dev/null
+
+ # we need some free sector here, rebuilding layout
+ fdisk /dev/${disk} &>/dev/null <<EOF
d
n
p
@@ -176,8 +197,8 @@ a
$((${number}-1))
w
EOF
- # adds linux partition to the end of the working disk
- fdisk /dev/${disk} &>/dev/null <<EOF
+ # adds linux partition to the end of the working disk
+ fdisk /dev/${disk} &>/dev/null <<EOF
n
p
${number}
@@ -188,14 +209,6 @@ ${number}
83
w
EOF
- else
- rm -f /tmp/fdisk.log
- fi
- else
- rm -f /tmp/fdisk.log
- fi
-
- echo "${disk}${number}"
}
function write_image()