]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-lib.sh:dev_unit_name(): use systemd-escape, if available
authorHarald Hoyer <harald@redhat.com>
Thu, 21 Aug 2014 14:45:12 +0000 (16:45 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 21 Aug 2014 14:45:12 +0000 (16:45 +0200)
modules.d/99base/dracut-lib.sh

index 7d97c7a5b7a4fab433cfda1e3c4f6f414d5d0864..738e34b87658161b99f74de494e9dfbfd96cd59f 100755 (executable)
@@ -866,6 +866,11 @@ wait_for_mount()
 
 dev_unit_name()
 {
+    if command -v systemd-escape >/dev/null; then
+        systemd-escape -p  "$1"
+        return
+    fi
+
     _name="${1%%/}"
     _name="${_name##/}"
     _name="$(str_replace "$_name" '-' '\x2d')"