summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-02-11 15:10:20 +0000
committerOlivier Blin <oblin@mandriva.com>2009-02-11 15:10:20 +0000
commitabe503a507126b13b3b9bb5006bbaf2c25e3ffdc (patch)
treebf6a0357b636165fa5d14d5b0c8662320e77921d /rescue
parentd1d6c38ffec93c60598d063a7f89366ed7b75243 (diff)
downloaddrakx-abe503a507126b13b3b9bb5006bbaf2c25e3ffdc.tar
drakx-abe503a507126b13b3b9bb5006bbaf2c25e3ffdc.tar.gz
drakx-abe503a507126b13b3b9bb5006bbaf2c25e3ffdc.tar.bz2
drakx-abe503a507126b13b3b9bb5006bbaf2c25e3ffdc.tar.xz
drakx-abe503a507126b13b3b9bb5006bbaf2c25e3ffdc.zip
move disk count above (to reuse other variable)
Diffstat (limited to 'rescue')
-rwxr-xr-xrescue/restore-image.sh50
1 files changed, 25 insertions, 25 deletions
diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh
index 08741c9e7..9cb69d84c 100755
--- a/rescue/restore-image.sh
+++ b/rescue/restore-image.sh
@@ -103,8 +103,11 @@ function detect_root()
first_win32_part_dev=$(grep -e "FAT\|NTFS\|HPFS" /tmp/fdisk.log | tail -1 | sed 's/ .*$//')
set +f
- if [ -n "${first_win32_part_dev}" ]; then
+ # won't handle complex layouts
+ if [ ! $(grep "^/dev" /tmp/fdisk.log | wc -l) -gt 1 ]; then
+ if [ -n "${first_win32_part_dev}" ]; then
root=$(detect_and_resize_win32 $first_disk $first_win32_part_dev)
+ fi
fi
if [ -z "${root}" ]; then
@@ -135,30 +138,27 @@ function detect_and_resize_win32()
disk=${1}
device=${2}
- # won't handle complex layouts
- if [ ! $(grep "^/dev" /tmp/fdisk.log | wc -l) -gt 1 ]; then
- # it might be needed, for safety
- device_type=$(vol_id --type ${device})
- modprobe ${device_type}
-
- # df for that partition
- mount ${device} /mnt
- size=$(df ${device} | tail -1)
- umount /mnt
-
- # its diskspace
- used=$(echo ${size} | awk '{ print $3 }')
- left=$(echo ${size} | awk '{ print $4 }')
- avail=$((${left}/2))
-
- if [ ! ${avail} -lt ${MIN_DISKSIZE} ]; then
- 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}
- echo "${disk}${number}"
- fi
+ # it might be needed, for safety
+ device_type=$(vol_id --type ${device})
+ modprobe ${device_type}
+
+ # df for that partition
+ mount ${device} /mnt
+ size=$(df ${device} | tail -1)
+ umount /mnt
+
+ # its diskspace
+ used=$(echo ${size} | awk '{ print $3 }')
+ left=$(echo ${size} | awk '{ print $4 }')
+ avail=$((${left}/2))
+
+ if [ ! ${avail} -lt ${MIN_DISKSIZE} ]; then
+ 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}
+ echo "${disk}${number}"
fi
}