Package: blktap / 2.0.90-3

Fixes-bashism-in-binsh-script-in-partvhdpartx.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Description: Fixes bashism in /bin/sh script in part/vhdpartx
 * Fixes bashism in /bin/sh script in part/vhdpartx (Closes: #690630).
Author: Thomas Goirand <zigo@debian.org>
Bug-Debian: http://bugs.debian.org/690630
Forwarded: By email to upstream

--- blktap-2.0.90.orig/part/vhdpartx
+++ blktap-2.0.90/part/vhdpartx
@@ -37,8 +37,8 @@ parse_args()
 	shift
     done
 
-    [[ -z "$lib" ]] && lib=$LIBVHDIO
-    [[ -z "$vhd" || "$count" != "1" ]] && usage
+    [ -z "$lib" ] && lib=$LIBVHDIO
+    [ -z "$vhd" ] || [ "$count" != "1" ] && usage
     return 0
 }
 
@@ -48,13 +48,13 @@ fdisk_read_partitions()
     local data=$(LD_PRELOAD=$lib fdisk -l $vhd)
 
     local none=$(echo $data | grep "This doesn't look like a partition table")
-    [[ -n "$none" ]] && partitions=0 && return 0
+    [ -n "$none" ] && partitions=0 && return 0
 
     partitions=4
-    while [[ "$partitions" != "0" ]]; do
+    while [ "$partitions" != "0" ]; do
 	local hit=$(echo $data | grep "${vhd}$partitions")
-	[[ -n "$hit" ]] && break
-	let partitions=$partitions-1
+	[ -n "$hit" ] && break
+	partitions=$(($partitions - 1 ))
     done
 }
 
@@ -66,9 +66,9 @@ part_util_read_partitions()
 list_mappings()
 {
     local parts=1
-    while [[ $parts -le $partitions ]]; do
+    while [ $parts -le $partitions ]; do
 	echo ${vhd}$parts
-	let parts=$parts+1
+	parts=$(($parts + 1 ))
     done
 }
 
@@ -76,32 +76,32 @@ add_mappings()
 {
     local parts=1
     local path=$(realpath $vhd)
-    while [[ $parts -le $partitions ]]; do
-	[[ -e ${path}${parts} ]] || ln -s $(basename $path) ${path}$parts
-	let parts=$parts+1
+    while [ $parts -le $partitions ]; do
+	[ -e ${path}${parts} ] || ln -s $(basename $path) ${path}$parts
+	parts=$(($parts + 1 ))
     done
 }
 
 del_mappings()
 {
     local parts=1
-    while [[ $parts -le $partitions ]]; do
-	[[ -L ${vhd}$parts ]] && rm -f ${vhd}$parts
-	let parts=$parts+1
+    while [ $parts -le $partitions ]; do
+	[ -L ${vhd}$parts ] && rm -f ${vhd}$parts
+	parts=$(($parts + 1 ))
     done
 }
 
 main()
 {
     parse_args $@
-    [[ -x $part_util ]] || die "can't find part-util"
-    [[ -r $vhd && -r $lib ]] || die "can't find vhd or lib"
+    [ -x $part_util ] || die "can't find part-util"
+    [ -r $vhd && -r $lib ] || die "can't find vhd or lib"
 
     part_util_read_partitions
 
-    [[ -n "$add" ]] && add_mappings
-    [[ -n "$del" ]] && del_mappings
-    [[ -n "$list" ]] && list_mappings
+    [ -n "$add" ] && add_mappings
+    [ -n "$del" ] && del_mappings
+    [ -n "$list" ] && list_mappings
 
     return 0
 }