This was accidentally working in old bash versions, not anymore in
Fedora 13's bash 4.1.7. Now using proper prefix matching instead of
the previous regex matching disguised as pattern matching.
---
tools/livecd-iso-to-disk.sh | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index f4d0855..846fa73 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -39,10 +39,15 @@ exitclean() {
exit 1
}
+isdevloop()
+{
+ [ x"${1#/dev/loop}" != x"$1" ]
+}
+
getdisk() {
DEV=$1
- if [[ "$DEV" =~ "/dev/loop*" ]]; then
+ if isdevloop "$DEV"; then
device="$DEV"
return
fi
@@ -65,7 +70,7 @@ getdisk() {
}
resetMBR() {
- if [[ "$DEV" =~ "/dev/loop*" ]]; then
+ if isdevloop "$DEV"; then
return
fi
getdisk $1
@@ -94,7 +99,7 @@ resetMBR() {
}
checkMBR() {
- if [[ "$DEV" =~ "/dev/loop*" ]]; then
+ if isdevloop "$DEV"; then
return 0
fi
getdisk $1
@@ -124,7 +129,7 @@ checkPartActive() {
if [ "$dev" = "$device" ]; then
return
fi
- if [[ "$dev" =~ "/dev/loop*" ]]; then
+ if isdevloop "$dev"; then
return
fi
--
1.7.2