Commit d0a77444 authored by Natanael Copa's avatar Natanael Copa

setup-disk: avoid create unused swap partition

parent 76455c99
...@@ -676,8 +676,10 @@ setup_partitions() { ...@@ -676,8 +676,10 @@ setup_partitions() {
# create new partitions # create new partitions
( (
for line in "$@"; do for line in "$@"; do
echo "$start,$line" case "$line" in
start= 0M*) ;;
*) echo "$start,$line"; start= ;;
esac
done done
) | sfdisk --quiet --label $DISKLABEL $diskdev ) | sfdisk --quiet --label $DISKLABEL $diskdev
...@@ -745,6 +747,7 @@ find_nth_non_boot_parts() { ...@@ -745,6 +747,7 @@ find_nth_non_boot_parts() {
setup_non_boot_raid_dev() { setup_non_boot_raid_dev() {
local md_dev=$1 local md_dev=$1
local idx=${md_dev#/dev/md} local idx=${md_dev#/dev/md}
[ -z "$md_dev" ] && return 0
if [ "$ARCH" = "ppc64le" ]; then if [ "$ARCH" = "ppc64le" ]; then
# increment idx as PReP partition is # increment idx as PReP partition is
# the bootable partition in ppc64le # the bootable partition in ppc64le
...@@ -906,10 +909,15 @@ data_only_disk_install() { ...@@ -906,10 +909,15 @@ data_only_disk_install() {
done done
if [ "$USE_RAID" ]; then if [ "$USE_RAID" ]; then
[ $SWAP_SIZE -gt 0 ] && setup_non_boot_raid_dev /dev/md1 $@ if [ $SWAP_SIZE -gt 0 ]; then
setup_non_boot_raid_dev /dev/md2 $@ || return 1 swap_dev=/dev/md1
swap_dev=/dev/md1 var_dev=/dev/md2
var_dev=/dev/md2 else
swap_dev=
var_dev=/dev/md1
fi
setup_non_boot_raid_dev "$swap_dev" $@ || return 1
setup_non_boot_raid_dev "$var_dev" $@ || return 1
else else
swap_dev=$(find_nth_non_boot_parts 1 "$swap_part_type" $@) swap_dev=$(find_nth_non_boot_parts 1 "$swap_part_type" $@)
var_dev=$(find_nth_non_boot_parts 1 "$var_part_type" $@) var_dev=$(find_nth_non_boot_parts 1 "$var_part_type" $@)
...@@ -1038,10 +1046,15 @@ native_disk_install() { ...@@ -1038,10 +1046,15 @@ native_disk_install() {
setup_boot_dev $@ setup_boot_dev $@
if [ "$USE_RAID" ]; then if [ "$USE_RAID" ]; then
[ $SWAP_SIZE -gt 0 ] && setup_non_boot_raid_dev /dev/md1 $@ if [ $SWAP_SIZE -gt 0 ]; then
setup_non_boot_raid_dev /dev/md2 $@ || return 1 swap_dev=/dev/md1
swap_dev=/dev/md1 root_dev=/dev/md2
root_dev=/dev/md2 else
swap_dev=
root_dev=/dev/md1
fi
setup_non_boot_raid_dev "$swap_dev" $@ || return 1
setup_non_boot_raid_dev "$root_dev" $@ || return 1
else else
swap_dev=$(find_nth_non_boot_parts 1 "$swap_part_type" $@) swap_dev=$(find_nth_non_boot_parts 1 "$swap_part_type" $@)
local index= local index=
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment