summaryrefslogtreecommitdiffstats
path: root/rescue/restore-image.sh
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-02-11 16:58:50 +0000
committerOlivier Blin <oblin@mandriva.com>2009-02-11 16:58:50 +0000
commitefc349407fb3d6ee949aaff77e8fbe297ff2750c (patch)
tree2c8494ca78844a02fd2da23458214a75e0733e77 /rescue/restore-image.sh
parent57bbde6613c2545e5a4b0c1f9af4097cf8624c4d (diff)
downloaddrakx-efc349407fb3d6ee949aaff77e8fbe297ff2750c.tar
drakx-efc349407fb3d6ee949aaff77e8fbe297ff2750c.tar.gz
drakx-efc349407fb3d6ee949aaff77e8fbe297ff2750c.tar.bz2
drakx-efc349407fb3d6ee949aaff77e8fbe297ff2750c.tar.xz
drakx-efc349407fb3d6ee949aaff77e8fbe297ff2750c.zip
more fixes for win32 installation breakage
Diffstat (limited to 'rescue/restore-image.sh')
-rwxr-xr-xrescue/restore-image.sh27
1 files changed, 16 insertions, 11 deletions
diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh
index 7bc38e61a..ad4797944 100755
--- a/rescue/restore-image.sh
+++ b/rescue/restore-image.sh
@@ -161,9 +161,13 @@ function detect_win32()
win32_part_dev=${device}
win32_part_type=${device_type}
# our install takes half of 'left'
- win32_part_new_size=$(($((${used}+${avail}))*2))
- instroot=$(echo ${win32_part_dev} | sed 's@/dev/@@')
- echo ${instroot} ${win32_part_dev} ${win32_part_type} ${win32_part_new_size}
+ win32_part_new_size=$((${used}+${avail}))
+
+ dev=${win32_part_dev#/dev/}
+ disk=${dev%[0-9]}
+ number=${dev#[a-w][a-w][a-w]}
+ let number++
+ echo ${disk}${number} ${win32_part_dev} ${win32_part_type} ${win32_part_new_size}
fi
}
@@ -173,8 +177,9 @@ function resize_win32()
device_type=${2}
new_win32_size=${3}
- disk=${device%[0-9]}
- number=$(echo ${device} | sed 's@/dev/...@@g')
+ dev=${device#/dev/}
+ disk=${dev%[0-9]}
+ win32_number=${dev#[a-w][a-w][a-w]}
case ${device_type} in
vfat) device_id=b ;;
@@ -183,31 +188,31 @@ function resize_win32()
esac
# wrapper around libdrakx by blino
- diskdrake-resize ${device} ${device_type} ${new_win32_size} &>/dev/null
+ diskdrake-resize ${device} ${device_type} $((${new_win32_size}*2)) &>/dev/null
# we need some free sector here, rebuilding layout
fdisk /dev/${disk} &>/dev/null <<EOF
d
n
p
-$((${number}-1))
+${win32_number}
-+$((${used}+${avail}))K
++${new_win32_size}K
t
${device_id}
a
-$((${number}-1))
+${win32_number}
w
EOF
# adds linux partition to the end of the working disk
fdisk /dev/${disk} &>/dev/null <<EOF
n
p
-${number}
+$((${win32_number}+1))
+${MIN_DISKSIZE}K
t
-${number}
+$((${win32_number}+1))
83
w
EOF