diff options
author | Markos Chandras <hwoarang@gentoo.org> | 2012-06-17 09:17:36 +0000 |
---|---|---|
committer | Markos Chandras <hwoarang@gentoo.org> | 2012-06-17 09:17:36 +0000 |
commit | ad24a6fa897cf2a0792bf3291d3cbc24ce2ab62f (patch) | |
tree | 5afb9cf85272edfb2bd6f8ee2ed02c4eef24464a /app-emulation | |
parent | Add backport of AF_LOCAL/AF_UNIX fix from upstream to fix compilation on e.g.... (diff) | |
download | gentoo-2-ad24a6fa897cf2a0792bf3291d3cbc24ce2ab62f.tar.gz gentoo-2-ad24a6fa897cf2a0792bf3291d3cbc24ce2ab62f.tar.bz2 gentoo-2-ad24a6fa897cf2a0792bf3291d3cbc24ce2ab62f.zip |
Add init script to automatically start/save virtual machines on boot/shutdown. Thanks to Balint SZENTE <balint@szentedwg.ro>. Bug #420991
(Portage version: 2.1.10.65/cvs/Linux x86_64)
Diffstat (limited to 'app-emulation')
-rw-r--r-- | app-emulation/phpvirtualbox/ChangeLog | 9 | ||||
-rw-r--r-- | app-emulation/phpvirtualbox/files/vboxinit-initd | 39 | ||||
-rw-r--r-- | app-emulation/phpvirtualbox/phpvirtualbox-4.1.7-r1.ebuild | 62 |
3 files changed, 109 insertions, 1 deletions
diff --git a/app-emulation/phpvirtualbox/ChangeLog b/app-emulation/phpvirtualbox/ChangeLog index a4fcf3a8e860..e7cbc5946271 100644 --- a/app-emulation/phpvirtualbox/ChangeLog +++ b/app-emulation/phpvirtualbox/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for app-emulation/phpvirtualbox # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/phpvirtualbox/ChangeLog,v 1.1 2012/03/16 22:44:27 hwoarang Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-emulation/phpvirtualbox/ChangeLog,v 1.2 2012/06/17 09:17:36 hwoarang Exp $ + +*phpvirtualbox-4.1.7-r1 (17 Jun 2012) + + 17 Jun 2012; Markos Chandras <hwoarang@gentoo.org> +files/vboxinit-initd, + +phpvirtualbox-4.1.7-r1.ebuild: + Add init script to automatically start/save virtual machines on boot/shutdown. + Thanks to Balint SZENTE <balint@szentedwg.ro>. Bug #420991 *phpvirtualbox-4.1.7 (16 Mar 2012) diff --git a/app-emulation/phpvirtualbox/files/vboxinit-initd b/app-emulation/phpvirtualbox/files/vboxinit-initd new file mode 100644 index 000000000000..b43528864d00 --- /dev/null +++ b/app-emulation/phpvirtualbox/files/vboxinit-initd @@ -0,0 +1,39 @@ +#!/sbin/runscript + +description="Controls VirtualBox sessions" + +. /etc/conf.d/vboxwebsrv + +su_command="su - ${VBOXWEBSRV_USER} -c" + +depend() { + need localmount + after bootmisc +} + +start() { + einfo "Starting VirtualBox machines" + eindent + MACHINES=$($su_command "VBoxManage list vms | awk '{ print \$NF }' | sed -e 's/[{}]//g'") + for UUID in $MACHINES; do + STARTUP=$($su_command "VBoxManage getextradata $UUID 'pvbx/startupMode'" | awk '{ print $NF }') + VMNAME=$($su_command "VBoxManage showvminfo $UUID | sed -n '0,/^Name:/s/^Name:[ \t]*//p'") + if [ "${STARTUP}" == "auto" ]; then + ebegin "Starting machine ${VMNAME}" + $su_command "VBoxHeadless -s $UUID --vrde=config" &>> /var/log/vboxinit.log + eend $? + fi + done +} + +stop() { + einfo "Saving VirtualBox machines" + eindent + MACHINES=$($su_command "VBoxManage list runningvms | awk '{ print \$NF }' | sed -e 's/[{}]//g'") + for UUID in $MACHINES; do + VMNAME=$($su_command "VBoxManage showvminfo $UUID | sed -n '0,/^Name:/s/^Name:[ \t]*//p'") + ebegin "Stopping machine ${VMNAME}" + $su_command "VBoxManage controlvm $UUID savestate" &>> /var/log/vboxinit.log + eend $? + done +} diff --git a/app-emulation/phpvirtualbox/phpvirtualbox-4.1.7-r1.ebuild b/app-emulation/phpvirtualbox/phpvirtualbox-4.1.7-r1.ebuild new file mode 100644 index 000000000000..b6833f272797 --- /dev/null +++ b/app-emulation/phpvirtualbox/phpvirtualbox-4.1.7-r1.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/phpvirtualbox/phpvirtualbox-4.1.7-r1.ebuild,v 1.1 2012/06/17 09:17:36 hwoarang Exp $ + +EAPI="2" + +inherit versionator eutils webapp depend.php + +MY_PV="$(replace_version_separator 2 '-')" +MY_P="${PN}-${MY_PV}" + +DESCRIPTION="Web-based administration for VirtualBox in PHP" +HOMEPAGE="http://phpvirtualbox.googlecode.com" +SRC_URI="http://${PN}.googlecode.com/files/${MY_P}.zip" + +LICENSE="GPL-2" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND=" + dev-lang/php[session,unicode,soap,gd] +" +DEPEND="app-arch/unzip" + +need_php_httpd + +src_install() { + webapp_src_preinst + + cd ${MY_P} + + dodoc CHANGELOG.txt LICENSE.txt README.txt || die + rm -f CHANGELOG.txt LICENSE.txt README.txt + + insinto "${MY_HTDOCSDIR}" + doins -r . + + webapp_configfile "${MY_HTDOCSDIR}"/config.php-example + webapp_serverowned "${MY_HTDOCSDIR}"/config.php-example + + webapp_src_install + + newinitd "${FILESDIR}"/vboxinit-initd vboxinit +} + +pkg_postinst() { + webapp_pkg_postinst + elog "Local or remote virtualbox hosts must be compiled with" + elog "'vboxwebsrv' useflag and the respective init script" + elog "must be running to use this interface" + elog " /etc/init.d/vboxwebsrv start" + elog + elog "To enable the automatic startup mode feature uncomment the" + elog "following line in the config.php file:" + elog " var \$startStopConfig = true;" + elog + elog "You should also add the /etc/init.d/vboxinit script to the" + elog "default runlevel on the virtualbox host:" + elog "\`rc-update add vboxinit default\`" + elog "If the server is on a remote host, than the script must be" + elog "copied manually." +} |