Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ext4 feature orphan_file for older releases #285

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 35 additions & 22 deletions grml-debootstrap

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Note that A && B || C is not if-then-else. C may run when A is true. SC2015

[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a >/dev/null 2>&1 || true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Note that A && B || C is not if-then-else. C may run when A is true. SC2015

[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

RELEASE="$(dialog --stdout --title "${PN}" --default-item $DEFAULT_RELEASE --menu \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

CHOOSE_MIRROR=$(dialog --stdout --title "$PN" --default-item $DEFAULT_MIRROR \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

0 0 $MIRROR)" || bailout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

0 0 $ISO)" || bailout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

cp $VERBOSE "${CONFFILES}"/chroot-script "${MNTPOINT}"/bin/chroot-script

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

cp $VERBOSE "${CONFFILES}/config" "${MNTPOINT}"/etc/debootstrap/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

cp $VERBOSE "${_opt_packages:-$CONFFILES/$PACKAGES_FILE}" \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

cp $VERBOSE "${_opt_debconf}" "${MNTPOINT}"/etc/debootstrap/debconf-selections

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

RELEASE="$(dialog --stdout --title "${PN}" --default-item $DEFAULT_RELEASE --menu \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

CHOOSE_MIRROR=$(dialog --stdout --title "$PN" --default-item $DEFAULT_MIRROR \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

0 0 $MIRROR)" || bailout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

0 0 $ISO)" || bailout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

cp $VERBOSE "${CONFFILES}"/chroot-script "${MNTPOINT}"/bin/chroot-script

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

cp $VERBOSE "${CONFFILES}/config" "${MNTPOINT}"/etc/debootstrap/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

cp $VERBOSE "${_opt_packages:-$CONFFILES/$PACKAGES_FILE}" \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

cp $VERBOSE "${_opt_debconf}" "${MNTPOINT}"/etc/debootstrap/debconf-selections

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

cp -a $VERBOSE "${_opt_chroot_scripts}"/* "${MNTPOINT}"/etc/debootstrap/chroot-scripts/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

cp $VERBOSE "${CHROOT_VARIABLES}" "${MNTPOINT}"/etc/debootstrap/variables

Original file line number Diff line number Diff line change
Expand Up @@ -1301,36 +1301,49 @@ mkfs() {
esac
fi

# starting with e2fsprogs 1.43~WIP.2015.05.18-1 mkfs.ext4 enables the metadata_csum feature
# by default, which requires a recent version of tune2fs on the target system then,
# so disable this feature for older Debian releases where it's known to be unsupported
if [ -n "$MKFS" ] && [ "$MKFS" = "mkfs.ext4" ] ; then
# Detect modern mkfs.ext4 features, and disable them if the kernel or fsck
# on the target release will be too old to support them.
local e2fsprogs_version
e2fsprogs_version="$(dpkg-query --show --showformat='${Version}' e2fsprogs 2>/dev/null || echo 1.44)"

local mkfs_supports_metadata_csum=''
if [ -n "$e2fsprogs_version" ] && dpkg --compare-versions "$e2fsprogs_version" ge '1.43~WIP.2015.05.18-1' ; then
mkfs_supports_metadata_csum=1
fi
local mkfs_supports_metadata_csum_seed=''
if [ -n "$e2fsprogs_version" ] && dpkg --compare-versions "$e2fsprogs_version" ge '1.43' ; then
mkfs_supports_metadata_csum_seed=1
fi
local mkfs_supports_orphan_file=''
if [ -n "$e2fsprogs_version" ] && dpkg --compare-versions "$e2fsprogs_version" ge '1.47.0-1' ; then
mkfs_supports_orphan_file=1
fi

case "$RELEASE" in
jessie)
# assume a more recent version if we can't identify the version via dpkg-query
local e2fsprogs_version
e2fsprogs_version="$(dpkg-query --show --showformat='${Version}' e2fsprogs 2>/dev/null || echo 1.44)"
if [ -n "$e2fsprogs_version" ] && dpkg --compare-versions "$e2fsprogs_version" ge '1.43~WIP.2015.05.18-1' ; then
einfo "Disabling metadata_csum feature for $MKFS as $RELEASE doesn't support it."
if [ "$mkfs_supports_metadata_csum" = 1 ]; then
einfo "Disabling $MKFS feature as OS Release $RELEASE does not support it: metadata_csum"
MKFS_OPTS="$MKFS_OPTS -O ^metadata_csum"
fi
if [ "$mkfs_supports_metadata_csum_seed" = 1 ]; then
einfo "Disabling $MKFS feature as OS Release $RELEASE does not support it: metadata_csum_seed"
MKFS_OPTS="$MKFS_OPTS -O ^metadata_csum_seed"
fi
if [ "$mkfs_supports_orphan_file" = 1 ]; then
einfo "Disabling $MKFS feature as OS Release $RELEASE does not support it: orphan_file"
MKFS_OPTS="$MKFS_OPTS -O ^orphan_file"
fi
;;
esac
fi

# starting with e2fsprogs v1.47.0 mkfs.ext4 enables the metadata_csum_seed feature
# by default, which requires Linux kernel >=4.4, e2fsprogs >=1.43, according GRUB etc.
# Disable this feature for Debian releases older than bookworm
if [ -n "$MKFS" ] && [ "$MKFS" = "mkfs.ext4" ] ; then
case "$RELEASE" in
jessie|stretch|buster|bullseye)
local e2fsprogs_version
# assume a more recent version if we can't identify the version via dpkg-query
e2fsprogs_version="$(dpkg-query --show --showformat='${Version}' e2fsprogs 2>/dev/null || echo 1.47)"
if [ -n "$e2fsprogs_version" ] && dpkg --compare-versions "$e2fsprogs_version" ge '1.43' ; then
einfo "Disabling metadata_csum_seed feature for $MKFS as $RELEASE doesn't support it."
bullseye|buster|stretch)
if [ "$mkfs_supports_metadata_csum_seed" = 1 ]; then
mika marked this conversation as resolved.
Show resolved Hide resolved
einfo "Disabling $MKFS feature as OS Release $RELEASE does not support it: metadata_csum_seed"
MKFS_OPTS="$MKFS_OPTS -O ^metadata_csum_seed"
fi
if [ "$mkfs_supports_orphan_file" = 1 ]; then
einfo "Disabling $MKFS feature as OS Release $RELEASE does not support it: orphan_file"
MKFS_OPTS="$MKFS_OPTS -O ^orphan_file"
fi
;;
esac
fi
Expand Down