2011-05-02 19:55:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
if [ ! -z "$rvid_virturi" -a ! -z "$rvid_virtname" ]; then
|
|
|
|
if [ -x /usr/bin/virt-viewer ]; then
|
|
|
|
exec /usr/bin/virt-viewer -c $rvid_virturi $rvid_virtname
|
|
|
|
# else
|
|
|
|
# echo "Installation of virt-viewer is recommended, falling back to vncviewer"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
myport=${rvid_vidport#*:}
|
|
|
|
if [ $rvid_vidproto = "vnc" ];then
|
2012-11-29 03:06:13 +00:00
|
|
|
if [ ! -x "/usr/bin/vncviewer" ]; then
|
|
|
|
echo "Error: vncviewer could not be found and needed for this VM." >&2;
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-05-02 19:55:26 +00:00
|
|
|
let myport=myport-5900;
|
|
|
|
export VNC_VIA_CMD='/usr/bin/ssh -o BatchMode=yes -f -L "$L":"$H":"$R" "$G" sleep 20'
|
|
|
|
(
|
|
|
|
flock 200
|
2013-02-27 08:10:17 +00:00
|
|
|
#tightvnc is used for suse, but tigervnc is used for rh
|
|
|
|
istigervnc=`vncviewer -help 2>&1 | grep -i tigervnc`
|
|
|
|
if [ "x$istigervnc" == "x" ]; then
|
|
|
|
vncpasswd.arg /tmp/rvidpass.$$ $rvid_password > /dev/null
|
|
|
|
vncviewer $rvid_server:$myport -passwd /tmp/rvidpass.$$ >& /dev/null &
|
|
|
|
else
|
|
|
|
echo -e "$rvid_password\n$rvid_password"|vncpasswd /tmp/rvidpass.$$ > /dev/null
|
|
|
|
#echo $rvid_password|vncviewer :$myport -via $rvid_server AutoSelect=0 FullColor=1 passwdInput=1 >& /dev/null &
|
|
|
|
vncviewer $rvid_server:$myport AutoSelect=0 FullColor=1 passwd=/tmp/rvidpass.$$ >& /dev/null &
|
|
|
|
fi
|
2013-02-07 20:55:08 +00:00
|
|
|
sleep 2.0
|
2011-05-02 19:55:26 +00:00
|
|
|
flock -u 200
|
2012-02-11 13:49:33 +00:00
|
|
|
rm /tmp/rvidpass.$$
|
2011-05-02 19:55:26 +00:00
|
|
|
) 200> /tmp/xcat/virtvnclock
|
|
|
|
elif [ $rvid_vidproto = "spice" ]; then
|
|
|
|
SPICEC="/usr/bin/spicec"
|
|
|
|
if [ ! -x $SPICEC -a -x /usr/libexec/spicec ]; then
|
|
|
|
SPICEC=/usr/libexec/spicec
|
|
|
|
elif [ ! -x $SPICEC ]; then
|
|
|
|
echo "Error: spice client could not be found and needed for this VM" >&2;
|
|
|
|
fi
|
|
|
|
$SPICEC -h $rvid_server -p $myport -w $rvid_password
|
|
|
|
fi
|
|
|
|
|
|
|
|
|