aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen/xendomains.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-06-21 13:33:56 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-06-21 13:33:56 +0000
commite247ca0455a53e070f24b72688e6b6aafbdd9a11 (patch)
tree357250684830b63a472e0249a3bfc83593854b09 /main/xen/xendomains.initd
parent24866b94daf588f93425cf9470439cbca8cde332 (diff)
downloadaports-e247ca0455a53e070f24b72688e6b6aafbdd9a11.tar.bz2
aports-e247ca0455a53e070f24b72688e6b6aafbdd9a11.tar.xz
main/xen: fix xendomains init script to wait for screen
We need wait til the detatched screen has created the connection sockets before trying to set the opts to it. ref #1181
Diffstat (limited to 'main/xen/xendomains.initd')
-rwxr-xr-x[-rw-r--r--]main/xen/xendomains.initd15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/xen/xendomains.initd b/main/xen/xendomains.initd
index 63d35fc71..c791e3e58 100644..100755
--- a/main/xen/xendomains.initd
+++ b/main/xen/xendomains.initd
@@ -29,9 +29,23 @@ using_screen() {
}
set_screen_cmd() {
+ export SCREENDIR=/var/run/xen-screens
+ checkpath --directory --mode 700 "$SCREENDIR"
screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X"
}
+dir_is_empty() {
+ local dir=$1
+ set -- "$dir"/*
+ test "$1" = "$dir/*"
+}
+
+wait_screen() {
+ while dir_is_empty "$SCREENDIR"; do
+ sleep 0.1
+ done
+}
+
start() {
set_screen_cmd
@@ -39,6 +53,7 @@ start() {
if using_screen ; then
ebegin "Creating screen session to hold domain consoles"
( screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 \
+ && wait_screen \
&& ${screen_cmd} zombie dr \
&& logrotate -f /etc/xen/xen-consoles.logrotate \
&& ${screen_cmd} logfile /var/log/xen-consoles/%t.log \