qemush : ajout fonction depcheck et documentation, ajout module diskpath
This commit is contained in:
parent
49cc450c34
commit
a9bc223f98
3 changed files with 31 additions and 0 deletions
14
README.md
14
README.md
|
@ -51,8 +51,12 @@ need it
|
||||||
- `screen` - for process supervision
|
- `screen` - for process supervision
|
||||||
- `source-highlight` - for syntax highlighting when displaying launching
|
- `source-highlight` - for syntax highlighting when displaying launching
|
||||||
scripts
|
scripts
|
||||||
|
- `diskpath` - see [Installation instructions](#installation-instructions)
|
||||||
|
[Add `qemush` modules in `~qemu/bin`](#add-qemush-modules-in-qemubin)
|
||||||
- any text editor - used for builtin function to edit launching scripts
|
- any text editor - used for builtin function to edit launching scripts
|
||||||
|
|
||||||
|
You can run `qemush depcheck` to check if all dependencies are met.
|
||||||
|
|
||||||
## Installation instructions
|
## Installation instructions
|
||||||
|
|
||||||
### QEMU user and group
|
### QEMU user and group
|
||||||
|
@ -77,6 +81,16 @@ Use your preferred way to add the `qemush` script to a folder of `PATH`.
|
||||||
Recommended: copy the script in `/usr/local/bin` to make it effortlessly
|
Recommended: copy the script in `/usr/local/bin` to make it effortlessly
|
||||||
system wide.
|
system wide.
|
||||||
|
|
||||||
|
### Add `qemush` modules in `~qemu/bin`
|
||||||
|
|
||||||
|
`qemush` needs reusable script modules like `diskpath` in its custom `bin`
|
||||||
|
folder located at `~qemu/bin`. You can add them directly via `qemush` from
|
||||||
|
this repo via the following command :
|
||||||
|
|
||||||
|
```sh
|
||||||
|
qemush run 'mkdir -p ~/bin && cp -v qemu/bin/*'
|
||||||
|
```
|
||||||
|
|
||||||
### Extra: add `first-free-port` in `PATH`
|
### Extra: add `first-free-port` in `PATH`
|
||||||
|
|
||||||
`first-free-port` is a small C program designed accordingly to the Unix
|
`first-free-port` is a small C program designed accordingly to the Unix
|
||||||
|
|
15
bin/qemush
15
bin/qemush
|
@ -48,6 +48,7 @@ ${name}: usage:
|
||||||
${name} help - show this help
|
${name} help - show this help
|
||||||
${name} add <path to script> [<VM name>] - add a launching script
|
${name} add <path to script> [<VM name>] - add a launching script
|
||||||
${name} run <command> - run shell input as user qemu
|
${name} run <command> - run shell input as user qemu
|
||||||
|
${name} depcheck - check if script dependencies are met
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +128,20 @@ public_run() {
|
||||||
exec sh -c "$*"
|
exec sh -c "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bold_print() {
|
||||||
|
printf '\033['"${1}m${2}"'\033[0m: %s\n' "$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
public_depcheck() {
|
||||||
|
for i in diskpath screen ls diskpath source-highlight; do
|
||||||
|
if command -v "$i" > /dev/null; then
|
||||||
|
bold_print '1;32' OK "$i"
|
||||||
|
else
|
||||||
|
bold_print '1;31' KO "$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function="$1"
|
function="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
|
2
qemu/bin/diskpath
Executable file
2
qemu/bin/diskpath
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
printf '%s/%s.qcow2\n' ~/images "$1"
|
Loading…
Reference in a new issue