File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff 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
2936copy_oem=0
3037# check both the new mount.usr and our old usr kernel options
3138usr=$( cmdline_arg mount.usr " $( cmdline_arg usr) " )
3239root=$( cmdline_arg root)
3340rootfstype=$( cmdline_arg rootfstype tmpfs)
3441rootflags=$( 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.
3746if [[ -z " ${usr} " && -f /usr.squashfs ]]; then
@@ -151,3 +160,20 @@ Type=auto
151160Options=nodev
152161EOF
153162fi
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
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ Requires=initrd-setup-root.service
1515After =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
2020OnFailure =emergency.target
2121OnFailureJobMode =isolate
@@ -32,4 +32,5 @@ RemainAfterExit=yes
3232EnvironmentFile =/run/ignition.env
3333# Flatcar: Make sure that the OEM mount point is there even if it shortly was away
3434ExecStartPre =-systemctl start sysroot-oem.mount
35+ ExecStartPre =-systemctl start sysroot-var.mount
3536ExecStart =/usr/bin/ignition --root =/sysroot --platform =${PLATFORM_ID} --stage =files --log-to-stdout
Original file line number Diff line number Diff line change @@ -37,5 +37,6 @@ RemainAfterExit=yes
3737EnvironmentFile =/run/ignition.env
3838# Flatcar: Unmount any OEM mount in case the Ignition config has one defined
3939ExecStartPre =/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'
4041ExecStart =/usr/bin/ignition --root =/sysroot --platform =${PLATFORM_ID} --stage =mount --log-to-stdout
4142ExecStop =/usr/bin/ignition --root =/sysroot --platform =${PLATFORM_ID} --stage =umount --log-to-stdout
You can’t perform that action at this time.
0 commit comments