Skip to content

Commit

Permalink
core/dracut/ignition-ostree: add ignition-ostree-sysusers service
Browse files Browse the repository at this point in the history
This introduces a new `ignition-ostree-sysusers.service`, which takes
care of poulating users and groups on the target sysroot before the
Ignition `files` stage.
  • Loading branch information
lucab committed Dec 14, 2020
1 parent 2254792 commit a7e1233
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Run systemd-sysusers for the target OSTree sysroot.

set -euo pipefail

main() {
coreos-sysroot-bwrap systemd-sysusers
coreos-relabel \
/etc/group \
/etc/group- \
/etc/gshadow \
/etc/gshadow- \
/etc/passwd \
/etc/passwd- \
/etc/shadow \
/etc/shadow-
}

main "$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Populate OSTree sysusers
DefaultDependencies=false
ConditionKernelCommandLine=|ostree

# Need to do this with all mount points active
After=ignition-mount.service

# But *before* we start dumping files in there
Before=ignition-files.service
Before=ignition-ostree-populate-var.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/ignition-ostree-sysusers
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ install() {
sgdisk \
find

inst_script "$moddir/ignition-ostree-sysusers" \
"/usr/sbin/ignition-ostree-sysusers"
install_ignition_unit ignition-ostree-sysusers.service

for x in mount populate; do
install_ignition_unit ignition-ostree-${x}-var.service
inst_script "$moddir/ignition-ostree-${x}-var.sh" "/usr/sbin/ignition-ostree-${x}-var"
Expand Down

0 comments on commit a7e1233

Please sign in to comment.