712866
From 6656e1547f875253d1499bcd06ae0f6440a087c6 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Wed, 25 May 2016 14:49:34 +0200
712866
Subject: [PATCH] dracut-functions.sh: add str_starts() and str_ends()
712866
712866
---
712866
 dracut-functions.sh | 4 ++++
712866
 1 file changed, 4 insertions(+)
712866
712866
diff --git a/dracut-functions.sh b/dracut-functions.sh
5c6c2a
index d71ff676..4a9729c7 100755
712866
--- a/dracut-functions.sh
712866
+++ b/dracut-functions.sh
712866
@@ -29,6 +29,10 @@ fi
712866
 
712866
 # Generic substring function.  If $2 is in $1, return 0.
712866
 strstr() { [[ $1 = *$2* ]]; }
712866
+# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
712866
+str_starts() { [ "${1#"$2"*}" != "$1" ]; }
712866
+# returns OK if $1 contains literal string $2 at the end, and isn't empty
712866
+str_ends() { [ "${1%*"$2"}" != "$1" ]; }
712866
 
712866
 # helper function for check() in module-setup.sh
712866
 # to check for required installed binaries