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() {
25
25
ln -sf " ../${name} " " ${requires_dir} /${name} "
26
26
}
27
27
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
+
28
35
# set to 1 to enable copying /oem from the initrd
29
36
copy_oem=0
30
37
# check both the new mount.usr and our old usr kernel options
31
38
usr=$( cmdline_arg mount.usr " $( cmdline_arg usr) " )
32
39
root=$( cmdline_arg root)
33
40
rootfstype=$( cmdline_arg rootfstype tmpfs)
34
41
rootflags=$( cmdline_arg rootflags)
42
+ # check possible future systemd support for separate "/var"
43
+ var=$( cmdline_arg mount.var)
35
44
36
45
# If usr= was not specified and a squashfs is bundled in the initrd use it.
37
46
if [[ -z " ${usr} " && -f /usr.squashfs ]]; then
@@ -151,3 +160,20 @@ Type=auto
151
160
Options=nodev
152
161
EOF
153
162
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
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ Requires=initrd-setup-root.service
15
15
After =initrd-setup-root.service
16
16
# Already mount the OEM partition here so that it works to write files
17
17
# without having to declare it as initrd mount in Ignition
18
- RequiresMountsFor =/sysroot/usr/ /sysroot/oem/
18
+ RequiresMountsFor =/sysroot/usr/ /sysroot/oem/ /sysroot/var/
19
19
20
20
OnFailure =emergency.target
21
21
OnFailureJobMode =isolate
@@ -32,4 +32,5 @@ RemainAfterExit=yes
32
32
EnvironmentFile =/run/ignition.env
33
33
# Flatcar: Make sure that the OEM mount point is there even if it shortly was away
34
34
ExecStartPre =-systemctl start sysroot-oem.mount
35
+ ExecStartPre =-systemctl start sysroot-var.mount
35
36
ExecStart =/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
37
37
EnvironmentFile =/run/ignition.env
38
38
# Flatcar: Unmount any OEM mount in case the Ignition config has one defined
39
39
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'
40
41
ExecStart =/usr/bin/ignition --root =/sysroot --platform =${PLATFORM_ID} --stage =mount --log-to-stdout
41
42
ExecStop =/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