Skip to content

Commit 6a3e7c6

Browse files
committed
wip
1 parent 9eaeae2 commit 6a3e7c6

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

dracut/10diskless-generator/diskless-generator

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,22 @@ add_requires() {
2525
ln -sf "../${name}" "${requires_dir}/${name}"
2626
}
2727

28+
add_wants() {
29+
local name="$1"
30+
local wants_dir="${UNIT_DIR}/initrd-root-fs.target.wants"
31+
mkdir -p "${wants_dir}"
32+
ln -sf "../${name}" "${wants_dir}/${name}"
33+
}
34+
2835
# set to 1 to enable copying /oem from the initrd
2936
copy_oem=0
3037
# check both the new mount.usr and our old usr kernel options
3138
usr=$(cmdline_arg mount.usr "$(cmdline_arg usr)")
3239
root=$(cmdline_arg root)
3340
rootfstype=$(cmdline_arg rootfstype tmpfs)
3441
rootflags=$(cmdline_arg rootflags)
42+
# check possible future systemd support for separate "/var"
43+
var=$(cmdline_arg mount.var)
3544

3645
# If usr= was not specified and a squashfs is bundled in the initrd use it.
3746
if [[ -z "${usr}" && -f /usr.squashfs ]]; then
@@ -151,3 +160,19 @@ Type=auto
151160
Options=nodev
152161
EOF
153162
fi
163+
164+
if [[ -z "${var}" ]]; then
165+
add_wants sysroot-oem.mount
166+
cat >"${UNIT_DIR}/sysroot-var.mount" <<EOF
167+
# Automatically generated by diskless-generator
168+
169+
[Unit]
170+
Before=initrd-root-fs.target
171+
172+
[Mount]
173+
What=/dev/disk/by-label/VAR
174+
Where=/sysroot/var
175+
Type=auto
176+
Options=rw
177+
EOF
178+
fi

dracut/30ignition/ignition-files.service

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Requires=initrd-setup-root.service
1515
After=initrd-setup-root.service
1616
# Already mount the OEM partition here so that it works to write files
1717
# without having to declare it as initrd mount in Ignition
18-
RequiresMountsFor=/sysroot/usr/ /sysroot/oem/
18+
RequiresMountsFor=/sysroot/usr/ /sysroot/oem/ /sysroot/var/
1919

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

0 commit comments

Comments
 (0)