( set -P && cd "$1" && pwd )
}
+## Usage: logging <message>
function logging
{
if test "$_VS_LOGFILE"; then
fi
}
+## Usage: warning <message>
function warning
{
if test "$_VS_ERRFILE"; then
fi
}
+## Usage: panic <message>
function panic
{
if test "$_VS_ERRFILE"; then
exit 1
}
+## Usage: execute <message>
function execute
{
test -z "${DEBUG_EXEC:-}" || echo "$@"
exit 0
}
+## Usage: isNumber <arg>
function isNumber
{
local tmp
return 0
}
+_VS_LOCKS=''
+## Usage: lock <lockfile> [<timeout>]
+function lock
+{
+ local tmp=$(mktemp /tmp/vserver-lock.XXXXXX)
+ rm -f $tmp
+ mkfifo -m600 $tmp
+
+ $_LOCKFILE "$1" $tmp $2 &
+ grep -q true $tmp 2>/dev/null || return 1
+
+ _VS_LOCKS="$! $_VS_LOCKS"
+}
+
+## Usage: unlock [<num>]
+function unlock
+{
+ local num=$1
+ local i
+
+ set -- $_VS_LOCKS
+ while test "$#" -gt 0; do
+ kill -HUP "$1" >/dev/null || :
+ shift
+ test "$num" != 1 || break
+ test -z "$num" || let --num
+ done
+ _VS_LOCKS="$@"
+}
+
function _pkgMountBindDir()
{
test "$1" != "$2" || return 0
local ctx=
isAvoidNamespace "$1" || \
- ctx=$( $_VSERVER_INFO "$1" CONTEXT t ) || ctx=
+ ctx=$( $_VSERVER_INFO "$1" CONTEXT f ) || ctx=
shift
if test "$ctx"; then
fi
}
+## Usage: setDefaultTTY <vdir> [<fallback-tty>]
+function setDefaultTTY
+{
+ local cfgdir ttyname
+
+ cfgdir=$($_VSERVER_INFO "$1" APPDIR init) || cfgdir=
+ findObject -e ttyname \
+ ${cfgdir:+"$cfgdir"/tty} \
+ "$CONFDIR/.defaults/apps/init/tty" \
+ $2 /dev/null
+
+ exec <$ttyname
+ exec >>$ttyname
+ exec 2>>$ttyname
+}
+
## Usage: pkgmgmt.guessStyle <vserver> <resultvar>
function pkgmgmt.guessStyle()
{
test -d "$VSHELPERSTATEDIR" || {
warnings=( "${warnings[@]}"
$"\
-The vshelper state-directory '$VSHELPERSTATEDIR' does not exist;
- since it is created by 'make install', this indicates a serious
- problem with your util-vserver installation" )
+The vshelper state-directory '$VSHELPERSTATEDIR' does not exist; since
+it is created by 'make install', this indicates a serious problem with
+your util-vserver installation" )
solution_disable=1
}
{
vshelper.isEnabled || return 0
- local xid=$($_VSERVER_INFO "$1" CONTEXT false) || {
- warning $"vshelper.init: can not determine xid of vserver '$vserver'"
+ local xid=$($_VSERVER_INFO "$1" CONTEXT false) && test "$xid" || {
+ warning $"vshelper.init: can not determine xid of vserver '$vserver'; returned value was '$xid'"
return 1
}