# $Id$ --*- sh -*--
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+# Copyright (C) 2003,2004,2005,2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
( set -P && cd "$1" && pwd )
}
+## Usage:: isDirectoryEmpty <dir> [<ignore-lost+found>]
+function isDirectoryEmpty
+{
+ (
+ shopt -s dotglob || *
+ shopt -s nullglob || *
+
+ ignore_lostfound=1
+ test -z "$2" -o "$2" = 0 || ignore_lostfound=
+
+ for i in "$1"/*; do
+ case "$i" in
+ ($1/lost+found)
+ test "$ignore_lostfound" || exit 1
+ ;;
+ (*) echo "$i"; exit 1
+ esac
+ done
+
+ exit 0
+ )
+}
+
## Usage: logging <message>
function logging
{
esac
fi
- "$@"
+ ( "$@" )
echo -ne "\e[m"
fi
}
+function colpanic
+{
+ if test -n "$_VS_ERRFILE"; then
+ echo "$@" >>"$_VS_ERRFILE"
+ else
+ colorize error echo -n "$@" >&2
+ fi
+ echo
+
+ exit 1
+}
+
+function colwarning
+{
+ colorize warning warning "$@"
+}
+
+function colinfo
+{
+ colorize info echo "$@"
+}
+
+
## Usage: xtermTitle <title>
function xtermTitle
{
test -x "$solution_sysctl" || warning $"\
* configure the util-vserver vshelper script, e.g. by adding
- | kernel.vshelper = \"$_VSHELPER\"
+ | kernel.vshelper = $_VSHELPER
to /etc/sysctl.conf and rebooting the machine, or by executing
| echo \"$_VSHELPER\" >$proc_file"
local _vis_fifo="$_vis_tmpdir"/pipe
$_MKFIFO -m700 "$_vis_fifo"
- vshelper.doInit "$1" "${method:-sync}" "$_vis_fifo"
+ vshelper.doInit "$1" "${3:-sync}" "$_vis_fifo"
eval $2=\$_vis_fifo
}