3 type getarg
>/dev
/null
2>&1 || .
/lib
/dracut-lib.sh
5 generator_wait_for_dev
()
10 _name
="$(str_replace "$1" '/' '\x2f')"
11 _timeout
=$
(getarg rd.timeout
)
12 _timeout
=${_timeout:-0}
14 if ! [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ]; then
16 printf '[ -e "%s" ]\n' $1 \
17 >> "$hookdir/initqueue/finished/devexists-${_name}.sh"
19 printf '[ -e "%s" ] || ' $1
20 printf 'warn "\"%s\" does not exist"\n' $1
21 } >> "$hookdir/emergency/80-${_name}.sh"
24 _name
=$
(dev_unit_name
"$1")
25 if ! [ -L "$GENERATOR_DIR"/initrd.target.wants
/${_name}.device
]; then
26 [ -d "$GENERATOR_DIR"/initrd.target.wants
] || mkdir
-p "$GENERATOR_DIR"/initrd.target.wants
27 ln -s ..
/${_name}.device
"$GENERATOR_DIR"/initrd.target.wants
/${_name}.device
30 if ! [ -f "$GENERATOR_DIR"/${_name}.device.d
/timeout.conf
]; then
31 mkdir
-p "$GENERATOR_DIR"/${_name}.device.d
34 echo "JobTimeoutSec=$_timeout"
35 } > "$GENERATOR_DIR"/${_name}.device.d
/timeout.conf
39 generator_mount_rootfs
()
45 [ -z "$1" ] && return 0
47 _name
=$
(dev_unit_name
"$1")
48 [ -d "$GENERATOR_DIR" ] || mkdir
-p "$GENERATOR_DIR"
49 if ! [ -f "$GENERATOR_DIR"/sysroot.mount
]; then
52 echo "Before=initrd-root-fs.target"
53 echo "RequiresOverridable=systemd-fsck@${_name}.service"
54 echo "After=systemd-fsck@${_name}.service"
58 echo "Options=${_flags}"
60 } > "$GENERATOR_DIR"/sysroot.mount
62 if ! [ -L "$GENERATOR_DIR"/initrd-root-fs.target.requires
/sysroot.mount
]; then
63 [ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires
] || mkdir
-p "$GENERATOR_DIR"/initrd-root-fs.target.requires
64 ln -s ..
/sysroot.mount
"$GENERATOR_DIR"/initrd-root-fs.target.requires
/sysroot.mount
70 block
:LABEL
=*|LABEL
=*)
72 root
="$(echo $root | sed 's,/,\\x2f,g')"
73 root
="block:/dev/disk/by-label/${root#LABEL=}"
77 root
="block:/dev/disk/by-uuid/${root#UUID=}"
79 block
:PARTUUID
=*|PARTUUID
=*)
81 root
="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
83 block
:PARTLABEL
=*|PARTLABEL
=*)
85 root
="block:/dev/disk/by-partlabel/${root#PARTLABEL=}"
87 /dev
/nfs
) # ignore legacy /dev/nfs
96 if [ "${root%%:*}" = "block" ]; then
97 generator_wait_for_dev
"${root#block:}" "$RDRETRY"
98 strstr
"$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs
"${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"