mirror of
https://github.com/coreos/fedora-coreos-config.git
synced 2026-11-03 14:49:47 -09:00
coreos-rescue-misplaced-network: Add sentinel file for agent installer
- Check for the deliberate sentinel file. When present, the /boot placement was intentional (e.g.assisted-installer iSCSI flow) and we should not flag it as a misplaced config. - This is a temporary workaround until a final solution for image replacement is in place. See: https://github.com/openshift/assisted-installer/pull/2501 Signed-off-by: Renata Ravanelli <rravanel@redhat.com>
This commit is contained in:
parent
c1ef6a8f37
commit
8c1bdaf369
1 changed files with 20 additions and 8 deletions
|
|
@ -11,6 +11,7 @@ set -euo pipefail
|
|||
bootmnt=/mnt/boot_partition
|
||||
bootdev=/dev/disk/by-label/boot
|
||||
boot_firstboot_network_dir="${bootmnt}/coreos-firstboot-network"
|
||||
deliberate_sentinel="${boot_firstboot_network_dir}.deliberate"
|
||||
initramfs_network_dir="/run/NetworkManager/system-connections/"
|
||||
|
||||
if [ ! -b "${bootdev}" ]; then
|
||||
|
|
@ -31,20 +32,31 @@ warn() {
|
|||
|
||||
if [ -n "$(ls -A "${boot_firstboot_network_dir}" 2>/dev/null)" ]; then
|
||||
warn "warning: found legacy firstboot network config in ${boot_firstboot_network_dir}"
|
||||
warn "warning: an older coreos-installer placed network config in /boot instead of the initramfs"
|
||||
# Check for the deliberate sentinel file. When present, the /boot
|
||||
# placement was intentional (e.g. assisted-installer iSCSI flow) and
|
||||
# we should not flag it as a misplaced config. This is a temporary
|
||||
# workaround until a final solution for image replacement is in place.
|
||||
# See https://github.com/openshift/assisted-installer/pull/2501
|
||||
if [ -f "${deliberate_sentinel}" ]; then
|
||||
warn "info: sentinel coreos-firstboot-network.deliberate found; /boot placement was intentional"
|
||||
else
|
||||
warn "warning: an older coreos-installer placed network config in /boot instead of the initramfs"
|
||||
warn "warning: use an updated coreos-installer for furture installs"
|
||||
fi
|
||||
warn "warning: rescuing config — copying to ${initramfs_network_dir}"
|
||||
warn "warning: re-install using an updated coreos-installer to avoid this in the future"
|
||||
# Clear any configs auto-generated by nm-initrd-generator from
|
||||
# kernel command line args so the --copy-network config takes priority.
|
||||
rm -vf ${initramfs_network_dir}/*
|
||||
mkdir -p ${initramfs_network_dir}
|
||||
cp -v "${boot_firstboot_network_dir}"/* ${initramfs_network_dir}/
|
||||
# Drop a flag so coreos-warn-misplaced-network.service on the
|
||||
# real system can detect that legacy config was rescued and show
|
||||
# a persistent MOTD warning. /run survives pivot_root into the
|
||||
# real rootfs but /etc from the initramfs does not.
|
||||
mkdir -p /run/coreos
|
||||
touch /run/coreos/legacy-network-rescued
|
||||
if [ ! -f "${deliberate_sentinel}" ]; then
|
||||
# Drop a flag so coreos-warn-misplaced-network.service on the
|
||||
# real system can detect that legacy config was rescued and show
|
||||
# a persistent MOTD warning. /run survives pivot_root into the
|
||||
# real rootfs but /etc from the initramfs does not.
|
||||
mkdir -p /run/coreos
|
||||
touch /run/coreos/legacy-network-rescued
|
||||
fi
|
||||
else
|
||||
echo "info: no legacy network config in ${boot_firstboot_network_dir}; skipping"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue