Browse Source

Merge pull request #455 from kacf/fix

Fix for mender-convert regressions.
automatic_bootstrap_artifact
Kristian Amlie 3 years ago
committed by GitHub
parent
commit
9a9b259216
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      configs/mender_grub_config
  2. 14
      mender-convert-modify
  3. 9
      modules/probe.sh
  4. 19
      scripts/test/generate-image.sh
  5. 2
      scripts/test/mender-convert-qemu

2
configs/mender_grub_config

@ -26,7 +26,7 @@ GRUB_VERSION=2.04
MENDER_GRUB_KERNEL_BOOT_ARGS="" MENDER_GRUB_KERNEL_BOOT_ARGS=""
# grub-mender-grubenv is the Mender integration for the GRUB bootloader # grub-mender-grubenv is the Mender integration for the GRUB bootloader
MENDER_GRUBENV_VERSION="b06a8e2cf13776b5cfc896fa8068006dd9992ebb" MENDER_GRUBENV_VERSION="2ac898f5924d5870f8394ad8ecd3ef1ab1422e3b"
MENDER_GRUBENV_URL="${MENDER_GITHUB_ORG}/grub-mender-grubenv/archive/${MENDER_GRUBENV_VERSION}.tar.gz" MENDER_GRUBENV_URL="${MENDER_GITHUB_ORG}/grub-mender-grubenv/archive/${MENDER_GRUBENV_VERSION}.tar.gz"
# Name of the storage device containing root filesystem partitions in GRUB # Name of the storage device containing root filesystem partitions in GRUB

14
mender-convert-modify

@ -140,21 +140,21 @@ if [ "${MENDER_GRUB_EFI_INTEGRATION}" == "y" ]; then
# Check for known U-Boot problems in all files on the boot partition. # Check for known U-Boot problems in all files on the boot partition.
check_for_broken_uboot_uefi_support work/boot check_for_broken_uboot_uefi_support work/boot
if has_grub_efi "work/boot"; then if [ "$MENDER_GRUB_D_INTEGRATION" = y ] || ( [ "$MENDER_GRUB_D_INTEGRATION" = auto ] && supports_grub_d "work/rootfs" ); then
# No need to install Grub, use the one already present, and only install # No need to install Grub, use the one already present, and only install
# our tools. # our tools.
log_info "GRUB EFI bootloader already present, not installing one." log_info "Not installing GRUB EFI bootloader, relying on platform provided one."
log_info "Installing Mender GRUB tools..."
grub_install_grub_editenv_binary grub_install_grub_editenv_binary
else
log_info "Installing GRUB EFI bootloader..."
grub_install_mender_grub
fi
if [ "$MENDER_GRUB_D_INTEGRATION" = y ] || ( [ "$MENDER_GRUB_D_INTEGRATION" = auto ] && supports_grub_d "work/rootfs" ); then
log_info "Generating grub config using update-grub..." log_info "Generating grub config using update-grub..."
grub_create_grub_config grub_create_grub_config
grub_install_grub_d_config grub_install_grub_d_config
else else
log_info "Installing GRUB EFI bootloader..."
grub_install_mender_grub
log_info "Generating the mender-grub config..." log_info "Generating the mender-grub config..."
grub_create_grub_config grub_create_grub_config
grub_install_standalone_grub_config grub_install_standalone_grub_config

9
modules/probe.sh

@ -345,15 +345,6 @@ is_efi_compatible_kernel() {
return 0 return 0
} }
# has_grub_efi
#
# $1 - the boot partition to search for a grub*.efi
#
# Checks the EFI/* filesystem for the presence of a GRUB bootloader
has_grub_efi() {
find "${1}" -type f -name 'grub*.efi' -print0 | grep -qz grub
}
supports_grub_d() { supports_grub_d() {
test -d "$1"/etc/grub.d || return 1 test -d "$1"/etc/grub.d || return 1

19
scripts/test/generate-image.sh

@ -82,8 +82,6 @@ post_process_image() {
regenerate_grub_live "$image" regenerate_grub_live "$image"
mount ${LO_DEVICE}p1 tmp-p1 mount ${LO_DEVICE}p1 tmp-p1
mount ${LO_DEVICE}p2 tmp-p2 mount ${LO_DEVICE}p2 tmp-p2
post_tweaks tmp-p1 tmp-p2
} }
pre_tweaks() { pre_tweaks() {
@ -107,21 +105,6 @@ EOF
sed -E -i -e 's/^#? *PermitRootLogin .*/PermitRootLogin yes/' $root/etc/ssh/sshd_config sed -E -i -e 's/^#? *PermitRootLogin .*/PermitRootLogin yes/' $root/etc/ssh/sshd_config
} }
post_tweaks() {
local -r boot="$1"
local -r root="$2"
# Delete systemd-boot, which isn't normally present in images that were
# installed with OS installers, at least not at the time of writing.
rm -rf "$boot/EFI/systemd"
# Also replace bootx64.efi, which is the default bootloader. Mkosi installs
# systemd-bootx86.efi, but we want the shim.
rm -f "$boot/EFI/BOOT/*"
mkdir -p "$boot/EFI/BOOT"
cp "$root/usr/lib/shim/shimx64.efi.signed" "$boot/EFI/BOOT/BOOTX64.EFI"
}
# Unfortunately installing grub scripts is something which is not really # Unfortunately installing grub scripts is something which is not really
# possible when offline. This is something which is easier with systemd-boot, so # possible when offline. This is something which is easier with systemd-boot, so
# longterm GRUB will probably follow, or systemd-boot will take over. Anyway, # longterm GRUB will probably follow, or systemd-boot will take over. Anyway,
@ -136,7 +119,7 @@ Description=Regenerate grub scripts, disable itself and then shut down.
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=sh -c "grub-install && update-grub && systemctl disable mender-regenerate-grub-and-shutdown.service && poweroff" ExecStart=sh -c "grub-install && grub-install --removable && update-grub && systemctl disable mender-regenerate-grub-and-shutdown.service && poweroff"
EOF EOF
ln -sf "$root/etc/systemd/system/mender-regenerate-grub-and-shutdown.service" "$root/etc/systemd/system/multi-user.target.wants/" ln -sf "$root/etc/systemd/system/mender-regenerate-grub-and-shutdown.service" "$root/etc/systemd/system/multi-user.target.wants/"

2
scripts/test/mender-convert-qemu

@ -21,7 +21,7 @@ qemu-system-x86_64 \
-net user,hostfwd=tcp::8822-:22 \ -net user,hostfwd=tcp::8822-:22 \
-net nic,macaddr=52:54:00$(od -txC -An -N3 /dev/urandom|tr \ :) \ -net nic,macaddr=52:54:00$(od -txC -An -N3 /dev/urandom|tr \ :) \
-drive file=${ovmf_file},if=pflash,format=raw,unit=0,readonly=on \ -drive file=${ovmf_file},if=pflash,format=raw,unit=0,readonly=on \
-drive file=./uefi-nvram/OVMF_VARS.fd,if=pflash,format=raw,unit=1,readonly=on \ -drive file="$(dirname "$0")/../../tests/uefi-nvram/OVMF_VARS.fd",if=pflash,format=raw,unit=1,readonly=on \
-drive format=raw,file=${DISK_IMG} & -drive format=raw,file=${DISK_IMG} &
qemu_pid=$! qemu_pid=$!

Loading…
Cancel
Save