Blame 0001-dracut-lib-add-str_ends-to-go-along-with-str_starts.patch
|
Harald Hoyer |
ab65ae |
From d8f0e320c267af0ce373066f524eab618ce931af Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
ab65ae |
From: Will Woods <wwoods@redhat.com>
|
|
Harald Hoyer |
ab65ae |
Date: Thu, 5 Apr 2012 13:01:35 -0400
|
|
Harald Hoyer |
ab65ae |
Subject: [PATCH] dracut-lib: add str_ends, to go along with str_starts
|
|
Harald Hoyer |
ab65ae |
|
|
Harald Hoyer |
ab65ae |
---
|
|
Harald Hoyer |
ab65ae |
modules.d/99base/dracut-lib.sh | 5 +++++
|
|
Harald Hoyer |
ab65ae |
1 file changed, 5 insertions(+)
|
|
Harald Hoyer |
ab65ae |
|
|
Harald Hoyer |
ab65ae |
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
ab65ae |
index cb2e4dc..1ecd286 100755
|
|
Harald Hoyer |
ab65ae |
--- a/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
ab65ae |
+++ b/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
ab65ae |
@@ -12,6 +12,11 @@ str_starts() {
|
|
Harald Hoyer |
ab65ae |
[ "${1#$2*}" != "$1" ]
|
|
Harald Hoyer |
ab65ae |
}
|
|
Harald Hoyer |
ab65ae |
|
|
Harald Hoyer |
ab65ae |
+# returns OK if $1 contains $2 at the end
|
|
Harald Hoyer |
ab65ae |
+str_ends() {
|
|
Harald Hoyer |
ab65ae |
+ [ "${1%*$2}" != "$1" ]
|
|
Harald Hoyer |
ab65ae |
+}
|
|
Harald Hoyer |
ab65ae |
+
|
|
Harald Hoyer |
ab65ae |
# replaces all occurrences of 'search' in 'str' with 'replacement'
|
|
Harald Hoyer |
ab65ae |
#
|
|
Harald Hoyer |
ab65ae |
# str_replace str search replacement
|