Subversion Repositories ssvnc

Compare Revisions

Ignore whitespace Rev 14 → Rev 16

/ssvnc/trunk/debian/patches/bashisms.dpatch
1,256 → 1,23
#! /bin/sh /usr/share/dpatch/dpatch-run
#!/bin/sh -e
## bashisms.dpatch by Magnus Holmgren <holmgren@debian.org>
##
## DP: Replace non-POSIX `type' command with `which', kill -SIGNAL
## DP: with kill -s SIGNAL and trap "final" 0 2 15 with trap "final"
## DP: 0 INT TERM.
## DP: Change all shell references to /bin/bash to avoid problems
## DP: when /bin/sh is not Bash.
 
@DPATCH@
diff -urNad trunk~/scripts/ssvnc trunk/scripts/ssvnc
--- trunk~/scripts/ssvnc 2010-02-01 00:19:05.000000000 +0100
+++ trunk/scripts/ssvnc 2010-02-01 00:19:06.000000000 +0100
@@ -169,7 +169,7 @@
WISH=wish
for try in wish8.4 wish wish8.3 wish8.5 wish8.6
do
- if type $try > /dev/null 2>&1; then
+ if which $try > /dev/null 2>&1; then
WISH=$try
break
fi
@@ -230,13 +230,13 @@
PATH=$PATH:/usr/sbin:/usr/local/sbin:/dist/sbin
quit=0
- if type vncviewer >/dev/null 2>/dev/null; then
+ if which vncviewer >/dev/null 2>/dev/null; then
:
else
echo "vncviewer not found in PATH."
quit=1
fi
- if type stunnel >/dev/null 2>/dev/null; then
+ if which stunnel >/dev/null 2>/dev/null; then
:
else
echo "stunnel not found in PATH."
diff -urNad trunk~/scripts/ssvnc_cmd trunk/scripts/ssvnc_cmd
--- trunk~/scripts/ssvnc_cmd 2009-11-26 21:02:11.000000000 +0100
+++ trunk/scripts/ssvnc_cmd 2010-02-01 00:19:06.000000000 +0100
@@ -184,13 +184,13 @@
PATH=$PATH:/usr/sbin:/usr/local/sbin:/dist/sbin
quit=0
- if type vncviewer >/dev/null 2>/dev/null; then
+ if which vncviewer >/dev/null 2>/dev/null; then
:
else
echo "vncviewer not found in PATH."
quit=1
fi
- if type stunnel >/dev/null 2>/dev/null; then
+ if which stunnel >/dev/null 2>/dev/null; then
:
else
echo "stunnel not found in PATH."
@@ -266,7 +266,7 @@
if echo "$VNCVIEWERCMD" | grep '\.turbovnc' > /dev/null; then
:
else
- if type "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then
+ if which "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then
VNCVIEWERCMD="$VNCVIEWERCMD.turbovnc"
fi
fi
diff -urNad trunk~/scripts/util/ss_vncviewer trunk/scripts/util/ss_vncviewer
--- trunk~/scripts/util/ss_vncviewer 2009-11-18 05:34:33.000000000 +0100
+++ trunk/scripts/util/ss_vncviewer 2010-02-01 00:19:06.000000000 +0100
@@ -135,7 +135,7 @@
if echo "$VNCVIEWERCMD" | grep '\.turbovnc' > /dev/null; then
:
else
- if type "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then
+ if which "$VNCVIEWERCMD.turbovnc" > /dev/null 2>/dev/null; then
VNCVIEWERCMD="$VNCVIEWERCMD.turbovnc"
fi
fi
@@ -162,7 +162,7 @@
check_stunnel=1
if [ "X$SSVNC_BASEDIRNAME" != "X" ]; then
if [ -x "$SSVNC_BASEDIRNAME/stunnel" ]; then
- type stunnel > /dev/null 2>&1
+ which stunnel > /dev/null 2>&1
if [ $? = 0 ]; then
# found ours
STUNNEL=stunnel
@@ -171,7 +171,7 @@
fi
fi
if [ "X$check_stunnel" = "X1" ]; then
- type stunnel4 > /dev/null 2>&1
+ which stunnel4 > /dev/null 2>&1
if [ $? = 0 ]; then
STUNNEL=stunnel4
else
@@ -411,7 +411,7 @@
# a portable, but not absolutely safe, tmp file creator
mytmp() {
tf=$1
- if type mktemp > /dev/null 2>&1; then
+ if which mktemp > /dev/null 2>&1; then
# if we have mktemp(1), use it:
tf2="$tf.XXXXXX"
tf2=`mktemp "$tf2"`
@@ -656,33 +656,33 @@
fi
if [ "X$pssh" != "X" ]; then
echo "Terminating background ssh process"
- echo kill -TERM "$pssh"
- kill -TERM "$pssh" 2>/dev/null
+ echo kill -s TERM "$pssh"
+ kill -s TERM "$pssh" 2>/dev/null
sleep 1
- kill -KILL "$pssh" 2>/dev/null
+ kill -s KILL "$pssh" 2>/dev/null
pssh=""
fi
if [ "X$stunnel_pid" != "X" ]; then
echo "Terminating background stunnel process"
- echo kill -TERM "$stunnel_pid"
- kill -TERM "$stunnel_pid" 2>/dev/null
+ echo kill -s TERM "$stunnel_pid"
+ kill -s TERM "$stunnel_pid" 2>/dev/null
sleep 1
- kill -KILL "$stunnel_pid" 2>/dev/null
+ kill -s KILL "$stunnel_pid" 2>/dev/null
stunnel_pid=""
fi
if [ "X$dsm_pid" != "X" ]; then
echo "Terminating background ultravnc_dsm_helper process"
- echo kill -TERM "$dsm_pid"
- kill -TERM "$dsm_pid" 2>/dev/null
+ echo kill -s TERM "$dsm_pid"
+ kill -s TERM "$dsm_pid" 2>/dev/null
sleep 1
- kill -KILL "$dsm_pid" 2>/dev/null
+ kill -s KILL "$dsm_pid" 2>/dev/null
stunnel_pid=""
fi
if [ "X$tail_pid" != "X" ]; then
- kill -TERM $tail_pid
+ kill -s TERM $tail_pid
fi
if [ "X$tail_pid2" != "X" ]; then
- kill -TERM $tail_pid2
+ kill -s TERM $tail_pid2
fi
}
@@ -737,7 +737,7 @@
# trick for the undocumented rsh://host:port method.
rsh_viewer() {
- trap "final" 0 2 15
+ trap "final" 0 INT TERM
if [ "X$PORT" = "X" ]; then
exit 1
elif [ $PORT -ge 5900 ]; then
@@ -756,7 +756,7 @@
}
check_perl() {
- if type "$1" > /dev/null 2>&1; then
+ if which "$1" > /dev/null 2>&1; then
:
elif [ ! -x "$1" ]; then
echo ""
@@ -2083,7 +2083,7 @@
if [ "X$sshword" != "X" ]; then
if [ -x "$sshword" ]; then
:
- elif type "$sshword" > /dev/null 2>&1; then
+ elif which "$sshword" > /dev/null 2>&1; then
:
else
echo ""
@@ -2421,7 +2421,7 @@
stty sane
i=0
- if type perl > /dev/null 2>&1; then
+ if which perl > /dev/null 2>&1; then
imax=50
sleepit="perl -e 'select(undef, undef, undef, 0.20)'"
else
@@ -2536,7 +2536,7 @@
if [ "X$use_sshssl" = "X" -a "X$getport" = "X" ]; then
echo "Running viewer:"
- trap "final" 0 2 15
+ trap "final" 0 INT TERM
if [ "X$reverse" = "X" ]; then
echo "$VNCVIEWERCMD" "$@" $localhost:$N
echo ""
@@ -2593,7 +2593,7 @@
fi
if [ "X$stunnel_set_here" = "X1" -a "X$showcert" = "X" ]; then
- if type $STUNNEL > /dev/null 2>&1; then
+ if which $STUNNEL > /dev/null 2>&1; then
:
else
echo ""
@@ -2705,7 +2705,7 @@
if [ "X$ciphers" != "X" ]; then
cipher_args=`echo "$ciphers" | sed -e 's/ciphers=/-cipher /'`
fi
- if type openssl > /dev/null 2>&1; then
+ if which openssl > /dev/null 2>&1; then
:
else
echo ""
@@ -2825,7 +2825,7 @@
if [ "X$getport" = "X" ]; then
sleep 1
fi
- elif type printf > /dev/null 2>&1; then
+ elif which printf > /dev/null 2>&1; then
printf "Are you sure you want to continue? [y]/n "
read x
else
@@ -2888,7 +2888,7 @@
fi
hostdisp2=`echo "$hostdisp" | sed -e 's/pw=[^ ]*/pw=******/g'`
echo "$VNCVIEWERCMD" "$@" "$hostdisp2"
- trap "final" 0 2 15
+ trap "final" 0 INT TERM
echo ""
$VNCVIEWERCMD "$@" "$hostdisp"
if [ $? != 0 ]; then
@@ -2902,7 +2902,7 @@
echo ""
echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
echo ""
- trap "final" 0 2 15
+ trap "final" 0 INT TERM
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
echo "NOTE: The ultravnc_dsm_helper only runs once. So after the first LISTEN"
echo " ends, you may have to Press Ctrl-C and restart for another connection."
@@ -3102,7 +3102,7 @@
vnc_hp="exec=$STUNNEL $tmp_cfg"
fi
echo "$VNCVIEWERCMD" "$@" "$vnc_hp"
- trap "final" 0 2 15
+ trap "final" 0 INT TERM
echo ""
$VNCVIEWERCMD "$@" "$vnc_hp"
if [ $? != 0 ]; then
@@ -3117,7 +3117,7 @@
echo ""
echo "NOTE: Press Ctrl-C to terminate viewer LISTEN mode."
echo ""
- trap "final" 0 2 15
+ trap "final" 0 INT TERM
N2=$N
N2_trim=`echo "$N2" | sed -e 's/://g'`
if [ $N2_trim -le 200 ]; then
dpatch_patch() {
files=`grep -Rl '/bin/sh' scripts`
 
if [ ! -f debian/patched/patched-bashisms.tar.gz ]; then
tar -czf debian/patched/patched-bashisms.tar.gz $files
sed -ri -e 's#/bin/sh#/bin/bash#g' $files
fi
}
 
dpatch_unpatch() {
# Change line endings back to CRLF in files that had it in the tarball
tar -xzf debian/patched/patched-bashisms.tar.gz
}
 
DPATCH_LIB_NO_DEFAULT=1
 
. /usr/share/dpatch/dpatch.lib.sh