pathof : remplacement par diskpath et sockpath
This commit is contained in:
parent
50603a52f6
commit
acc6ecbf2d
6 changed files with 12 additions and 27 deletions
|
@ -51,7 +51,8 @@ need it
|
||||||
- `tmux` - for process supervision
|
- `tmux` - for process supervision
|
||||||
- `source-highlight` - for syntax highlighting when displaying launching
|
- `source-highlight` - for syntax highlighting when displaying launching
|
||||||
scripts
|
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
|
- any text editor - used for builtin function to edit launching scripts
|
||||||
|
|
||||||
## Installation instructions
|
## Installation instructions
|
||||||
|
|
|
@ -109,7 +109,7 @@ public_diskadd() {
|
||||||
QEMUSH_NAME="$1"
|
QEMUSH_NAME="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
exec qemu-img create -f qcow2 "$(pathof disk)" "$1"
|
exec qemu-img create -f qcow2 "$(diskpath)" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete a disk
|
# Delete a disk
|
||||||
|
@ -117,7 +117,7 @@ public_diskrm() {
|
||||||
QEMUSH_NAME="$1"
|
QEMUSH_NAME="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
exec rm -vi -- "$(pathof disk)"
|
exec rm -vi -- "$(diskpath)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# List available disks
|
# List available disks
|
||||||
|
|
3
qemu/bin/diskpath
Executable file
3
qemu/bin/diskpath
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
[ -n "$QEMUSH_NAME" ]
|
||||||
|
printf %s/%s.qcow2\\n ~/disks "$QEMUSH_NAME"
|
|
@ -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"
|
|
3
qemu/bin/sockpath
Executable file
3
qemu/bin/sockpath
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
[ -n "$QEMUSH_NAME" ]
|
||||||
|
printf %s/%s ~/sockets "$QEMUSH_NAME"
|
|
@ -6,8 +6,8 @@ export QEMUSH_NAME
|
||||||
|
|
||||||
# Launch the virtual machine
|
# Launch the virtual machine
|
||||||
exec kvm-spice \
|
exec kvm-spice \
|
||||||
-monitor "unix:$(pathof socket)" \
|
-monitor "unix:$(sockpath),server,nowait" \
|
||||||
-drive file="$(pathof disk)",if=virtio \
|
-drive file="$(diskpath)",if=virtio \
|
||||||
-net user,hostname="${QEMUSH_NAME}" \
|
-net user,hostname="${QEMUSH_NAME}" \
|
||||||
-usbdevice tablet \
|
-usbdevice tablet \
|
||||||
-name "$QEMUSH_NAME" \
|
-name "$QEMUSH_NAME" \
|
||||||
|
|
Loading…
Reference in a new issue