aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen/xendomains.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-11-24 16:01:36 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-11-24 16:01:36 +0000
commit9f0f0d9a0679bffa14141a444612c48f20c7bb64 (patch)
tree8a2acd9a440dd843cdaaac9b0f5ef432e97df7b4 /main/xen/xendomains.initd
parent164c06ca578241499e1c0badeef98ab41569d98b (diff)
downloadaports-9f0f0d9a0679bffa14141a444612c48f20c7bb64.tar.bz2
aports-9f0f0d9a0679bffa14141a444612c48f20c7bb64.tar.xz
main/xen: add tmux support
remove screen from deps. use no console as default
Diffstat (limited to 'main/xen/xendomains.initd')
-rw-r--r--main/xen/xendomains.initd36
1 files changed, 31 insertions, 5 deletions
diff --git a/main/xen/xendomains.initd b/main/xen/xendomains.initd
index dd5a924f66..dd7c07b3c4 100644
--- a/main/xen/xendomains.initd
+++ b/main/xen/xendomains.initd
@@ -72,6 +72,32 @@ close_screen() {
fi
}
+set_tmux_cmd() {
+ : ${TMUX_NAME:=xen}
+ tmux_cmd="tmux -f ${TMUX_CONF:-/dev/null}"
+}
+
+init_tmux() {
+ set_tmux_cmd
+ $tmux_cmd new-session -d -s xen -n dom0 \; \
+ set-option -g set-remain-on-exit on
+}
+
+startdom_tmux() {
+ $tmux_cmd new-window -t ${TMUX_NAME:-xen} -n ${1} "xl create ${2} -c"
+}
+
+close_tmux() {
+ set_tmux_cmd
+ if ${tmux_cmd} has-session -t ${TMUX_NAME}; then
+ ebegin "Closing tmux session ${TMUX_NAME}"
+ $tmux_cmd kill-session -t ${TMUX_NAME}
+ eend $?
+ else
+ eend 0
+ fi
+}
+
startdom_noconsole() {
xl create --quiet ${2}
}
@@ -82,10 +108,10 @@ set_dom_cmd() {
: ${XENDOMAINS_CONSOLE:=screen}
fi
case "$XENDOMAINS_CONSOLE" in
- screen)
- initconsole=init_screen
- startdom=startdom_screen
- closeconsole=close_screen
+ screen|tmux)
+ initconsole=init_$XENDOMAINS_CONSOLE
+ startdom=startdom_$XENDOMAINS_CONSOLE
+ closeconsole=close_$XENDOMAINS_CONSOLE
;;
*)
initconsole=
@@ -113,7 +139,7 @@ start() {
want_usleep=1
fi
ebegin " Starting domain ${name}"
- $startdom ${name} ${dom}
+ $startdom "${name}" "${dom}"
eend $?
else
einfo " Not starting domain ${name} - already running"