add spice example script spice-example-sh

This commit is contained in:
Dietmar Maurer 2014-03-03 07:22:56 +01:00
parent 6c593f00ba
commit 072188dcbf
3 changed files with 24 additions and 0 deletions

View File

@ -97,6 +97,7 @@ install: country.dat vznet.conf vzdump.conf vzdump-hook-script.pl pve-apt.conf p
install -D -m 0755 vznet.conf ${DESTDIR}/etc/vz/vznet.conf
install -D -m 0755 mtu ${DESTDIR}/etc/network/if-up.d/mtu
install -m 0644 vzdump-hook-script.pl ${DOCDIR}/examples/vzdump-hook-script.pl
install -m 0644 spice-example-sh ${DOCDIR}/examples/spice-example-sh
install -m 0644 copyright ${DOCDIR}
install -m 0644 debian/changelog.Debian ${DOCDIR}
install -m 0644 country.dat ${DESTDIR}/usr/share/${PACKAGE}

View File

@ -1,6 +1,8 @@
pve-manager (3.1-45) unstable; urgency=low
* parseQemuNetwork: add vmxnet3
* add /usr/share/doc/pve-manager/examples/spice-example-sh
-- Proxmox Support Team <support@proxmox.com> Mon, 03 Mar 2014 07:06:02 +0100

21
spice-example-sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# needs pve-manager >= 3.1-44
USERNAME=root@pam
PASSWORD=yoursecretpassword
# select VM
VMID=100
NODE=anodename
PROXY=anodename.domain.tld
DATA=`curl -k -d "username=$USERNAME&password=$PASSWORD" https://$PROXY:8006/api2/json/access/ticket`
TICKET=`echo $DATA|sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"// g'|grep -w ticket| awk -F "|" '{print $2}'`
CSRF=`echo $DATA|sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"// g'|grep -w CSRFPreventionToken| awk -F "|" '{print $2}'`
curl -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" https://$PROXY:8006/api2/spiceconfig/nodes/$NODE/qemu/$VMID/spiceproxy -d "proxy=$PROXY" > spiceproxy
remote-viewer spiceproxy