summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-emulation/qemu-init-scripts/files/qemu-conf.example (renamed from app-emulation/kvm-init-script/files/kvm-conf.example)0
-rw-r--r--app-emulation/qemu-init-scripts/files/qemu-init-script (renamed from app-emulation/kvm-init-script/files/kvm-init-script)44
-rw-r--r--app-emulation/qemu-init-scripts/files/qtap-manipulate (renamed from app-emulation/kvm-init-script/files/qtap-manipulate)0
-rw-r--r--app-emulation/qemu-init-scripts/qemu-init-scripts-0.1.ebuild (renamed from app-emulation/kvm-init-script/kvm-init-script-0.1.ebuild)5
-rw-r--r--profiles/repo_name2
5 files changed, 34 insertions, 17 deletions
diff --git a/app-emulation/kvm-init-script/files/kvm-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index 46f8274..46f8274 100644
--- a/app-emulation/kvm-init-script/files/kvm-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
diff --git a/app-emulation/kvm-init-script/files/kvm-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 9db1757..ba9aae3 100644
--- a/app-emulation/kvm-init-script/files/kvm-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -3,20 +3,35 @@
# Distributed under the terms of the GNU General Public License v2
# To use this, symlink a target kvm instance to this script.
-# Literally, ln -s kvm /etc/init.d/kvm.<vmname>
-# then have a config named /etc/conf.d/kvm.<vmname>
+# Literally, ln -s qemu /etc/init.d/<vm-type>.<vmname>
+# then have a config named /etc/conf.d/<vm-type>.<vmname>
+#
+# Allowed vm-types are currently qemu and kvm.
VMNAME=${SVCNAME#*.}
-PIDFILE=/var/run/vm/${VMNAME}.pid
-MONITOR=/var/run/vm/${VMNAME}.monitor
-QTAP_FILE=/var/run/vm/${VMNAME}.qtap
+VMTYPE=${SVCNAME%.*}
+VM_BINARY=
+PIDFILE=/var/run/vm/${SVCNAME}.pid
+MONITOR=/var/run/vm/${SVCNAME}.monitor
+QTAP_FILE=/var/run/vm/${SVCNAME}.qtap
+
+discern_vm_binary() {
+ case "$VMTYPE" in
+ kvm)
+ VM_BINARY=`type -p qemu-kvm`
+ [ -z "$VM_BINARY" ] && VM_BINARY=`type -p kvm`
+ ;;
+ qemu)
+ VM_BINARY=`type -p qemu`
+ ;;
+ *)
+ eerror "Failed to discern the binary for $VMTYPE"
+ ;;
+ esac
+ return 0
+}
-# Default to qemu-kvm in the absense of a setting, failing back
-# to kvm if no binary is found, finally, back to qemu.
-[ -z "$VMSOFTWARE" ] && VMSOFTWARE=$(type -p qemu-kvm)
-[ -z "$VMSOFTWARE" ] && VMSOFTWARE=$(type -p kvm)
-[ -z "$VMSOFTWARE" ] && VMSOFTWARE=$(type -p qemu)
DROP_USER=${DROP_USER:-nobody}
MEMORY=${MEMORY:-512M}
@@ -45,6 +60,7 @@ sanity_check() {
eerror "couldn't find \$DISKIMAGE '$DISKIMAGE'"
return 1;
fi
+ discern_vm_binary
}
start() {
@@ -70,8 +86,8 @@ start() {
echo "${QTAP}" > ${QTAP_FILE}
eend $?
- ebegin "Starting ${VMSOFTWARE##*/} for ${VMNAME} at VNC port${VNC}"
- start-stop-daemon --start "${VMSOFTWARE}" \
+ ebegin "Starting ${VM_BINARY##*/} for ${VMNAME} at VNC port${VNC}"
+ start-stop-daemon --start "${VM_BINARY}" \
--pidfile ${PIDFILE} \
-- -daemonize -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
-runas ${DROP_USER} -name ${VMNAME} \
@@ -125,8 +141,8 @@ stop() {
eend $ret
fi
- ebegin "Stopping ${VMSOFTWARE##*/} for ${VMNAME}"
- start-stop-daemon --stop "${VMSOFTWARE}" \
+ ebegin "Stopping ${VM_BINARY##*/} for ${VMNAME}"
+ start-stop-daemon --stop "${VM_BINARY}" \
--user "${DROP_USER}" \
--pidfile "${PIDFILE}" \
--quiet
diff --git a/app-emulation/kvm-init-script/files/qtap-manipulate b/app-emulation/qemu-init-scripts/files/qtap-manipulate
index 426bc78..426bc78 100644
--- a/app-emulation/kvm-init-script/files/qtap-manipulate
+++ b/app-emulation/qemu-init-scripts/files/qtap-manipulate
diff --git a/app-emulation/kvm-init-script/kvm-init-script-0.1.ebuild b/app-emulation/qemu-init-scripts/qemu-init-scripts-0.1.ebuild
index 685ec69..209d7ba 100644
--- a/app-emulation/kvm-init-script/kvm-init-script-0.1.ebuild
+++ b/app-emulation/qemu-init-scripts/qemu-init-scripts-0.1.ebuild
@@ -13,7 +13,8 @@ KEYWORDS="amd64 x86"
PDEPEND="|| ( app-emulation/qemu-kvm app-emulation/qemu )"
src_install() {
- newinitd "${FILESDIR}"/kvm-init-script kvm
- newconfd "${FILESDIR}"/kvm-conf.example kvm.conf.example
+ newinitd "${FILESDIR}"/qemu-init-script qemu
+ newconfd "${FILESDIR}"/qemu-conf.example qemu.conf.example
newsbin "${FILESDIR}"/qtap-manipulate qtap-manipulate
+ dosym qemu /etc/init.d/kvm
}
diff --git a/profiles/repo_name b/profiles/repo_name
index 68ebe70..503c1d2 100644
--- a/profiles/repo_name
+++ b/profiles/repo_name
@@ -1 +1 @@
-kvm-tools
+qemu-init