Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Add mount and umount service units #47

Merged
merged 3 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions dracut/30ignition/ignition-ask-var-mount.service

This file was deleted.

6 changes: 2 additions & 4 deletions dracut/30ignition/ignition-complete.target
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
# initrd.
[Unit]
Description=Ignition Complete
OnFailure=emergency.target
OnFailureJobMode=isolate

# Make sure we stop all the units before switching root
Conflicts=initrd-switch-root.target umount.target
Conflicts=dracut-emergency.service emergency.service emergency.target

# This ensures that we fail the boot if the stopping units fails
OnFailure=emergency.target
OnFailureJobMode=isolate
2 changes: 2 additions & 0 deletions dracut/30ignition/ignition-disks.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Description=Ignition (disks)
DefaultDependencies=false
Before=ignition-complete.target
OnFailure=emergency.target
OnFailureJobMode=isolate

# This stage runs between `basic.target` and `initrd-root-fs.target`,
# see https://www.freedesktop.org/software/systemd/man/bootup.html
Expand Down
22 changes: 5 additions & 17 deletions dracut/30ignition/ignition-files.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,16 @@
Description=Ignition (files)
DefaultDependencies=false
Before=ignition-complete.target
OnFailure=emergency.target
OnFailureJobMode=isolate

# Ignition files stage starts after /sysroot is mounted.
Requires=initrd-root-fs.target
After=initrd-root-fs.target

# Run after ignition-setup has run because ignition-setup
# may copy in new/different ignition configs for us to consume.
After=ignition-setup.service

# Make sure root filesystem is mounted read-write
After=ignition-remount-sysroot.service
# We need all the filesystems already mounted.
Requires=ignition-mount.service
After=ignition-mount.service

# Run before initrd-parse-etc so that we can drop files it then picks up.
Before=initrd-parse-etc.service

# Network may be required to fetch userdata content.
After=network.target

# This is guaranteed through After=initrd-root-fs.target but just to
# be explicit we'll add an After=ignition-disks.service here.
After=ignition-disks.service

[Service]
Type=oneshot
EnvironmentFile=/run/ignition.env
Expand Down
23 changes: 23 additions & 0 deletions dracut/30ignition/ignition-mount.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=Ignition (mount)
DefaultDependencies=false
OnFailure=emergency.target
OnFailureJobMode=isolate

# Make sure the final /sysroot is ready first, since we're mounting under there
Requires=initrd-root-fs.target
After=initrd-root-fs.target

# Make sure root filesystem is remounted read-write if needed
After=ignition-remount-sysroot.service

# This is guaranteed through After=initrd-root-fs.target but just to
# be explicit.
After=ignition-disks.service

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/run/ignition.env
ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=mount --log-to-stdout
ExecStop=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=umount --log-to-stdout
jlebon marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions dracut/30ignition/ignition-remount-sysroot.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ DefaultDependencies=no
After=sysroot.mount
Before=ignition-complete.target
ConditionPathIsReadWrite=!/sysroot
OnFailure=emergency.target
OnFailureJobMode=isolate

[Service]
Type=oneshot
Expand Down
2 changes: 2 additions & 0 deletions dracut/30ignition/ignition-setup.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Description=Ignition (setup)
DefaultDependencies=false
Before=ignition-complete.target
OnFailure=emergency.target
OnFailureJobMode=isolate

Requires=local-fs-pre.target
Before=local-fs-pre.target
Expand Down
2 changes: 1 addition & 1 deletion dracut/30ignition/ignition-setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -eu
set -euo pipefail

copy_file_if_exists() {
src="${1}"; dst="${2}"
Expand Down
2 changes: 1 addition & 1 deletion dracut/30ignition/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ install() {

install_ignition_unit ignition-setup.service
install_ignition_unit ignition-disks.service
install_ignition_unit ignition-mount.service
install_ignition_unit ignition-files.service
install_ignition_unit ignition-ask-var-mount.service
install_ignition_unit ignition-remount-sysroot.service
}

Expand Down