Skip to content

Commit 8801285

Browse files
committed
wip
1 parent 9eaeae2 commit 8801285

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

dracut/10diskless-generator/diskless-generator

Lines changed: 26 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,20 @@ 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+
ConditionPathExists=/dev/disk/by-label/VAR
171+
Before=initrd-root-fs.target
172+
173+
[Mount]
174+
What=/dev/disk/by-label/VAR
175+
Where=/sysroot/var
176+
Type=auto
177+
Options=rw
178+
EOF
179+
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

dracut/30ignition/ignition-mount.service

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ RemainAfterExit=yes
3737
EnvironmentFile=/run/ignition.env
3838
# Flatcar: Unmount any OEM mount in case the Ignition config has one defined
3939
ExecStartPre=/bin/bash -c 'if ! mount | grep -m 1 /sysroot/oem | grep tmpfs; then umount /sysroot/oem || true; fi'
40+
ExecStartPre=/bin/bash -c 'if mount | grep -m 1 /sysroot/var; then umount /sysroot/var || true; fi'
4041
ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=mount --log-to-stdout
4142
ExecStop=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=umount --log-to-stdout

0 commit comments

Comments
 (0)