summaryrefslogtreecommitdiff
path: root/bin/vm
diff options
context:
space:
mode:
Diffstat (limited to 'bin/vm')
-rwxr-xr-xbin/vm39
1 files changed, 20 insertions, 19 deletions
diff --git a/bin/vm b/bin/vm
index 82bd7cf..455363a 100755
--- a/bin/vm
+++ b/bin/vm
@@ -5,18 +5,18 @@
vm_version='vm-0.1'
# TODO:
-# - DONE: fetch, build and install vftool in .vm/vftool
-# - DONE: setup a config file per VM
-# - DONE: creation of hdd image
-# - DONE: delete a VM
-# - DONE: import iso, kernel, initrd from existing vm
-# - when no vm is specified, apply command to last one
-# - script install from CDROM iso:
-# - patch alpine setup-disk
-# - setup system, including static IP address
-# - setup user account from host
-# - setup ssh from host
-# - time synchronization from host
+# - [x] fetch, build and install vftool in .vm/vftool
+# - [x] setup a config file per VM
+# - [x] creation of hdd image
+# - [x] delete a VM
+# - [x] import iso, kernel, initrd from existing vm
+# - [ ] when no vm is specified, apply command to last one
+# - [ ] script install from CDROM iso:
+# - [ ] patch alpine setup-disk
+# - [ ] setup system, including static IP address
+# - [ ] setup user account from host
+# - [ ] setup ssh from host
+# - [ ] time synchronization from host
#
unset CDPATH
@@ -186,13 +186,14 @@ start() {
! [ "$s" ] || exec ssh "$1"
}
+# Start a vm. Notice the sub-process pattern here: f() (...)
start_vm() (
- [ -f vftool.log ] && cat vftool.log >> vftool.log.old
+ [ -f vftool.log ] && cat vftool.log >> vftool.log.old
exec 1>vftool.log 2>&1
. config || die "vm: could not source $PWD/config"
- trap 'rm -f vftool.pid' EXIT
+ trap 'rm -f vftool.pid' EXIT
- "$dir/vftool" \
+ "$dir"/vftool \
${kernel+-k "$kernel"} \
${initrd+-i "$initrd"} \
${hda+-d "$hda"} \
@@ -204,10 +205,10 @@ start_vm() (
-a "${arg-console=hvc0}" \
>>vftool.log 2>&1 & sleep 1
- [ -f screenlog.0 ] && mv screenlog.0 screenlog.0.old
- echo "$!" >vftool.pid
- screen -L -S "${PWD##*/}" -d -m "$(vftool_tty)"
- wait
+ [ -f screenlog.0 ] && mv screenlog.0 screenlog.0.old
+ echo "$!" >vftool.pid
+ screen -L -S "${PWD##*/}" -d -m "$(vftool_tty)"
+ wait
)
stop() {