qemush : suppression tmux

This commit is contained in:
Ahurac 2024-01-21 01:51:07 +01:00
parent acc6ecbf2d
commit 85a413ed70
3 changed files with 8 additions and 17 deletions

View file

@ -33,7 +33,6 @@ the same virtual machines
- **Modularization**: `qemush` launching scripts are intended to be - **Modularization**: `qemush` launching scripts are intended to be
stackable to reuse common `qemu` parameters in all virtual machines stackable to reuse common `qemu` parameters in all virtual machines
needing them needing them
- **Process supervision**: `qemush` uses `tmux` to supervise processes and
keep track of them keep track of them
- **Copy-on-write**: images are formatted using `qcow2` to use less space - **Copy-on-write**: images are formatted using `qcow2` to use less space
on disk on disk
@ -48,7 +47,6 @@ need it
- `bash` - the `qemush` interpreter - `bash` - the `qemush` interpreter
- `coreutils` - used for basic OS operations - `coreutils` - used for basic OS operations
- `sudo` - execute commands as `qemu` - `sudo` - execute commands as `qemu`
- `tmux` - for process supervision
- `source-highlight` - for syntax highlighting when displaying launching - `source-highlight` - for syntax highlighting when displaying launching
scripts scripts
- `diskpath` and `sockpath` - see [Installation - `diskpath` and `sockpath` - see [Installation
@ -95,7 +93,6 @@ by the `Makefile` for the installation process.
- Compile C programs from `src` in `~qemu/bin` with mode `740` - Compile C programs from `src` in `~qemu/bin` with mode `740`
- Copy the default launching scripts to `~qemu/launchers` with mode `740` - Copy the default launching scripts to `~qemu/launchers` with mode `740`
- Copy `bin/qemush` to `/usr/local/bin/qemush` with mode `755` - Copy `bin/qemush` to `/usr/local/bin/qemush` with mode `755`
- Copy the `tmux` configuration to the `qemu` user homedir
## Usage ## Usage

View file

@ -18,6 +18,7 @@ exec_as qemu "$@"
# Directories used in the program # Directories used in the program
bin="${HOME}/launchers" bin="${HOME}/launchers"
images="${HOME}/disks" images="${HOME}/disks"
sockets="${HOME}/sockets"
# Environment # Environment
PATH="${bin}:${HOME}/bin:${PATH}" PATH="${bin}:${HOME}/bin:${PATH}"
@ -73,29 +74,27 @@ error_usage() {
return 1 return 1
} }
# Function to start a virtual machine ; fails if the virtual machine is # Function to start a virtual machine
# already started thanks to tmux
public_start() { public_start() {
QEMUSH_NAME="$1" QEMUSH_NAME="$1"
shift shift
exec tmux new-session \ exec "$QEMUSH_NAME" "$@"
-s "$QEMUSH_NAME" \
"$QEMUSH_NAME" \
"$@"
} }
# Attach to a running virtual machine output, the latest opened if no # Attach to a running virtual machine output, the latest opened if no
# argument is provided # argument is provided
public_watch() { public_watch() {
[ -n "$1" ] && set -- -t "$1" QEMUSH_NAME="$1"
shift
exec tmux attach "$@" socat -,echo=0,icanon=0 "UNIX-CONNECT:$(sockpath)"
} }
# List running virtual machines # List running virtual machines
public_active() { public_active() {
exec tmux list-sessions echo "Running machines:"
exec ls "$sockets"
} }
# List available virtual machines entrypoints # List available virtual machines entrypoints

View file

@ -1,5 +0,0 @@
# Keep tmux sessions visible after exit
set -g remain-on-exit on
# Override the nologin directive
set -g default-shell /bin/sh