]> git.proxmox.com Git - pve-manager.git/commitdiff
add spice example script spice-example-sh
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 3 Mar 2014 06:22:56 +0000 (07:22 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 3 Mar 2014 06:22:56 +0000 (07:22 +0100)
Makefile
debian/changelog.Debian
spice-example-sh [new file with mode: 0755]

index 9c8bf647da0951fe72f0263d57080cc6e7877bbf..75f523df48392c295b26f07170bbedd1c22ac676 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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}
index 3a19ed1348a38df7eccbbece5d508e351bf6d4b4..338a2ecb1a0236c17b05b198c44bcbfb6c896ae0 100644 (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
 
diff --git a/spice-example-sh b/spice-example-sh
new file mode 100755 (executable)
index 0000000..45bfb13
--- /dev/null
@@ -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