]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dmsquash-live: Avoid grep and sed in this module.
authorFrederick Grose <fgrose@sugarlabs.org>
Mon, 3 Sep 2018 21:01:53 +0000 (17:01 -0400)
committerHarald Hoyer <harald@hoyer.xyz>
Thu, 6 Sep 2018 09:46:24 +0000 (11:46 +0200)
strstr and variable string manipulations suffice.

modules.d/90dmsquash-live/dmsquash-generator.sh
modules.d/90dmsquash-live/dmsquash-live-root.sh
modules.d/90dmsquash-live/module-setup.sh
modules.d/90dmsquash-live/parse-dmsquash-live.sh

index 1129ddff3b58349c855dc66dcb8f29c5b7e6d252..f57b1fc5ac964582204a8e52719de2cbe42c451f 100755 (executable)
@@ -18,12 +18,12 @@ fi
 case "$liveroot" in
     live:LABEL=*|LABEL=*) \
         root="${root#live:}"
-        root="$(echo $root | sed 's,/,\\x2f,g')"
+        root="${root//\//\\x2f}"
         root="live:/dev/disk/by-label/${root#LABEL=}"
         rootok=1 ;;
     live:CDLABEL=*|CDLABEL=*) \
         root="${root#live:}"
-        root="$(echo $root | sed 's,/,\\x2f,g')"
+        root="${root//\//\\x2f}"
         root="live:/dev/disk/by-label/${root#CDLABEL=}"
         rootok=1 ;;
     live:UUID=*|UUID=*) \
index 0f3d8f89f7383207b638c670fb20f8fe9d863910..330ba3e9e01ca55cabdc93371d9a3e5d0e04fc32 100755 (executable)
@@ -109,15 +109,15 @@ do_live_overlay() {
 
     if [ -z "$overlay" ]; then
         pathspec="/${live_dir}/overlay-$l-$u"
-    elif ( echo $overlay | grep -q ":" ); then
+    elif strstr $overlay ":"; then
         # pathspec specified, extract
-        pathspec=$( echo $overlay | sed -e 's/^.*://' )
+        pathspec=${overlay##*:}
     fi
 
     if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
         pathspec="/${live_dir}/overlay-$l-$u"
     fi
-    devspec=$( echo $overlay | sed -e 's/:.*$//' )
+    devspec=${overlay%%:*}
 
     # need to know where to look for the overlay
     if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
index 48418a06867d13251fb23631bc5723b90e1c9c7d..f251258fd8f7c9b18da32b51aed21a161d19e34d 100755 (executable)
@@ -22,7 +22,7 @@ installkernel() {
 
 # called by dracut
 install() {
-    inst_multiple umount dmsetup blkid dd losetup grep blockdev find
+    inst_multiple umount dmsetup blkid dd losetup blockdev find
     inst_multiple -o checkisomd5
     inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
     inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
index 0eedf1f66025ca6fa95d4977602b9e204f248e2e..4d46a36007ff48f652f2174825baa420873dd433 100755 (executable)
@@ -20,12 +20,12 @@ modprobe -q loop
 case "$liveroot" in
     live:LABEL=*|LABEL=*) \
         root="${root#live:}"
-        root="$(echo $root | sed 's,/,\\x2f,g')"
+        root="${root//\//\\x2f}"
         root="live:/dev/disk/by-label/${root#LABEL=}"
         rootok=1 ;;
     live:CDLABEL=*|CDLABEL=*) \
         root="${root#live:}"
-        root="$(echo $root | sed 's,/,\\x2f,g')"
+        root="${root//\//\\x2f}"
         root="live:/dev/disk/by-label/${root#CDLABEL=}"
         rootok=1 ;;
     live:UUID=*|UUID=*) \