Skip to content

Commit 2fb3cfa

Browse files
lucabHuijingHei
authored andcommitted
core/dracut/ignition-ostree: add ignition-ostree-sysusers service
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.
1 parent 2544bae commit 2fb3cfa

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# Run systemd-sysusers for the target OSTree sysroot.
3+
4+
set -euo pipefail
5+
6+
main() {
7+
coreos-sysroot-bwrap systemd-sysusers
8+
coreos-relabel \
9+
/etc/group \
10+
/etc/group- \
11+
/etc/gshadow \
12+
/etc/gshadow- \
13+
/etc/passwd \
14+
/etc/passwd- \
15+
/etc/shadow \
16+
/etc/shadow-
17+
}
18+
19+
main "$@"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=Populate OSTree sysusers
3+
DefaultDependencies=false
4+
ConditionKernelCommandLine=|ostree
5+
6+
# Need to do this with all mount points active
7+
After=ignition-mount.service
8+
9+
# But *before* we start dumping files in there
10+
Before=ignition-files.service
11+
Before=ignition-ostree-populate-var.service
12+
13+
[Service]
14+
Type=oneshot
15+
RemainAfterExit=yes
16+
MountFlags=slave
17+
ExecStart=/usr/sbin/ignition-ostree-sysusers

overlay.d/05core/usr/lib/dracut/modules.d/40ignition-ostree/module-setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ install() {
7575
sgdisk \
7676
find
7777

78+
inst_script "$moddir/ignition-ostree-sysusers" \
79+
"/usr/sbin/ignition-ostree-sysusers"
80+
install_ignition_unit ignition-ostree-sysusers.service
81+
7882
for x in mount populate; do
7983
install_ignition_unit ignition-ostree-${x}-var.service
8084
inst_script "$moddir/ignition-ostree-${x}-var.sh" "/usr/sbin/ignition-ostree-${x}-var"

0 commit comments

Comments
 (0)