diff options
-rw-r--r-- | kvm-init-script | 9 | ||||
-rwxr-xr-x | qtap-manipulate | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/kvm-init-script b/kvm-init-script index 87d5a48..cec0ed6 100644 --- a/kvm-init-script +++ b/kvm-init-script @@ -13,8 +13,9 @@ DROP_USER=${DROP_USER:-nobody} MEMORY=${MEMORY:-512M} TIMEOUT=${TIMEOUT:-300} SMP=${SMP:-1} +export KVM_USER=${KVM_USER:-"root"} -opts="reboot" +extra_commands="reboot" depend() { need net.br0 @@ -22,16 +23,16 @@ depend() { send_command() { local command="socat -u - UNIX-CONNECT:${MONITOR}" - which nc6 2>&1 > /dev/null && command="nc6 -U ${MONITOR} --send-only" + which nc6 2> /dev/null > /dev/null && command="nc6 -U ${MONITOR} --send-only" echo "$@" | ${command} >/dev/null 2>&1 } sanity_check() { - if [ "${VMNAME}" = "${SVCNAME}" ]; then + if [ "${VMNAME}" != "${SVCNAME}" ]; then eerror "You have to create an init script for each vm:" eerror " ln -s vm /etc/init.d/vm.vmname" return 1 - elif [ ! -f "${DISKIMAGE}" ]; then + elif [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then eerror "couldn't find \$DISKIMAGE '$DISKIMAGE'" return 1; fi diff --git a/qtap-manipulate b/qtap-manipulate index b75c5ef..0c92633 100755 --- a/qtap-manipulate +++ b/qtap-manipulate @@ -1,7 +1,7 @@ #!/bin/sh [ -z "$1" ] || ( [ "$1" != "create" ] && [ -z "$2" ] ) && { echo "invalid usage, require create [device] || |destroy device"; exit 1; } -#KVM_USER="kvm-envs" +KVM_USER=${KVM_USER:-"root"} has() { local desired=$1 x |