Marcus Meissner
d695f6da8a
- Print stored dracut commandline during initramfs build * Add: 0101-Print-stored-dracut-commandline-during-initramfs-bui.patch - Align dev_unit_name() with systemd's function * Add: 0102-Align-dev_unit_name-with-systemd-s-function.patch - Fixup missing separators in rootfs-block cmdline * Add: 0103-Fixup-missing-separators-in-rootfs-block-cmdline.patch - Generate fallback mount unit for root filesystem (bnc#855258) * Add: 0104-Generate-fallback-mount-unit-for-root-filesystem.patch - 95iscsi: parse output from iscsiadm correctly (bnc#886199) * Add: 0105-95iscsi-parse-output-from-iscsiadm-correctly.patch OBS-URL: https://build.opensuse.org/request/show/239877 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=169
52 lines
1.3 KiB
Diff
52 lines
1.3 KiB
Diff
From ad1acb808e5c7695cb54af7b449db11afd710f21 Mon Sep 17 00:00:00 2001
|
|
From: Thorsten Behrens <tbehrens@suse.com>
|
|
Date: Sun, 22 Jun 2014 03:19:51 +0200
|
|
Subject: Align dev_unit_name() with systemd's function.
|
|
|
|
Add more corner cases from systemd's
|
|
unit_name_from_path_instance() C function.
|
|
|
|
Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
|
|
---
|
|
modules.d/99base/dracut-lib.sh | 22 +++++++++++++++++-----
|
|
1 file changed, 17 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
|
|
index 5a867b8..e201af8 100755
|
|
--- a/modules.d/99base/dracut-lib.sh
|
|
+++ b/modules.d/99base/dracut-lib.sh
|
|
@@ -857,13 +857,25 @@ wait_for_mount()
|
|
} >> "$hookdir/emergency/90-${_name}.sh"
|
|
}
|
|
|
|
+# get a systemd-compatible unit name from a path
|
|
+# (mimicks unit_name_from_path_instance())
|
|
dev_unit_name()
|
|
{
|
|
- _name="${1%%/}"
|
|
- _name="${_name##/}"
|
|
- _name="$(str_replace "$_name" '-' '\x2d')"
|
|
- _name="$(str_replace "$_name" '/' '-')"
|
|
- echo "$_name"
|
|
+ local dev="$1"
|
|
+
|
|
+ if [ "$dev" = "/" -o -z "$dev" ]; then
|
|
+ printf -- "-"
|
|
+ exit 0
|
|
+ fi
|
|
+
|
|
+ dev="${1%%/}"
|
|
+ dev="${dev##/}"
|
|
+ dev="$(str_replace "$dev" '\' '\x5c')"
|
|
+ dev="$(str_replace "$dev" '-' '\x2d')"
|
|
+ dev=${dev/#\./\\x2e}
|
|
+ dev="$(str_replace "$dev" '/' '-')"
|
|
+
|
|
+ printf -- "%s" "$dev"
|
|
}
|
|
|
|
# wait_for_dev <dev>
|
|
--
|
|
1.8.4.5
|
|
|