fix: partitioning: disable orphan_file (FEATURE_C12) for ext4 filesystems on 1.47+ e2fsprogs host

- otherwise:
  ```
  fsck.ext4 -a -C0 /dev/mmcblk0p1
  /dev/mmcblk0p1 has unsupported feature(s): FEATURE_C12
  e2fsck: Get a newer version of e2fsck!
  ```
- `orphan_file` can only be disabled on recent-enough e2fsprogs, thus check version and compare
This commit is contained in:
Ricardo Pardini 2024-05-12 17:07:02 +02:00
parent b52b08ffdf
commit 1ff783d867

View File

@ -39,6 +39,19 @@ function prepare_partitions() {
# parttype[nfs] is empty
mkopts[ext4]="-q -m 2" # for a long time we had '-O ^64bit,^metadata_csum' here
# Hack: newer versions of e2fsprogs in combination with recent kernels enable orphan_file (FEATURE_C12) by default; that can't be handled by older versions of e2fsprogs
# at the same time, older versions don't know about orphan_file at all, so we can't simply disable for all.
# run & parse the version of e2fsprogs to determine if we need to disable orphan_file
declare e2fsprogs_version
e2fsprogs_version=$(e2fsck -V 2>&1 | head -1 | cut -d " " -f 2 | xargs echo -n)
# use linux-version compare to check if the version is at least 1.47
if linux-version compare "${e2fsprogs_version}" ge "1.47"; then
display_alert "e2fsprogs version" "$e2fsprogs_version supports orphan_file" "info"
mkopts[ext4]="-q -m 2 -O ^orphan_file"
else
display_alert "e2fsprogs version" "$e2fsprogs_version does not support orphan_file" "info"
fi
# mkopts[fat] is empty
mkopts[ext2]=''
# mkopts[f2fs] is empty