From acc6ecbf2da4fe97d07d338aaa5c312d467229e0 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Sun, 21 Jan 2024 01:40:45 +0100 Subject: [PATCH] pathof : remplacement par diskpath et sockpath --- README.md | 3 ++- bin/qemush | 4 ++-- qemu/bin/diskpath | 3 +++ qemu/bin/pathof | 22 ---------------------- qemu/bin/sockpath | 3 +++ qemu/launchers/windows10 | 4 ++-- 6 files changed, 12 insertions(+), 27 deletions(-) create mode 100755 qemu/bin/diskpath delete mode 100755 qemu/bin/pathof create mode 100755 qemu/bin/sockpath diff --git a/README.md b/README.md index 5277f01..b40b0ce 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ need it - `tmux` - for process supervision - `source-highlight` - for syntax highlighting when displaying launching scripts -- `pathof` - see [Installation instructions](#installation-instructions) +- `diskpath` and `sockpath` - see [Installation +instructions](#installation-instructions) - any text editor - used for builtin function to edit launching scripts ## Installation instructions diff --git a/bin/qemush b/bin/qemush index 616ada3..046d221 100755 --- a/bin/qemush +++ b/bin/qemush @@ -109,7 +109,7 @@ public_diskadd() { QEMUSH_NAME="$1" shift - exec qemu-img create -f qcow2 "$(pathof disk)" "$1" + exec qemu-img create -f qcow2 "$(diskpath)" "$1" } # Delete a disk @@ -117,7 +117,7 @@ public_diskrm() { QEMUSH_NAME="$1" shift - exec rm -vi -- "$(pathof disk)" + exec rm -vi -- "$(diskpath)" } # List available disks diff --git a/qemu/bin/diskpath b/qemu/bin/diskpath new file mode 100755 index 0000000..2fec25b --- /dev/null +++ b/qemu/bin/diskpath @@ -0,0 +1,3 @@ +#!/bin/sh -e +[ -n "$QEMUSH_NAME" ] +printf %s/%s.qcow2\\n ~/disks "$QEMUSH_NAME" diff --git a/qemu/bin/pathof b/qemu/bin/pathof deleted file mode 100755 index 286b9db..0000000 --- a/qemu/bin/pathof +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -e - -# Check if QEMUSH_NAME variable is initialized, abort if not -[ -n "$QEMUSH_NAME" ] - -# Choose the base dir to print according to argv[1] -case "$1" in - socket) - path="${HOME}/sockets" - ;; - disk) - path="${HOME}/disks" - ;; - *) - false - ;; -esac - -# Create the base dir if it doesn't exist and print the path of the -# ressource -mkdir -p -- "$path" -printf %s/%s\\n "$path" "$QEMUSH_NAME" diff --git a/qemu/bin/sockpath b/qemu/bin/sockpath new file mode 100755 index 0000000..4569b33 --- /dev/null +++ b/qemu/bin/sockpath @@ -0,0 +1,3 @@ +#!/bin/sh -e +[ -n "$QEMUSH_NAME" ] +printf %s/%s ~/sockets "$QEMUSH_NAME" diff --git a/qemu/launchers/windows10 b/qemu/launchers/windows10 index 7a021e6..ed02a52 100755 --- a/qemu/launchers/windows10 +++ b/qemu/launchers/windows10 @@ -6,8 +6,8 @@ export QEMUSH_NAME # Launch the virtual machine exec kvm-spice \ - -monitor "unix:$(pathof socket)" \ - -drive file="$(pathof disk)",if=virtio \ + -monitor "unix:$(sockpath),server,nowait" \ + -drive file="$(diskpath)",if=virtio \ -net user,hostname="${QEMUSH_NAME}" \ -usbdevice tablet \ -name "$QEMUSH_NAME" \