forked from pool/ignition
569fa9e2a7
- Omit ignition module in initrds for already configured systems: * Add 0001-dracut-Don-t-include-the-ignition-module-by-default.patch * Edit module-setup.sh - Add explicit dep on combustion in module-setup.sh - Replace ignition-dracut-grub2 with combustion's firstboot.target: * Add 0001-Order-ignition-disks.service-before-systemd-fsck-roo.patch * Edit ignition-suse-generator * Edit ignition-umount-initrd-fstab.service * Edit module-setup.sh * Drop 02_ignition_firstboot * Drop ignition-firstboot-complete.service * Adjust README.SUSE - Edit ignition-umount-initrd-fstab.service to not rely on combustion units forcing proper order - Add 0003-Move-the-GPT-header-on-resized-disks.patch to make it - Fix patch file metadata in 0001-ignore-missing-qemu-blockdev.patch and 0002-allow-multiple-mounts-of-same-device.patch OBS-URL: https://build.opensuse.org/request/show/1105491 OBS-URL: https://build.opensuse.org/package/show/devel:kubic:ignition/ignition?expand=0&rev=111
54 lines
1.5 KiB
Bash
54 lines
1.5 KiB
Bash
#!/bin/bash
|
|
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
|
set -e
|
|
|
|
# Generators don't have logging right now
|
|
# https://github.com/systemd/systemd/issues/15638
|
|
exec 1>/dev/kmsg; exec 2>&1
|
|
|
|
UNIT_DIR="${1:-/tmp}"
|
|
|
|
cmdline=( $(</proc/cmdline) )
|
|
cmdline_arg() {
|
|
local name="$1" value="$2"
|
|
for arg in "${cmdline[@]}"; do
|
|
if [[ "${arg%%=*}" == "${name}" ]]; then
|
|
value="${arg#*=}"
|
|
fi
|
|
done
|
|
echo "${value}"
|
|
}
|
|
|
|
add_requires() {
|
|
local name="$1"; shift
|
|
local target="$1"; shift
|
|
local requires_dir="${UNIT_DIR}/${target}.requires"
|
|
mkdir -p "${requires_dir}"
|
|
ln -sf "../${name}" "${requires_dir}/${name}"
|
|
}
|
|
|
|
add_requires ignition-complete.target firstboot.target
|
|
add_requires ignition-diskful.target ignition-complete.target
|
|
# TODO: Add support for ignition-subsequent.target, when needed?
|
|
|
|
echo "PLATFORM_ID=$(cmdline_arg ignition.platform.id)" > /run/ignition.env
|
|
|
|
. /run/ignition.env
|
|
|
|
add_requires ignition-mount-initrd-fstab.service ignition-files.service
|
|
add_requires ignition-umount-initrd-fstab.service ignition-files.service
|
|
add_requires ignition-enable-network.service ignition-fetch.service
|
|
|
|
if [ -z "${PLATFORM_ID}" ]; then
|
|
platform="$(systemd-detect-virt || true)"
|
|
case "${platform}" in
|
|
*vmware*) platform="vmware" ;;
|
|
*oracle*) platform="virtualbox" ;;
|
|
*kvm*|*qemu*) platform="qemu" ;;
|
|
*) platform="metal" ;;
|
|
esac
|
|
echo "PLATFORM_ID=${platform}" > /run/ignition.env
|
|
fi
|