Skip to content

Commit acfa793

Browse files
aafeijoo-suseLaszloGombos
authored andcommitted
fix(dracut-systemd): check and create generator dir outside of inner function
1 parent a7c0471 commit acfa793

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: modules.d/98dracut-systemd/rootfs-generator.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ generator_mount_rootfs() {
5151
[ -z "$1" ] && return 0
5252

5353
_name=$(dev_unit_name "$1")
54-
[ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"
5554
if ! [ -f "$GENERATOR_DIR"/sysroot.mount ]; then
5655
{
5756
echo "[Unit]"
@@ -101,9 +100,11 @@ case "${root#block:}" in
101100
;;
102101
esac
103102

104-
GENERATOR_DIR="$1"
105-
106103
if [ "$rootok" = "1" ]; then
104+
GENERATOR_DIR="$1"
105+
[ -z "$GENERATOR_DIR" ] && exit 1
106+
[ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"
107+
107108
generator_wait_for_dev "${root#block:}"
108109
generator_fsck_after_pre_mount "${root#block:}"
109110
strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"

0 commit comments

Comments
 (0)