diff options
Diffstat (limited to 'app-emulation/xen-tools/files')
8 files changed, 275 insertions, 0 deletions
diff --git a/app-emulation/xen-tools/files/xen-consoles.logrotate b/app-emulation/xen-tools/files/xen-consoles.logrotate new file mode 100644 index 0000000..c644523 --- /dev/null +++ b/app-emulation/xen-tools/files/xen-consoles.logrotate @@ -0,0 +1,5 @@ +/var/log/xen-consoles/*.log { + rotate 7 + missingok + compress +} diff --git a/app-emulation/xen-tools/files/xen-tools-3.1.0-xen-detect-nopie-fix.patch b/app-emulation/xen-tools/files/xen-tools-3.1.0-xen-detect-nopie-fix.patch new file mode 100644 index 0000000..6515d12 --- /dev/null +++ b/app-emulation/xen-tools/files/xen-tools-3.1.0-xen-detect-nopie-fix.patch @@ -0,0 +1,11 @@ +Index: xen-3.1.0-src/tools/misc/Makefile +=================================================================== +--- xen-3.1.0-src.orig/tools/misc/Makefile ++++ xen-3.1.0-src/tools/misc/Makefile +@@ -45,3 +45,6 @@ clean: + + xenperf: %: %.o Makefile + $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl ++ ++xen-detect: %: %.c Makefile ++ $(CC) $(CFLAGS) $(call cc-option,$(CC),-nopie,) -o $@ $< diff --git a/app-emulation/xen-tools/files/xen-tools-3.1.3-network-bridge-broadcast.patch b/app-emulation/xen-tools/files/xen-tools-3.1.3-network-bridge-broadcast.patch new file mode 100644 index 0000000..f916ece --- /dev/null +++ b/app-emulation/xen-tools/files/xen-tools-3.1.3-network-bridge-broadcast.patch @@ -0,0 +1,11 @@ +--- xen-3.1.3/tools/examples/network-bridge.orig 2008-01-31 02:06:54.000000000 -0800 ++++ xen-3.1.3/tools/examples/network-bridge 2008-02-02 17:21:25.000000000 -0800 +@@ -70,7 +70,7 @@ + vif0="vif0.${vifnum}" + + get_ip_info() { +- addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'` ++ addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e "s/$1//"` + gateway=`ip route show dev $1 | fgrep default | sed 's/default via //'` + } + diff --git a/app-emulation/xen-tools/files/xen-tools-3.2.1-qemu-nodocs.patch b/app-emulation/xen-tools/files/xen-tools-3.2.1-qemu-nodocs.patch new file mode 100644 index 0000000..d112dd4 --- /dev/null +++ b/app-emulation/xen-tools/files/xen-tools-3.2.1-qemu-nodocs.patch @@ -0,0 +1,36 @@ +Introduce a configure option to disable building of qemu documentation. +Gentoo Bug #192427 + +Index: xen-3.2.1/tools/ioemu/configure +=================================================================== +--- xen-3.2.1.orig/tools/ioemu/configure ++++ xen-3.2.1/tools/ioemu/configure +@@ -214,6 +214,8 @@ for opt do + ;; + --disable-sdl) sdl="no" + ;; ++ --enable-docs) build_docs="yes" ++ ;; + --enable-coreaudio) coreaudio="yes" + ;; + --enable-alsa) alsa="yes" +@@ -295,6 +297,7 @@ echo " --enable-coreaudio enable + echo " --enable-alsa enable ALSA audio driver" + echo " --enable-fmod enable FMOD audio driver" + echo " --enabled-dsound enable DirectSound audio driver" ++echo " --enable-docs enable building of docs (requires texi2html and pod2man)" + echo " --disable-vnc-tls disable TLS encryption for VNC server" + echo " --enable-system enable all system emulation targets" + echo " --disable-system disable all system emulation targets" +@@ -576,8 +579,9 @@ EOF + fi + + # Check if tools are available to build documentation. +-if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then +- build_docs="yes" ++if [ ! -x "`which texi2html`" ] || [ ! -x "`which pod2man`" ]; then ++ echo "Missing texi2html or pod2man, will not build docs" ++ build_docs="no" + fi + + if test "$mingw32" = "yes" ; then diff --git a/app-emulation/xen-tools/files/xend.initd-r2 b/app-emulation/xen-tools/files/xend.initd-r2 new file mode 100644 index 0000000..b34a5a7 --- /dev/null +++ b/app-emulation/xen-tools/files/xend.initd-r2 @@ -0,0 +1,71 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +opts="start stop status restart" + +depend() { + need net + before xendomains sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp +} + +await_daemons_up() { + for ((i=0; i<5; i++)); do + /usr/sbin/xend status && return 0 + sleep 1 + done + return 1 +} + +is_privileged_domain() { + grep -qsE '^control_d$' /proc/xen/capabilities + return $? +} + +start() { + if is_privileged_domain ; then + ebegin "Starting Xen control daemon" + /usr/sbin/xend start && await_daemons_up + eend $? + else + eerror "Can't start xend - this is not a privileged domain." + return 1 + fi +} + +stop() { + if [ "$(xm list 2>/dev/null | wc -l)" -gt 2 ]; then + ebegin "Stopping all Xen domains" + /usr/sbin/xm shutdown --all --wait >/dev/null + eend $? + fi + + ebegin "Stopping Xen control daemon" + /usr/sbin/xend stop + eend $? + + #ebegin "Stopping xenconsoled" + #kill $(</var/run/xenconsoled.pid) + #eend $? + + #ebegin "Stopping xenstored" + #kill $(</var/run/xenstore.pid) + #eend $? +} + +restart() { + # IMPORTANT: do NOT restart xenstored/xenconsoled when restarting + # just xend, as this can be fatal! + # When restarting xend, leave alone xenstored/xenconsoled and all + # running domains. + # See http://article.gmane.org/gmane.comp.emulators.xen.user/40656 + ebegin "Restarting Xen control daemon" + /usr/sbin/xend restart + eend $? + # we fool /etc/init.d/runscript.sh:svc_restart() here: svc_stop svc_start +} + +status() { + is_privileged_domain && /usr/sbin/xend status +} diff --git a/app-emulation/xen-tools/files/xendomains-screen.confd b/app-emulation/xen-tools/files/xendomains-screen.confd new file mode 100644 index 0000000..1482c0a --- /dev/null +++ b/app-emulation/xen-tools/files/xendomains-screen.confd @@ -0,0 +1,15 @@ +# When SCREEN="yes", domains in AUTODIR have their consoles connected to a +# screen session named SCREEN_NAME, with output logged to individual files +# named after each domain and written to /var/log/xen-consoles/ . These files +# are rotated (using app-admin/logrotate) every time xendomains is started. + +SCREEN="yes" +SCREEN_NAME="xen" + +# Number of seconds between writes to screen's logfiles. +# +# Lower values mean more disk activity and hence a possible performance +# impact, but higher values mean a greater chance of loosing some output +# in the event of a crash. + +SCREEN_LOG_INTERVAL="1" diff --git a/app-emulation/xen-tools/files/xendomains.confd b/app-emulation/xen-tools/files/xendomains.confd new file mode 100644 index 0000000..90c1f52 --- /dev/null +++ b/app-emulation/xen-tools/files/xendomains.confd @@ -0,0 +1,9 @@ +# /etc/conf.d/xendomains + +# Directory of domains to boot. AUTODIR should contain one or more symlinks +# to domain config files in /etc/xen +AUTODIR=/etc/xen/auto + +# Send shutdown commands to all domains in parallel instead of waiting for +# each to shutdown individually +PARALLEL_SHUTDOWN=yes diff --git a/app-emulation/xen-tools/files/xendomains.initd-r1 b/app-emulation/xen-tools/files/xendomains.initd-r1 new file mode 100755 index 0000000..85a76a1 --- /dev/null +++ b/app-emulation/xen-tools/files/xendomains.initd-r1 @@ -0,0 +1,117 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +opts="start stop status restart" + +depend() { + need xend + after dhcp +} + +get_domname() { + local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1) + + if [[ -z ${name_from_file} ]] ; then + basename "${1}" + else + echo ${name_from_file} + fi +} + +is_running() { + /usr/sbin/xm list "${1}" >/dev/null 2>&1 +} + +using_screen() { + [[ "${SCREEN}" == "yes" || "${SCREEN}" == "YES" ]] +} + +set_screen_cmd() { + screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X" +} + +start() { + set_screen_cmd + + einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}" + if using_screen ; then + ebegin "Creating screen session to hold domain consoles" + ( screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 \ + && ${screen_cmd} zombie dr \ + && logrotate -f /etc/xen/xen-consoles.logrotate \ + && ${screen_cmd} logfile /var/log/xen-consoles/%t.log \ + && ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \ + && ${screen_cmd} log on \ + && ${screen_cmd} deflog on ) >/dev/null + if [[ $? -ne 0 ]] ; then + eend 1 + return 1 + else + eend + fi + fi + # Create all domains with config files in AUTODIR. + for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do + name=$(get_domname ${dom}) + if ! is_running ${name} ; then + ebegin " Starting domain ${name}" + if using_screen ; then + ${screen_cmd} screen -t ${name} xm create ${dom} -c + else + xm create --quiet ${dom} + fi + eend $? + else + einfo " Not starting domain ${name} - already running" + fi + done +} + +stop() { + set_screen_cmd + + einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}" + # Stop all domains with config files in AUTODIR. + DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)" + + if [[ "$PARALLEL_SHUTDOWN" = "yes" ]] ; then + for dom in $DOMAINS ; do + name=$(get_domname ${dom}) + if is_running ${name} ; then + ebegin " Asking domain ${name} to shutdown in the background..." + xm shutdown --wait ${name} >/dev/null & + else + einfo " Not stopping domain ${name} - not running" + fi + done + einfo " Waiting for shutdown of domains that are still running" + wait + eend $? + else + for dom in $DOMAINS ; do + name=$(get_domname ${dom}) + if is_running ${name} ; then + ebegin " Waiting for domain ${name} to shutdown" + xm shutdown --wait ${name} >/dev/null + eend $? + else + einfo " Not stopping domain ${name} - not running" + fi + done + fi + if using_screen ; then + if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then + ebegin "Closing screen session ${SCREEN_NAME}" + ${screen_cmd} quit + eend $? + else + eend 0 + fi + fi +} + +status() { + /usr/sbin/xm list +} |