#!/bin/sh
#
# Copyright (c) Citrix Systems 2007-2011
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; version 2.1 only. with the special
# exception on linking described in file LICENSE.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.

DOMID=$1
shift 1

# 64MiB core dumps
ulimit -c 67108864

vncterm=/usr/lib/xen/bin/vncterm
if [ ! -e $vncterm ]; then
	vncterm=/usr/bin/vncterm
fi
if [ ! -e $vncterm ]; then
	vncterm=/usr/lib64/xen/bin/vncterm
fi

echo vncterm-wrapper:
xenstore-write -s /local/domain/$DOMID/vncterm-pid $$
exec $vncterm $* > /dev/null 2>&1
