Skip to content

Commit

Permalink
fix(dracut-systemd): do not hardcode the systemd generator directory
Browse files Browse the repository at this point in the history
The normal directory is the first argument passed to the systemd generator,
so use it instead of hardcoding /run/systemd/generator.
  • Loading branch information
aafeijoo-suse authored and LaszloGombos committed May 10, 2023
1 parent 6cd41ab commit a7c0471
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules.d/98dracut-systemd/rootfs-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ generator_wait_for_dev() {
# after remote-fs-pre.target since the initqueue is ordered before it so
# it will never actually show up (think Tang-pinned rootfs).
cat > "$hookdir/initqueue/finished/devexists-${_name}.sh" << EOF
if ! grep -q After=remote-fs-pre.target /run/systemd/generator/systemd-cryptsetup@*.service 2>/dev/null; then
if ! grep -q After=remote-fs-pre.target "$GENERATOR_DIR"/systemd-cryptsetup@*.service 2>/dev/null; then
[ -e "$1" ]
fi
EOF
Expand Down Expand Up @@ -77,12 +77,12 @@ generator_fsck_after_pre_mount() {
[ -z "$1" ] && return 0

_name=$(dev_unit_name "$1")
[ -d /run/systemd/generator/systemd-fsck@"${_name}".service.d ] || mkdir -p /run/systemd/generator/systemd-fsck@"${_name}".service.d
if ! [ -f /run/systemd/generator/systemd-fsck@"${_name}".service.d/after-pre-mount.conf ]; then
[ -d "$GENERATOR_DIR"/systemd-fsck@"${_name}".service.d ] || mkdir -p "$GENERATOR_DIR"/systemd-fsck@"${_name}".service.d
if ! [ -f "$GENERATOR_DIR"/systemd-fsck@"${_name}".service.d/after-pre-mount.conf ]; then
{
echo "[Unit]"
echo "After=dracut-pre-mount.service"
} > /run/systemd/generator/systemd-fsck@"${_name}".service.d/after-pre-mount.conf
} > "$GENERATOR_DIR"/systemd-fsck@"${_name}".service.d/after-pre-mount.conf
fi

}
Expand Down

0 comments on commit a7c0471

Please sign in to comment.