kernel-install/90-loaderentry: make ownership change optional

This can be useful when running as non-root, e.g. for tests or when
installing to a chroot.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-07-06 16:33:11 +02:00
parent 91199185b1
commit 2bbf6c3590
+4 -2
View File
@@ -105,10 +105,11 @@ if ! [ -d "$ENTRY_DIR_ABS" ]; then
exit 1
fi
install -g root -o root -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || {
install -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || {
echo "Error: could not copy '$KERNEL_IMAGE' to '$ENTRY_DIR_ABS/linux'." >&2
exit 1
}
chown root.root "$ENTRY_DIR_ABS/linux" || :
shift "$INITRD_OPTIONS_SHIFT"
# All files listed as arguments, and staged files starting with "initrd" are installed as initrds.
@@ -121,10 +122,11 @@ for initrd in "$@" "${KERNEL_INSTALL_STAGING_AREA}"/initrd*; do
initrd_basename="${initrd##*/}"
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Installing $ENTRY_DIR_ABS/$initrd_basename"
install -g root -o root -m 0644 "$initrd" "$ENTRY_DIR_ABS/$initrd_basename" || {
install -m 0644 "$initrd" "$ENTRY_DIR_ABS/$initrd_basename" || {
echo "Error: could not copy '$initrd' to '$ENTRY_DIR_ABS/$initrd_basename'." >&2
exit 1
}
chown root.root "$ENTRY_DIR_ABS/$initrd_basename" || :
done
mkdir -p "${LOADER_ENTRY%/*}" || {