summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-11-12 10:15:44 +0000
committerOlivier Blin <oblin@mandriva.com>2008-11-12 10:15:44 +0000
commit82fa5713050f1b4f955216d0997600cccca40c33 (patch)
tree4e648839a6c0d7ca26acacafcb079933299dcfa0 /rescue
parentbf8643b3bcb9bd8eb8161a56d32d46fa098b33a1 (diff)
downloaddrakx-backup-do-not-use-82fa5713050f1b4f955216d0997600cccca40c33.tar
drakx-backup-do-not-use-82fa5713050f1b4f955216d0997600cccca40c33.tar.gz
drakx-backup-do-not-use-82fa5713050f1b4f955216d0997600cccca40c33.tar.bz2
drakx-backup-do-not-use-82fa5713050f1b4f955216d0997600cccca40c33.tar.xz
drakx-backup-do-not-use-82fa5713050f1b4f955216d0997600cccca40c33.zip
make fs expand conditional
Diffstat (limited to 'rescue')
-rwxr-xr-xrescue/restore-image.sh19
1 files changed, 11 insertions, 8 deletions
diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh
index ddb12f5e8..87b8070bf 100755
--- a/rescue/restore-image.sh
+++ b/rescue/restore-image.sh
@@ -165,18 +165,21 @@ function expand_fs()
disk=/dev/$root
main_part=/dev/${root}1
swap_part=/dev/${root}2
- total_blocks=$(sfdisk -s $disk)
#part_sectors=$(sfdisk -d $disk | perl -lne 'm|^'$main_part'\b.*,\s*size\s*=\s*(\d+)\b| and print($1), exit')
#part_blocks=$((part_sectors/2))
+ main_part_sectors=
if [ -n "$SWAP_BLOCKS" ]; then
- main_part_blocks=$((total_blocks-SWAP_BLOCKS))
- main_part_sectors=$((main_part_blocks*2))
- else
- main_part_sectors=
+ if [ -n "$EXPAND_FS" ]; then
+ total_blocks=$(sfdisk -s $disk)
+ main_part_blocks=$((total_blocks-SWAP_BLOCKS))
+ main_part_sectors=$((main_part_blocks*2))
+ fi
+ fi
+ if [ -n "$EXPAND_FS" ]; then
+ sfdisk -d $disk | sed -e "\|$main_part| s/size=.*,/size= $main_part_sectors,/" | sfdisk -f $disk
+ e2fsck -fy $main_part
+ resize2fs $main_part
fi
- sfdisk -d $disk | sed -e "\|$main_part| s/size=.*,/size= $main_part_sectors,/" | sfdisk -f $disk
- e2fsck -fy $main_part
- resize2fs $main_part
if [ -n "$SWAP_BLOCKS" ]; then
parted $disk -- mkpartfs primary linux-swap ${main_part_sectors}s -1s yes
mkswap -L swap $swap_part