Skip to content

Commit

Permalink
fix: distribute weight equally between multiple partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
brdanin committed Feb 5, 2024
1 parent 1895262 commit 48327d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions builder/image.d/make_repart_partition
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if [ "$def_only" = 1 ]; then
cat > "$target/etc/repart.d/0.$(printf '%02d' "$repart").conf" <<-EOF
[Partition]
Type=$repart_type
Weight=0
Weight=$weight
EOF
exit 0
fi
Expand Down Expand Up @@ -261,7 +261,7 @@ else

if [[ "$tpm2" = "tpm2" ]]; then
echo "After=$systemd_cryptsetup_dependency" >> "$target/etc/systemd/system/$sysroot_mount_unit"
echo "Requires=$systemd_cryptsetup_dependency" >> "$target/etc/systemd/system/$sysroot_mount_unit"
#echo "Requires=$systemd_cryptsetup_dependency" >> "$target/etc/systemd/system/$sysroot_mount_unit"
fi

cat >> "$target/etc/systemd/system/$sysroot_mount_unit" <<-EOF
Expand Down
12 changes: 9 additions & 3 deletions builder/image.d/makepart
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ sed 's/#.*//;/^[[:space:]]*$/d' \
verity_part_uuid="${hash:32:8}-${hash:40:4}-${hash:44:4}-${hash:48:4}-${hash:52:12}"
echo -e "$part_uuid\t$type\t$size\t$syslinux\t$file\t$label" >> "$partitions"
echo -e "$verity_part_uuid\tlinux\t$verity_size\t0\t$verity_file" >> "$partitions"
make_repart_partition -g "$type" --def-only "$part_num" "$dracut_include"
make_repart_partition -g "$type" --def-only --weight 0 "$part_num" "$dracut_include"
part_num=$((part_num + 1))
make_repart_partition -g linux --def-only "$part_num" "$dracut_include"
make_repart_partition -g linux --def-only --weight 0 "$part_num" "$dracut_include"
if [[ "$depth" != 0 ]]; then
#shellcheck disable=SC2001
verity_name="verity$(sed 's|/|_|' <<< "$target")"
Expand All @@ -230,7 +230,13 @@ sed 's/#.*//;/^[[:space:]]*$/d' \
else
echo -e "$part_uuid\t$type\t$size\t$syslinux\t$file\t$label" >> "$partitions"
fi
make_repart_partition -g "$type" --def-only "$part_num" "$dracut_include"

if [ "$depth" = 0 ]; then
make_repart_partition -g "$type" --def-only --weight 1 "$part_num" "$dracut_include"
else
make_repart_partition -g "$type" --def-only --weight 0 "$part_num" "$dracut_include"
fi

echo "$source" "$target" "$fs" "$options" "$dump" "$pass" >> "$fstab"
fi

Expand Down

0 comments on commit 48327d9

Please sign in to comment.