diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-11-05 15:24:25 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-11-05 15:24:25 +0000 |
commit | 4645260b7eab7372180fb024cda981635b964379 (patch) | |
tree | 645c006ddf1bda49eab40edf8fb5e68e46e0a9fd | |
parent | 6ccbc23b5ce8622ed441ef98e22a9a5bceb659fc (diff) | |
download | drakx-4645260b7eab7372180fb024cda981635b964379.tar drakx-4645260b7eab7372180fb024cda981635b964379.tar.gz drakx-4645260b7eab7372180fb024cda981635b964379.tar.bz2 drakx-4645260b7eab7372180fb024cda981635b964379.tar.xz drakx-4645260b7eab7372180fb024cda981635b964379.zip |
add swap partition
-rwxr-xr-x | rescue/restore-image.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh index 49d5f59c1..dfe173fa7 100755 --- a/rescue/restore-image.sh +++ b/rescue/restore-image.sh @@ -152,9 +152,22 @@ function expand_fs() dialog --backtitle "$BACKTITLE" --title "$TITLE" --infobox "Installing... Finishing Install..." 3 40 disk=/dev/$root main_part=/dev/${root}1 - sfdisk -d $disk | sed -e "\|$main_part| s/size=.*,/size= ,/" | sfdisk -f $disk + 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)) + SWAP_BLOCKS=150000 + if [ -n "$SWAP_BLOCKS" ]; then + max_part_blocks=$((total_blocks-SWAP_BLOCKS)) + max_part_sectors=$((max_part_blocks*2)) + else + max_part_sectors= + fi + sfdisk -d $disk | sed -e "\|$main_part| s/size=.*,/size= $max_part_sectors,/" | sfdisk -f $disk e2fsck -fy $main_part resize2fs $main_part + parted $disk -- mkpartfs primary linux-swap ${max_part_sectors}s -1s yes + mkswap -L swap $swap_part fi } |