[PATCH xf86-video-qxl 3/3] XSpice: auto generate temp files for the vdagent process.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jeremy White <jwhite@xxxxxxxxxxxxxxx>
---
 scripts/Xspice | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/scripts/Xspice b/scripts/Xspice
index 33f02d1..644887c 100755
--- a/scripts/Xspice
+++ b/scripts/Xspice
@@ -90,9 +90,9 @@ parser.add_argument('--streaming-video', choices=['off', 'all', 'filter'],
 add_boolean('--ipv4-only')
 add_boolean('--ipv6-only')
 parser.add_argument('--vdagent', action='store_true', dest='vdagent_enabled', default=False, help='launch vdagent & vdagentd. They provide clipboard & resolution automation')
-parser.add_argument('--vdagent-virtio-path', default='/tmp/xspice-virtio', help='virtio socket path used by vdagentd')
-parser.add_argument('--vdagent-uinput-path', default='/tmp/xspice-uinput', help='uinput socket path used by vdagent')
-parser.add_argument('--vdagent-udcs-path', default='/tmp/xspice-vdagent', help='udcs socket path used by vdagent and vdagentd')
+parser.add_argument('--vdagent-virtio-path', help='virtio socket path used by vdagentd')
+parser.add_argument('--vdagent-uinput-path', help='uinput socket path used by vdagent')
+parser.add_argument('--vdagent-udcs-path', help='udcs socket path used by vdagent and vdagentd')
 parser.add_argument('--vdagentd-exec', help='path to spice-vdagentd (used with --vdagent)')
 parser.add_argument('--vdagent-exec', help='path to spice-vdagent (used with --vdagent)')
 parser.add_argument('--vdagent-no-launch', default=True, action='store_false', dest='vdagent_launch', help='do not launch vdagent & vdagentd, used for debugging or if some external script wants to take care of that')
@@ -247,6 +247,23 @@ EndSection
     """ % locals())
     cf.flush()
 
+if args.vdagent_enabled:
+    for f in [args.vdagent_udcs_path, args.vdagent_virtio_path, args.vdagent_uinput_path]:
+        if f and os.path.exists(f):
+            os.unlink(f)
+
+    if not cf:
+        cf = tempfile.NamedTemporaryFile(prefix="Xspice-vdagent-", delete=True)
+    # Auto generate temporary files for vdagent
+    if not args.vdagent_udcs_path:
+        args.vdagent_udcs_path = cf.name + ".udcs"
+    if not args.vdagent_virtio_path:
+        args.vdagent_virtio_path = cf.name + ".virtio"
+    if not args.vdagent_uinput_path:
+        args.vdagent_uinput_path = cf.name + ".uinput"
+
+    cleanup_files.extend([args.vdagent_udcs_path, args.vdagent_virtio_path, args.vdagent_uinput_path])
+
 var_args = ['port', 'tls_port', 'disable_ticketing',
     'x509_dir', 'sasl', 'cacert_file', 'x509_cert_file',
     'x509_key_file', 'x509_key_password',
@@ -321,3 +338,6 @@ else:
     except KeyboardInterrupt:
         # Catch Ctrl-C as that is the common way of ending this script
         print "Keyboard Interrupt"
+
+if cf:
+    cf.close()
-- 
2.1.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]