launchers/spice : passage à perl

This commit is contained in:
Ahurac 2024-03-11 22:25:03 +01:00
parent b20e52014d
commit 3514fa96ef

View file

@ -1,12 +1,29 @@
#!/bin/sh -x #!/usr/bin/env perl
base=$(echo "$QEMUSH_BASE" | cut -d , -f 1) use warnings;
QEMUSH_BASE=$(echo "$QEMUSH_BASE" | sed "s/^${base}//" | sed 's/^,//') use strict;
exec "$base" \ my @launchers_chain = ("kvm");
-vga qxl \
-chardev spicevmc,id=vdagent,debug=0,name=vdagent \ if (defined $ENV{'QEMUSH_BASE'}) {
-device virtio-serial \ @launchers_chain = split ",", $ENV{'QEMUSH_BASE'};
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \ }
-spice port="$(first-free-port 5900)",addr=::1,disable-ticketing=on \
-audiodev spice,id=snd0 \ my $base = shift @launchers_chain;
"$@" $ENV{'QEMUSH_BASE'} = join ",", @launchers_chain;
chomp(my $socket_path = `pathof spice`);
my @command = (
$base,
"-vga", "qxl",
"-chardev", "spicevmc,id=vdagent,debug=0,name=vdagent",
"-device", "virtio-serial",
"-device", "virtserialport,chardev=vdagent,name=com.redhat.spice.0",
"-spice", "unix=on,addr=${socket_path},disable-ticketing=on",
"-audiodev", "spice,id=snd0",
@ARGV
);
print "+ exec ", join(" ", @command), "\n";
exit;
exec @command;