Rev 14 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 14 | Rev 16 | ||
---|---|---|---|
1 | #! /bin/sh /usr/share/dpatch/dpatch-run |
1 | #!/bin/sh -e |
2 | ## bashisms.dpatch by Magnus Holmgren <holmgren@debian.org> |
2 | ## bashisms.dpatch by Magnus Holmgren <holmgren@debian.org> |
3 | ## |
3 | ## |
4 | ## DP: Replace non-POSIX `type' command with `which', kill -SIGNAL |
- | |
5 | ## DP: with kill -s SIGNAL and trap "final" 0 2 15 with trap "final" |
4 | ## DP: Change all shell references to /bin/bash to avoid problems |
6 | ## DP: 0 INT TERM. |
5 | ## DP: when /bin/sh is not Bash. |
7 | 6 | ||
8 | @DPATCH@ |
- | |
9 | diff -urNad trunk~/scripts/ssvnc trunk/scripts/ssvnc |
- | |
10 | --- trunk~/scripts/ssvnc 2010-02-01 00:19:05.000000000 +0100 |
- | |
11 | +++ trunk/scripts/ssvnc 2010-02-01 00:19:06.000000000 +0100 |
- | |
12 | @@ -169,7 +169,7 @@ |
7 | dpatch_patch() { |
13 | WISH=wish |
- | |
14 | for try in wish8.4 wish wish8.3 wish8.5 wish8.6 |
- | |
15 | do |
- | |
16 | - if type $try > /dev/null 2>&1; then |
- | |
17 | + if which $try > /dev/null 2>&1; then |
- | |
18 | WISH=$try |
- | |
19 | break |
- | |
20 | fi |
- | |
21 | @@ -230,13 +230,13 @@ |
- | |
22 | PATH=$PATH:/usr/sbin:/usr/local/sbin:/dist/sbin |
- | |
23 | - | ||
24 | quit=0 |
- | |
25 | - if type vncviewer >/dev/null 2>/dev/null; then |
- | |
26 | + if which vncviewer >/dev/null 2>/dev/null; then |
- | |
27 | : |
- | |
28 | else |
- | |
29 | echo "vncviewer not found in PATH." |
- | |
30 | quit=1 |
- | |
31 | fi |
- | |
32 | - if type stunnel >/dev/null 2>/dev/null; then |
- | |
33 | + if which stunnel >/dev/null 2>/dev/null; then |
- | |
34 | : |
- | |
35 | else |
- | |
36 | echo "stunnel not found in PATH." |
8 | files=`grep -Rl '/bin/sh' scripts` |
37 | diff -urNad trunk~/scripts/ssvnc_cmd trunk/scripts/ssvnc_cmd |
- | |
38 | --- trunk~/scripts/ssvnc_cmd 2009-11-26 21:02:11.000000000 +0100 |
- | |
39 | +++ trunk/scripts/ssvnc_cmd 2010-02-01 00:19:06.000000000 +0100 |
- | |
40 | @@ -184,13 +184,13 @@ |
- | |
41 | PATH=$PATH:/usr/sbin:/usr/local/sbin:/dist/sbin |
- | |
42 | 9 | ||
43 | quit=0 |
- | |
44 | - if type vncviewer >/dev/null 2>/dev/null; then |
- | |
45 | + if which vncviewer >/dev/null 2>/dev/null; then |
- | |
46 | : |
- | |
47 | else |
- | |
48 | echo "vncviewer not found in PATH." |
- | |
49 | quit=1 |
- | |
50 | fi |
- | |
51 | - if type stunnel >/dev/null 2>/dev/null; then |
- | |
52 | + if which stunnel >/dev/null 2>/dev/null; then |
- | |
53 | : |
- | |
54 | else |
- | |
55 | echo "stunnel not found in PATH." |
- | |
56 | @@ -266,7 +266,7 @@ |
- | |
57 | if echo "$VNCVIEWERCMD" | grep '\.turbovnc' > /dev/null; then |
- | |
58 | : |
- | |
59 | else |
- | |
60 | - if type "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then |
- | |
61 | + if which "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then |
- | |
62 | VNCVIEWERCMD="$VNCVIEWERCMD.turbovnc" |
- | |
63 | fi |
- | |
64 | fi |
- | |
65 | diff -urNad trunk~/scripts/util/ss_vncviewer trunk/scripts/util/ss_vncviewer |
- | |
66 | --- trunk~/scripts/util/ss_vncviewer 2009-11-18 05:34:33.000000000 +0100 |
- | |
67 | +++ trunk/scripts/util/ss_vncviewer 2010-02-01 00:19:06.000000000 +0100 |
- | |
68 | @@ -135,7 +135,7 @@ |
- | |
69 | if echo "$VNCVIEWERCMD" | grep '\.turbovnc' > /dev/null; then |
- | |
70 | : |
- | |
71 | else |
- | |
72 | - if type "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then |
- | |
73 | + if which "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then |
- | |
74 | VNCVIEWERCMD="$VNCVIEWERCMD.turbovnc" |
- | |
75 | fi |
- | |
76 | fi |
- | |
77 | @@ -162,7 +162,7 @@ |
- | |
78 | check_stunnel=1 |
- | |
79 | if [ "X$SSVNC_BASEDIRNAME" != "X" ]; then |
- | |
80 | if [ -x "$SSVNC_BASEDIRNAME/stunnel" ]; then |
10 | if [ ! -f debian/patched/patched-bashisms.tar.gz ]; then |
81 | - type stunnel > /dev/null 2>&1 |
- | |
82 | + which stunnel > /dev/null 2>&1 |
- | |
83 | if [ $? = 0 ]; then |
- | |
84 | # found ours |
- | |
85 | STUNNEL=stunnel |
- | |
86 | @@ -171,7 +171,7 @@ |
- | |
87 | fi |
- | |
88 | fi |
- | |
89 | if [ "X$check_stunnel" = "X1" ]; then |
- | |
90 | - type stunnel4 > /dev/null 2>&1 |
- | |
91 | + which stunnel4 > /dev/null 2>&1 |
- | |
92 | if [ $? = 0 ]; then |
- | |
93 | STUNNEL=stunnel4 |
- | |
94 | else |
- | |
95 | @@ -411,7 +411,7 @@ |
- | |
96 | # a portable, but not absolutely safe, tmp file creator |
11 | tar -czf debian/patched/patched-bashisms.tar.gz $files |
97 | mytmp() { |
- | |
98 | tf=$1 |
- | |
99 | - if type mktemp > /dev/null 2>&1; then |
- | |
100 | + if which mktemp > /dev/null 2>&1; then |
- | |
101 | # if we have mktemp(1), use it: |
- | |
102 | tf2="$tf.XXXXXX" |
- | |
103 | tf2=`mktemp "$tf2"` |
- | |
104 | @@ -656,33 +656,33 @@ |
- | |
105 | fi |
- | |
106 | if [ "X$pssh" != "X" ]; then |
- | |
107 | echo "Terminating background ssh process" |
12 | sed -ri -e 's#/bin/sh#/bin/bash#g' $files |
108 | - echo kill -TERM "$pssh" |
- | |
109 | - kill -TERM "$pssh" 2>/dev/null |
- | |
110 | + echo kill -s TERM "$pssh" |
- | |
111 | + kill -s TERM "$pssh" 2>/dev/null |
- | |
112 | sleep 1 |
- | |
113 | - kill -KILL "$pssh" 2>/dev/null |
- | |
114 | + kill -s KILL "$pssh" 2>/dev/null |
- | |
115 | pssh="" |
- | |
116 | fi |
- | |
117 | if [ "X$stunnel_pid" != "X" ]; then |
- | |
118 | echo "Terminating background stunnel process" |
- | |
119 | - echo kill -TERM "$stunnel_pid" |
- | |
120 | - kill -TERM "$stunnel_pid" 2>/dev/null |
- | |
121 | + echo kill -s TERM "$stunnel_pid" |
- | |
122 | + kill -s TERM "$stunnel_pid" 2>/dev/null |
- | |
123 | sleep 1 |
- | |
124 | - kill -KILL "$stunnel_pid" 2>/dev/null |
- | |
125 | + kill -s KILL "$stunnel_pid" 2>/dev/null |
- | |
126 | stunnel_pid="" |
- | |
127 | fi |
13 | fi |
128 | if [ "X$dsm_pid" != "X" ]; then |
- | |
129 | echo "Terminating background ultravnc_dsm_helper process" |
- | |
130 | - echo kill -TERM "$dsm_pid" |
- | |
131 | - kill -TERM "$dsm_pid" 2>/dev/null |
- | |
132 | + echo kill -s TERM "$dsm_pid" |
- | |
133 | + kill -s TERM "$dsm_pid" 2>/dev/null |
- | |
134 | sleep 1 |
- | |
135 | - kill -KILL "$dsm_pid" 2>/dev/null |
- | |
136 | + kill -s KILL "$dsm_pid" 2>/dev/null |
- | |
137 | stunnel_pid="" |
- | |
138 | fi |
- | |
139 | if [ "X$tail_pid" != "X" ]; then |
- | |
140 | - kill -TERM $tail_pid |
- | |
141 | + kill -s TERM $tail_pid |
- | |
142 | fi |
- | |
143 | if [ "X$tail_pid2" != "X" ]; then |
- | |
144 | - kill -TERM $tail_pid2 |
- | |
145 | + kill -s TERM $tail_pid2 |
- | |
146 | fi |
- | |
147 | } |
- | |
148 | - | ||
149 | @@ -737,7 +737,7 @@ |
- | |
150 | - | ||
151 | # trick for the undocumented rsh://host:port method. |
- | |
152 | rsh_viewer() { |
- | |
153 | - trap "final" 0 2 15 |
- | |
154 | + trap "final" 0 INT TERM |
- | |
155 | if [ "X$PORT" = "X" ]; then |
- | |
156 | exit 1 |
- | |
157 | elif [ $PORT -ge 5900 ]; then |
- | |
158 | @@ -756,7 +756,7 @@ |
- | |
159 | } |
14 | } |
160 | 15 | ||
161 | check_perl() { |
16 | dpatch_unpatch() { |
162 | - if type "$1" > /dev/null 2>&1; then |
- | |
163 | + if which "$1" > /dev/null 2>&1; then |
- | |
164 | : |
- | |
165 | elif [ ! -x "$1" ]; then |
- | |
166 | echo "" |
- | |
167 | @@ -2083,7 +2083,7 @@ |
- | |
168 | if [ "X$sshword" != "X" ]; then |
- | |
169 | if [ -x "$sshword" ]; then |
- | |
170 | : |
- | |
171 | - elif type "$sshword" > /dev/null 2>&1; then |
17 | # Change line endings back to CRLF in files that had it in the tarball |
172 | + elif which "$sshword" > /dev/null 2>&1; then |
18 | tar -xzf debian/patched/patched-bashisms.tar.gz |
173 | : |
- | |
174 | else |
- | |
175 | echo "" |
- | |
176 | @@ -2421,7 +2421,7 @@ |
- | |
177 | 19 | } |
|
178 | stty sane |
- | |
179 | i=0 |
- | |
180 | - if type perl > /dev/null 2>&1; then |
- | |
181 | + if which perl > /dev/null 2>&1; then |
- | |
182 | imax=50 |
- | |
183 | sleepit="perl -e 'select(undef, undef, undef, 0.20)'" |
- | |
184 | else |
- | |
185 | @@ -2536,7 +2536,7 @@ |
- | |
186 | if [ "X$use_sshssl" = "X" -a "X$getport" = "X" ]; then |
- | |
187 | echo "Running viewer:" |
- | |
188 | 20 | ||
189 | - trap "final" 0 2 15 |
21 | DPATCH_LIB_NO_DEFAULT=1 |
190 | + trap "final" 0 INT TERM |
- | |
191 | if [ "X$reverse" = "X" ]; then |
- | |
192 | echo "$VNCVIEWERCMD" "$@" $localhost:$N |
- | |
193 | echo "" |
- | |
194 | @@ -2593,7 +2593,7 @@ |
- | |
195 | fi |
- | |
196 | 22 | ||
197 | if [ "X$stunnel_set_here" = "X1" -a "X$showcert" = "X" ]; then |
- | |
198 | - if type $STUNNEL > /dev/null 2>&1; then |
- | |
199 | + if which $STUNNEL > /dev/null 2>&1; then |
- | |
200 | : |
- | |
201 | else |
- | |
202 | echo "" |
- | |
203 | @@ -2705,7 +2705,7 @@ |
- | |
204 | if [ "X$ciphers" != "X" ]; then |
- | |
205 | cipher_args=`echo "$ciphers" | sed -e 's/ciphers=/-cipher /'` |
- | |
206 | fi |
- | |
207 | - if type openssl > /dev/null 2>&1; then |
- | |
208 | + if which openssl > /dev/null 2>&1; then |
- | |
209 | : |
- | |
210 | else |
- | |
211 | echo "" |
- | |
212 | @@ -2825,7 +2825,7 @@ |
- | |
213 | if [ "X$getport" = "X" ]; then |
- | |
214 | sleep 1 |
- | |
215 | fi |
- | |
216 | - elif type printf > /dev/null 2>&1; then |
- | |
217 | + elif which printf > /dev/null 2>&1; then |
- | |
218 | printf "Are you sure you want to continue? [y]/n " |
- | |
219 | read x |
- | |
220 | else |
- | |
221 | @@ -2888,7 +2888,7 @@ |
- | |
222 | fi |
- | |
223 | hostdisp2=`echo "$hostdisp" | sed -e 's/pw=[^ ]*/pw=******/g'` |
- | |
224 | echo "$VNCVIEWERCMD" "$@" "$hostdisp2" |
- | |
225 | - trap "final" 0 2 15 |
- | |
226 | + trap "final" 0 INT TERM |
- | |
227 | echo "" |
- | |
228 | $VNCVIEWERCMD "$@" "$hostdisp" |
23 | . /usr/share/dpatch/dpatch.lib.sh |
229 | if [ $? != 0 ]; then |
- | |
230 | @@ -2902,7 +2902,7 @@ |
- | |
231 | echo "" |
- | |
232 | echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode." |
- | |
233 | echo "" |
- | |
234 | - trap "final" 0 2 15 |
- | |
235 | + trap "final" 0 INT TERM |
- | |
236 | if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then |
- | |
237 | echo "NOTE: The ultravnc_dsm_helper only runs once. So after the first LISTEN" |
- | |
238 | echo " ends, you may have to Press Ctrl-C and restart for another connection." |
- | |
239 | @@ -3102,7 +3102,7 @@ |
- | |
240 | vnc_hp="exec=$STUNNEL $tmp_cfg" |
- | |
241 | fi |
- | |
242 | echo "$VNCVIEWERCMD" "$@" "$vnc_hp" |
- | |
243 | - trap "final" 0 2 15 |
- | |
244 | + trap "final" 0 INT TERM |
- | |
245 | echo "" |
- | |
246 | $VNCVIEWERCMD "$@" "$vnc_hp" |
- | |
247 | if [ $? != 0 ]; then |
- | |
248 | @@ -3117,7 +3117,7 @@ |
- | |
249 | echo "" |
- | |
250 | echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode." |
- | |
251 | echo "" |
- | |
252 | - trap "final" 0 2 15 |
- | |
253 | + trap "final" 0 INT TERM |
- | |
254 | N2=$N |
- | |
255 | N2_trim=`echo "$N2" | sed -e 's/://g'` |
- | |
256 | if [ $N2_trim -le 200 ]; then |
- |