You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.1 KiB

#!/usr/bin/env bash
set -eu
#set -x
BG=0
synopsis() {
cat << EOF
Usage : `basename $0` [-h] [-b] system
EOF
}
help() {
cat << EOF
`basename $0` démarre un client SPICE présentant l'écran du système.
`synopsis`
Remarque : seuls les systèmes KVM avec leur variable KVM_VIEWER fixée à "spice"
proposent un écran SPICE.
-h : affiche cette aide
-b : start in background
EOF
}
usage() {
synopsis
exit 1
}
args() {
local opt
while getopts "hb" opt; do
case $opt in
h) help; exit 0;;
b) BG=1;;
?) usage;;
esac
done
shift $(($OPTIND - 1))
[ $# -ne 1 ] && usage || :
GUEST_NAME=$1; shift;
}
# Programme principal
export VDN_PATH=$(readlink -f $(dirname $0)/..); . $VDN_PATH/bin/functions.sh
args "$@"
[ $VDN_DEBUG = 1 ] && set -x || :
[ $GUEST_NAME != "nested" ] && setGuestVars $GUEST_NAME
GUEST_OWNER=$USER
[ $GUEST_NAME != "nested" ] && loadGuestVars $GUEST_NAME
if [ $BG = 1 ]; then
remote-viewer -t $GUEST_NAME spice+unix://$TMPDIR/vdn-spice-$USER-$GUEST_NAME-socket &
else
remote-viewer -t $GUEST_NAME spice+unix://$TMPDIR/vdn-spice-$USER-$GUEST_NAME-socket
fi
sleep 1