Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pothos committed Oct 4, 2023
1 parent 9eaeae2 commit 6a3e7c6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions dracut/10diskless-generator/diskless-generator
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ add_requires() {
ln -sf "../${name}" "${requires_dir}/${name}"
}

add_wants() {
local name="$1"
local wants_dir="${UNIT_DIR}/initrd-root-fs.target.wants"
mkdir -p "${wants_dir}"
ln -sf "../${name}" "${wants_dir}/${name}"
}

# set to 1 to enable copying /oem from the initrd
copy_oem=0
# check both the new mount.usr and our old usr kernel options
usr=$(cmdline_arg mount.usr "$(cmdline_arg usr)")
root=$(cmdline_arg root)
rootfstype=$(cmdline_arg rootfstype tmpfs)
rootflags=$(cmdline_arg rootflags)
# check possible future systemd support for separate "/var"
var=$(cmdline_arg mount.var)

# If usr= was not specified and a squashfs is bundled in the initrd use it.
if [[ -z "${usr}" && -f /usr.squashfs ]]; then
Expand Down Expand Up @@ -151,3 +160,19 @@ Type=auto
Options=nodev
EOF
fi

if [[ -z "${var}" ]]; then
add_wants sysroot-oem.mount
cat >"${UNIT_DIR}/sysroot-var.mount" <<EOF
# Automatically generated by diskless-generator
[Unit]
Before=initrd-root-fs.target
[Mount]
What=/dev/disk/by-label/VAR
Where=/sysroot/var
Type=auto
Options=rw
EOF
fi
3 changes: 2 additions & 1 deletion dracut/30ignition/ignition-files.service
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Requires=initrd-setup-root.service
After=initrd-setup-root.service
# Already mount the OEM partition here so that it works to write files
# without having to declare it as initrd mount in Ignition
RequiresMountsFor=/sysroot/usr/ /sysroot/oem/
RequiresMountsFor=/sysroot/usr/ /sysroot/oem/ /sysroot/var/

OnFailure=emergency.target
OnFailureJobMode=isolate
Expand All @@ -32,4 +32,5 @@ RemainAfterExit=yes
EnvironmentFile=/run/ignition.env
# Flatcar: Make sure that the OEM mount point is there even if it shortly was away
ExecStartPre=-systemctl start sysroot-oem.mount
ExecStartPre=-systemctl start sysroot-var.mount
ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=files --log-to-stdout

0 comments on commit 6a3e7c6

Please sign in to comment.