Compare commits
No commits in common. "0a2de050ddccd7ca109ba3c97df74aa0e40ac33f" and "d515a0bb232c9b04ad20a8d8b1b4ef5de60857f4" have entirely different histories.
0a2de050dd
...
d515a0bb23
1 changed files with 7 additions and 8 deletions
15
bin/qemush
15
bin/qemush
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# version=0.3.0
|
||||
# version=0.2.0
|
||||
|
||||
# Function to re-exec the script as another user via sudo (only if needed)
|
||||
exec_as() {
|
||||
|
@ -38,9 +38,9 @@ public_help() {
|
|||
|
||||
exec cat << EOF
|
||||
${name}: usage:
|
||||
${name} running - (default behaviour) list running VMs
|
||||
${name} active - (default behaviour) list active VMs
|
||||
${name} start <VM name> - start a VM
|
||||
${name} attach <VM name> - attach to the VM monitor socket
|
||||
${name} watch <VM name> - attach VM screen session
|
||||
${name} ls - list available VMs
|
||||
${name} edit <VM name> - edit VM launching script
|
||||
${name} rm <VM name> - delete launch script
|
||||
|
@ -76,7 +76,7 @@ public_start() {
|
|||
|
||||
# Attach to a running virtual machine output, the latest opened if no
|
||||
# argument is provided
|
||||
public_attach() {
|
||||
public_watch() {
|
||||
QEMUSH_NAME="$1"
|
||||
shift
|
||||
|
||||
|
@ -84,7 +84,7 @@ public_attach() {
|
|||
}
|
||||
|
||||
# List running virtual machines
|
||||
public_running() {
|
||||
public_active() {
|
||||
cd || return
|
||||
echo "Running machines:"
|
||||
set -- $ls -t sockets "$@"
|
||||
|
@ -140,8 +140,7 @@ public_rm() {
|
|||
# Invoke bash as qemu user in its home directory
|
||||
public_shell() {
|
||||
cd || return
|
||||
set -- bash -i "$@"
|
||||
exec "$@"
|
||||
exec bash -i
|
||||
}
|
||||
|
||||
# Output the content of an entrypoint, with coloration if on a virtual
|
||||
|
@ -183,7 +182,7 @@ shift
|
|||
# Defauts to `active` if no function is supplied; else checks for a public
|
||||
# function named after the argument; else fails
|
||||
if [ -z "$function" ]; then
|
||||
public_running
|
||||
public_active
|
||||
elif declare -F | cut -d \ -f 3- | grep '^public_' | sed 's/^public_//' | grep -q "^${function}$"; then
|
||||
"public_${function}" "$@"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue