if [ -n "$boot" ]; then
case "$boot" in
- LABEL=*)
- boot="$(echo $boot | sed 's,/,\\x2f,g')"
- boot="/dev/disk/by-label/${boot#LABEL=}"
- ;;
- UUID=*)
- boot="/dev/disk/by-uuid/${boot#UUID=}"
- ;;
- PARTUUID=*)
- boot="/dev/disk/by-partuuid/${boot#PARTUUID=}"
- ;;
- PARTLABEL=*)
- boot="/dev/disk/by-partlabel/${boot#PARTLABEL=}"
+ LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
+ boot="$(label_uuid_to_dev "$boot")"
;;
/dev/*)
;;
[ "${liveroot%%:*}" = "live" ] || exit 0
case "$liveroot" in
- live:LABEL=*|LABEL=*) \
- root="${root#live:}"
- root="${root//\//\\x2f}"
- root="live:/dev/disk/by-label/${root#LABEL=}"
+ live:LABEL=*|LABEL=* | live:UUID=*|UUID=* | live:PARTUUID=*|PARTUUID=* | live:PARTLABEL=*|PARTLABEL=*)
+ root="live:$(label_uuid_to_dev "${root#live:}")"
rootok=1 ;;
- live:CDLABEL=*|CDLABEL=*) \
+ live:CDLABEL=*|CDLABEL=*)
root="${root#live:}"
- root="${root//\//\\x2f}"
+ root="$(echo "$root" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
- live:UUID=*|UUID=*) \
- root="${root#live:}"
- root="live:/dev/disk/by-uuid/${root#UUID=}"
- rootok=1 ;;
- live:PARTUUID=*|PARTUUID=*) \
- root="${root#live:}"
- root="live:/dev/disk/by-partuuid/${root#PARTUUID=}"
- rootok=1 ;;
- live:PARTLABEL=*|PARTLABEL=*) \
- root="${root#live:}"
- root="live:/dev/disk/by-partlabel/${root#PARTLABEL=}"
- rootok=1 ;;
live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
root="${root#live:}"
root="liveiso:${root}"
modprobe -q loop
case "$liveroot" in
- live:LABEL=*|LABEL=*) \
- root="${root#live:}"
- root="${root//\//\\x2f}"
- root="live:/dev/disk/by-label/${root#LABEL=}"
+ live:LABEL=*|LABEL=* | live:UUID=*|UUID=* | live:PARTUUID=*|PARTUUID=* | live:PARTLABEL=*|PARTLABEL=*)
+ root="live:$(label_uuid_to_dev "${root#live:}")"
rootok=1 ;;
- live:CDLABEL=*|CDLABEL=*) \
+ live:CDLABEL=*|CDLABEL=*)
root="${root#live:}"
- root="${root//\//\\x2f}"
+ root="$(echo "$root" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
- live:UUID=*|UUID=*) \
- root="${root#live:}"
- root="live:/dev/disk/by-uuid/${root#UUID=}"
- rootok=1 ;;
- live:PARTUUID=*|PARTUUID=*) \
- root="${root#live:}"
- root="live:/dev/disk/by-partuuid/${root#PARTUUID=}"
- rootok=1 ;;
- live:PARTLABEL=*|PARTLABEL=*) \
- root="${root#live:}"
- root="live:/dev/disk/by-partlabel/${root#PARTLABEL=}"
- rootok=1 ;;
live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
root="${root#live:}"
root="liveiso:${root}"
LABEL=*) \
zipl_env="ENV{ID_FS_LABEL}"
zipl_val=${zipl_arg#LABEL=}
- zipl_arg="/dev/disk/by-label/${zipl_val}"
+ zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
;;
UUID=*) \
zipl_env="ENV{ID_FS_UUID}"
zipl_val=${zipl_arg#UUID=}
- zipl_arg="/dev/disk/by-uuid/${zipl_val}"
+ zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
+ ;;
+ PARTLABEL=*) \
+ zipl_env="ENV{ID_FS_PARTLABEL}"
+ zipl_val=${zipl_arg#PARTLABEL=}
+ zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
+ ;;
+ PARTUUID=*) \
+ zipl_env="ENV{ID_FS_PARTUUID}"
+ zipl_val=${zipl_arg#PARTUUID=}
+ zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
;;
/dev/mapper/*) \
zipl_env="ENV{DM_NAME}"
unset resume
fi
-case "$resume" in
- LABEL=*) \
- resume="$(echo $resume | sed 's,/,\\x2f,g')"
- resume="/dev/disk/by-label/${resume#LABEL=}" ;;
- UUID=*) \
- resume="/dev/disk/by-uuid/${resume#UUID=}" ;;
- PARTUUID=*) \
- resume="/dev/disk/by-partuuid/${resume#PARTUUID=}" ;;
- PARTLABEL=*) \
- resume="/dev/disk/by-partlabel/${resume#PARTLABEL=}" ;;
-esac
+
+resume="$(label_uuid_to_dev "$resume")"
if splash=$(getarg splash=); then
export splash
#!/bin/sh
-case "$root" in
- block:LABEL=*|LABEL=*)
- root="${root#block:}"
- root="$(echo $root | sed 's,/,\\x2f,g')"
- root="block:/dev/disk/by-label/${root#LABEL=}"
- rootok=1 ;;
- block:UUID=*|UUID=*)
- root="${root#block:}"
- root="${root#UUID=}"
- root="$(echo $root | tr "[:upper:]" "[:lower:]")"
- root="block:/dev/disk/by-uuid/${root#UUID=}"
- rootok=1 ;;
- block:PARTUUID=*|PARTUUID=*)
- root="${root#block:}"
- root="${root#PARTUUID=}"
- root="$(echo $root | tr "[:upper:]" "[:lower:]")"
- root="block:/dev/disk/by-partuuid/${root}"
- rootok=1 ;;
- block:PARTLABEL=*|PARTLABEL=*)
- root="${root#block:}"
- root="block:/dev/disk/by-partlabel/${root#PARTLABEL=}"
+case "${root#block:}" in
+ LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
+ root="block:$(label_uuid_to_dev "$root")"
rootok=1 ;;
/dev/*)
- root="block:${root}"
+ root="block:${root#block:}"
rootok=1 ;;
esac
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
for root in $(getargs rootfallback=); do
- case "$root" in
- block:LABEL=*|LABEL=*)
- root="${root#block:}"
- root="$(echo $root | sed 's,/,\\x2f,g')"
- root="/dev/disk/by-label/${root#LABEL=}"
- ;;
- block:UUID=*|UUID=*)
- root="${root#block:}"
- root="${root#UUID=}"
- root="$(echo $root | tr "[:upper:]" "[:lower:]")"
- root="/dev/disk/by-uuid/${root#UUID=}"
- ;;
- block:PARTUUID=*|PARTUUID=*)
- root="${root#block:}"
- root="${root#PARTUUID=}"
- root="$(echo $root | tr "[:upper:]" "[:lower:]")"
- root="/dev/disk/by-partuuid/${root}"
- ;;
- block:PARTLABEL=*|PARTLABEL=*)
- root="${root#block:}"
- root="/dev/disk/by-partlabel/${root#PARTLABEL=}"
- ;;
- esac
+ root=$(label_uuid_to_dev "$root")
if ! [ -b "$root" ]; then
warn "Could not find rootfallback $root"
[ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh
-case "${root}${root_unset}" in
- block:LABEL=*|LABEL=*)
- root="${root#block:}"
- root="$(echo $root | sed 's,/,\\x2f,g')"
- root="block:/dev/disk/by-label/${root#LABEL=}"
- rootok=1 ;;
- block:UUID=*|UUID=*)
- root="${root#block:}"
- root="block:/dev/disk/by-uuid/${root#UUID=}"
- rootok=1 ;;
- block:PARTUUID=*|PARTUUID=*)
- root="${root#block:}"
- root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
- rootok=1 ;;
- block:PARTLABEL=*|PARTLABEL=*)
- root="${root#block:}"
- root="block:/dev/disk/by-partlabel/${root#PARTLABEL=}"
+case "${root#block:}${root_unset}" in
+ LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
+ root="block:$(label_uuid_to_dev "$root")"
rootok=1 ;;
/dev/*)
root="block:${root}"
}
root=$(getarg root=)
-case "$root" in
- block:LABEL=*|LABEL=*)
- root="${root#block:}"
- root="$(echo $root | sed 's,/,\\x2f,g')"
- root="block:/dev/disk/by-label/${root#LABEL=}"
- rootok=1 ;;
- block:UUID=*|UUID=*)
- root="${root#block:}"
- root="block:/dev/disk/by-uuid/${root#UUID=}"
- rootok=1 ;;
- block:PARTUUID=*|PARTUUID=*)
- root="${root#block:}"
- root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
- rootok=1 ;;
- block:PARTLABEL=*|PARTLABEL=*)
- root="${root#block:}"
- root="block:/dev/disk/by-partlabel/${root#PARTLABEL=}"
+case "${root#block:}" in
+ LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
+ root="block:$(label_uuid_to_dev "$root")"
rootok=1 ;;
/dev/nfs) # ignore legacy /dev/nfs
;;
while read _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
[ "${_dev%%#*}" != "$_dev" ] && continue
if [ "$_mp" = "/usr" ]; then
- case "$_dev" in
- LABEL=*)
- _dev="$(echo $_dev | sed 's,/,\\x2f,g')"
- _dev="/dev/disk/by-label/${_dev#LABEL=}"
- ;;
- UUID=*)
- _dev="${_dev#block:}"
- _dev="/dev/disk/by-uuid/${_dev#UUID=}"
- ;;
- esac
+ _dev="$(label_uuid_to_dev "$_dev")"
+
if strstr "$_opts" "subvol=" && \
[ "${root#block:}" -ef $_dev ] && \
[ -n "$rflags" ]; then
esac
}
+label_uuid_to_dev() {
+ local _dev
+ _dev="${1#block:}"
+ case "$_dev" in
+ LABEL=*)
+ echo "/dev/disk/by-label/$(echo "${_dev#LABEL=}" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
+ ;;
+ PARTLABEL=*)
+ echo "/dev/disk/by-partlabel/$(echo "${_dev#PARTLABEL=}" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
+ ;;
+ UUID=*)
+ echo "/dev/disk/by-uuid/$(echo "${_dev#UUID=}" | tr "[:upper:]" "[:lower:]")"
+ ;;
+ PARTUUID=*)
+ echo "/dev/disk/by-partuuid/$(echo "${_dev#PARTUUID=}" | tr "[:upper:]" "[:lower:]")"
+ ;;
+ esac
+}
+
# Prints unique path for potential file inside specified directory. It consists
# of specified directory, prefix and number at the end which is incremented
# until non-existing file is found.