From 00b9c552cae0342c901548d95c704774f8b4b907 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Fri, 8 Dec 2023 10:59:49 +0100 Subject: [PATCH] qemush : ajout commande run, documentation, dossier bin -> launchers --- README.md | 14 ++++++++++---- bin/qemush | 9 +++++++-- qemu/{bin => launchers}/linux | 0 qemu/{bin => launchers}/linux-spice | 0 qemu/{bin => launchers}/redox | 0 qemu/{bin => launchers}/redox-spice | 0 qemu/{bin => launchers}/windows | 0 qemu/{bin => launchers}/windows-spice | 0 8 files changed, 17 insertions(+), 6 deletions(-) rename qemu/{bin => launchers}/linux (100%) rename qemu/{bin => launchers}/linux-spice (100%) rename qemu/{bin => launchers}/redox (100%) rename qemu/{bin => launchers}/redox-spice (100%) rename qemu/{bin => launchers}/windows (100%) rename qemu/{bin => launchers}/windows-spice (100%) diff --git a/README.md b/README.md index 9da356c..99904cc 100644 --- a/README.md +++ b/README.md @@ -81,10 +81,16 @@ system wide. `first-free-port` is a small C program designed accordingly to the Unix philosophy to show in `stdout` the first free (not listening) TCP port -after `argv[1]`, or `argv[1]` if it is free. You can compile it and add -it to your `PATH` if you need to allocate ports to protocols like SPICE in -your launching scripts (example in `qemu/bin/*-spice`). Its source is in -`src` folder of this repository. +after `argv[1]`, or `argv[1]` if it is free. You will need it to allocate +ports to protocols like SPICE in your launching scripts (example in +`qemu/bin/*-spice`). + +Example `qemush` command to add the program to a local `qemu` `bin` folder +: + +```sh +qemush do 'mkdir ~/bin && cc -o "${_}/first-free-port" src/first-free-port.c' +``` ## Usage diff --git a/bin/qemush b/bin/qemush index c058e88..739c05d 100755 --- a/bin/qemush +++ b/bin/qemush @@ -12,9 +12,9 @@ exec_as() { exec_as qemu "$@" -bin="${HOME}/bin" +bin="${HOME}/launchers" images="${HOME}/images" -PATH="${bin}:${PATH}" +PATH="${bin}:${HOME}/bin:${PATH}" EDITOR="${EDITOR:-nvim}" alias ls='ls --color=auto' alias exec='exec ' @@ -47,6 +47,7 @@ ${name}: usage: ${name} shell - start a shell as user qemu ${name} help - show this help ${name} add [] - add a launching script + ${name} run - run shell input as user qemu EOF } @@ -122,6 +123,10 @@ public_add() { trap - EXIT } +public_run() { + sh -c "$*" +} + function="$1" shift diff --git a/qemu/bin/linux b/qemu/launchers/linux similarity index 100% rename from qemu/bin/linux rename to qemu/launchers/linux diff --git a/qemu/bin/linux-spice b/qemu/launchers/linux-spice similarity index 100% rename from qemu/bin/linux-spice rename to qemu/launchers/linux-spice diff --git a/qemu/bin/redox b/qemu/launchers/redox similarity index 100% rename from qemu/bin/redox rename to qemu/launchers/redox diff --git a/qemu/bin/redox-spice b/qemu/launchers/redox-spice similarity index 100% rename from qemu/bin/redox-spice rename to qemu/launchers/redox-spice diff --git a/qemu/bin/windows b/qemu/launchers/windows similarity index 100% rename from qemu/bin/windows rename to qemu/launchers/windows diff --git a/qemu/bin/windows-spice b/qemu/launchers/windows-spice similarity index 100% rename from qemu/bin/windows-spice rename to qemu/launchers/windows-spice