summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stummvoll <michael@stummi.org>2013-03-27 16:22:05 +0100
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 13:54:16 +0200
commitd93e867ac670b8345d154ccbd04b28d1c0291da1 (patch)
treee5940574f517d05b769cec117907621600f302bf
parent0f10a899281806360e427b5cfdd0474c8bad2d85 (diff)
downloadlive-boot-d93e867ac670b8345d154ccbd04b28d1c0291da1.tar.gz
live-boot-d93e867ac670b8345d154ccbd04b28d1c0291da1.zip
Fixing a bug with multiple files in is_live_path after the last commit.
The version in the last commit has a bug handling multiple files in is_live_path, the fix introduces file_pattern_matches() which checks for $1 only. So even if there are multiple files matching the pattern only the first one will go into the [ -e ... ] expression.
-rwxr-xr-xscripts/boot/9990-misc-helpers.sh26
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/boot/9990-misc-helpers.sh b/scripts/boot/9990-misc-helpers.sh
index 8d7943e..40e69be 100755
--- a/scripts/boot/9990-misc-helpers.sh
+++ b/scripts/boot/9990-misc-helpers.sh
@@ -2,21 +2,21 @@
#set -e
-is_live_path ()
+file_pattern_matches()
{
- DIRECTORY="${1}"
-
- if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
- then
- for FILESYSTEM in squashfs ext2 ext3 ext4 xfs dir jffs2
- do
- if [ -e "${DIRECTORY}/${LIVE_MEDIA_PATH}/"*".${FILESYSTEM}" ]
- then
- return 0
- fi
- done
- fi
+ [ -e "$1" ]
+}
+is_live_path()
+{
+ DIRECTORY="${1}/${LIVE_MEDIA_PATH}"
+ for FILESYSTEM in squashfs ext2 ext3 ext4 xfs dir jffs
+ do
+ if file_pattern_matches "${DIRECTORY}/"*.${FILESYSTEM}
+ then
+ return 0
+ fi
+ done
return 1
}