qemush : n'exporter QEMUSH_NAME que quand on en a besoin

This commit is contained in:
Ahurac 2024-03-24 22:52:37 +01:00
parent d1d579fcd2
commit b9b96f6467

View file

@ -51,7 +51,7 @@ error_usage() {
# Function to start a virtual machine
public_start() {
QEMUSH_NAME="$1"
export QEMUSH_NAME="$1"
set -- "$@" \
-name "$QEMUSH_NAME" \
@ -66,7 +66,7 @@ public_start() {
# Attach to a running virtual machine output, the latest opened if no
# argument is provided
public_attach() {
QEMUSH_NAME="$1"
export QEMUSH_NAME="$1"
shift
exec socat -,rawer,escape=15 "UNIX-CONNECT:$(pathof socket)"
@ -90,7 +90,7 @@ public_ls() {
# Create a copy-on-write disk for a virtual machine
public_diskadd() {
QEMUSH_NAME="$1"
export QEMUSH_NAME="$1"
shift
exec qemu-img create -f qcow2 "$(pathof disk)" "$1"
}
@ -98,7 +98,7 @@ public_diskadd() {
# Delete a disk
public_diskrm() {
for disk in "$@"; do
QEMUSH_NAME="$disk"
export QEMUSH_NAME="$disk"
rm -vi -- "$(pathof disk)"
done
}
@ -170,7 +170,7 @@ public_do() {
# Expose SPICE via TCP
public_spice() {
QEMUSH_NAME="$1"
export QEMUSH_NAME="$1"
if [ -n "$2" ]; then
port=$2
else