use $(LIBENSCVECTOR) instead of libensc_vector.a
[util-vserver.git] / util-vserver / scripts / functions
index 2cc3de0..e9123f8 100644 (file)
@@ -129,7 +129,7 @@ function colorize
        "$@"
     else
        local   cfile
-       findFile cfile "$CONFDIR"/.defaults/styles/"$style" ''
+       findFile cfile "$__CONFDIR"/.defaults/styles/"$style" ''
        if test -n "$cfile"; then
          $_CAT "$cfile"
        else
@@ -212,14 +212,14 @@ function _pkgSetVarsBase
            fi
            ;;
         *)
-           BASEDIR=$CONFDIR/$vserver
+           BASEDIR=$__CONFDIR/$vserver
            test -d "$BASEDIR" || {
                echo "Can not find configuration-directory"
                exit 1
            } >&2
            
            VDIR=$BASEDIR/vdir
-           test -d "$VDIR"   || VDIR=$DEFAULT_VSERVERDIR/$vserver
+           test -d "$VDIR"   || VDIR=$__DEFAULT_VSERVERDIR/$vserver
            VDIR=$(getPhysicalDir "$VDIR")
            
            PKGDIR=$BASEDIR/apps/pkgmgmt
@@ -393,7 +393,7 @@ function isAvoidNamespace
     $_VSERVER_INFO - FEATURE namespace   || return 0
     cfgdir=$($_VSERVER_INFO "$1" CFGDIR) || return 0
     test ! -e "$cfgdir"/namespace        || return 1
-    test -e "$CONFDIR"/.defaults/nonamespace -o \
+    test -e "$__CONFDIR"/.defaults/nonamespace -o \
          -e "$cfgdir"/nonamespace
 }
 
@@ -402,7 +402,7 @@ function getAllVservers
     local _ga_i
     declare -a _ga_tmp=()
 
-    for _ga_i in $CONFDIR/*; do
+    for _ga_i in $__CONFDIR/*; do
        test   -d "$_ga_i"          || continue
        test ! -e "$_ga_i"/disabled || continue
        test   -d "$_ga_i"/vdir     || continue
@@ -410,7 +410,7 @@ function getAllVservers
            *.~*~) continue;;
        esac
 
-       _ga_tmp=( "${_ga_tmp[@]}" "${_ga_i##$CONFDIR/}")
+       _ga_tmp=( "${_ga_tmp[@]}" "${_ga_i##$__CONFDIR/}")
     done
 
     eval $1='( "${_ga_tmp[@]}" )'
@@ -511,8 +511,8 @@ function checkComponents
        case "$i" in
            (core)      test -x "$_CHBIND"           || failed=1;;
            (build)     test -x "$_VSERVER_BUILD"    || failed=1;;
-           (sysv)      test -x "$INITRDDIR/vserver" || failed=1;;
-           (devel)     test -d "$INCLUDEDIR/vserver.h" || failed=1;;
+           (sysv)      test -x "$__INITRDDIR/vserver"    || failed=1;;
+           (devel)     test -d "$__INCLUDEDIR/vserver.h" || failed=1;;
            (*)         echo "Unknown component '$i'" >&2
                        return false
                        ;;
@@ -530,7 +530,8 @@ function checkComponents
 ## Usage: isKernelAPI <ver> [<cmp-modifier>]
 function isKernelAPI
 {
-    local api=$($_VSERVER_INFO - APIVER) || api=0
+    local api
+    api=$($_VSERVER_INFO - APIVER) || api=0
     test $[ $api ] -${2:-ge} $[ $1 ]
 }
 
@@ -558,7 +559,7 @@ function setDefaultTTY
     cfgdir=$($_VSERVER_INFO "$1" APPDIR init) || cfgdir=
     findObject -e ttyname \
        ${cfgdir:+"$cfgdir"/tty} \
-       "$CONFDIR/.defaults/apps/init/tty" \
+       "$__CONFDIR/.defaults/apps/init/tty" \
        $2 /dev/null
 
     exec   <$ttyname
@@ -568,7 +569,8 @@ function setDefaultTTY
 ## Usage: pkgmgmt.guessStyle <vserver> <resultvar>
 function pkgmgmt.guessStyle()
 {
-    local _pgs_vdir=$($_VSERVER_INFO "$1" VDIR) || {
+    local _pgs_vdir
+    _pgs_vdir=$($_VSERVER_INFO "$1" VDIR) || {
        echo $"Can not determine vserver-root" >&2
        return 1
     }
@@ -668,7 +670,7 @@ function vshelper.doSanityCheck
     if ! test -r "$proc_file"; then
        vshelper=
        warnings=( "${warnings[@]}"
-                  $"File '$proc_file' does not exists but is required for vshelper setup" )
+                  $"File '$proc_file' does not exist but is required for vshelper setup" )
         solution_disable=1
     else
        vshelper=$(cat "$proc_file")
@@ -683,10 +685,10 @@ function vshelper.doSanityCheck
        }
     fi
 
-    test -d "$VSHELPERSTATEDIR" || {
+    test -d "$__VSHELPERSTATEDIR" || {
        warnings=( "${warnings[@]}"
                   $"\
-The vshelper state-directory '$VSHELPERSTATEDIR' does not exist; since
+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
@@ -707,9 +709,9 @@ To fix this, you can:"
 
        test -z "$solution_disable" || warning $"\
 * disable vshelper entirely by executing
-  | touch \"$CONFDIR/.defaults/apps/vshelper/disabled\"
+  | touch \"$__CONFDIR/.defaults/apps/vshelper/disabled\"
 * disable only this message by executing
-  | touch \"$CONFDIR/.defaults/apps/vshelper/warning-disabled\""
+  | touch \"$__CONFDIR/.defaults/apps/vshelper/warning-disabled\""
 
        test -x "$solution_sysctl" || warning $"\
 * configure the util-vserver vshelper script, e.g. by adding
@@ -729,10 +731,11 @@ To fix this, you can:"
 function vshelper.isEnabled
 {
     local f=${1:+$1-}disabled
-    test ! -e "$CONFDIR"/.defaults/apps/vshelper/"$f"       || return 1
+    test ! -e "$__CONFDIR"/.defaults/apps/vshelper/"$f"       || return 1
     $_VSERVER_INFO - FEATURE vshelper                       || return 1
     if test -n "$2"; then
-       local appdir=$($_VSERVER_INFO "$2" APPDIR vshelper) || return 0
+       local appdir
+       appdir=$($_VSERVER_INFO "$2" APPDIR vshelper)       || return 0
        test -z "$2" -o ! -e "$appdir/$f"                   || return 1
     fi
 
@@ -742,10 +745,11 @@ function vshelper.isEnabled
 ## Usage: vshelper.isDebug [<vserver>]
 function vshelper.isDebug
 {
-    test ! -e "$CONFDIR"/.defaults/apps/vshelper/debug     || return 1
+    test ! -e "$__CONFDIR"/.defaults/apps/vshelper/debug           || return 1
     $_VSERVER_INFO - FEATURE vshelper                       || return 1
     if test -n "$1"; then
-       local appdir=$($_VSERVER_INFO "$1" APPDIR vshelper) || return 1
+       local appdir
+       appdir=$($_VSERVER_INFO "$1" APPDIR vshelper)       || return 1
        test -z "$1" -o ! -e "$appdir/debug"                || return 1
     fi
 
@@ -784,14 +788,16 @@ function vshelper._getHandlerInternal
 ## Usage: vshelper.getHandler <result-var> <vserver> <action>
 function vshelper.getHandler
 {
-    local _vgh_appdir=$($_VSERVER_INFO "$2" APPDIR vshelper) || _vgh_appdir=
+    local _vgh_appdir
+    _vgh_appdir=$($_VSERVER_INFO "$2" APPDIR vshelper) || _vgh_appdir=
+
     declare -a _vgh_search_list=( X )
     ## HACK: when we are in 'set -u' mode, empty lists are causing errors
 
     test -z "$_vgh_appdir" || _vgh_search_list=( "${_vgh_search_list[@]}" -x "$_vgh_appdir/$3" )
     test -z "$_vgh_appdir" || _vgh_search_list=( "${_vgh_search_list[@]}" -e "$_vgh_appdir/action" )
-    _vgh_search_list=( "${_vgh_search_list[@]}" -x "$CONFDIR"/.defaults/apps/vshelper/"$3" )
-    _vgh_search_list=( "${_vgh_search_list[@]}" -e "$CONFDIR"/.defaults/apps/vshelper/action )
+    _vgh_search_list=( "${_vgh_search_list[@]}" -x "$__CONFDIR"/.defaults/apps/vshelper/"$3" )
+    _vgh_search_list=( "${_vgh_search_list[@]}" -e "$__CONFDIR"/.defaults/apps/vshelper/action )
 
     ! vshelper._getHandlerInternal "$1" "${_vgh_search_list[@]}" || return 0
     eval $1=':restart'
@@ -802,12 +808,13 @@ function vshelper.doInit
 {
     vshelper.isEnabled || return 0
     
-    local xid=$($_VSERVER_INFO "$1" CONTEXT false) && test -n "$xid" || {
+    local xid
+    xid=$($_VSERVER_INFO "$1" CONTEXT false) && test -n "$xid" || {
        warning $"vshelper.init: can not determine xid of vserver '$vserver'; returned value was '$xid'"
        return 1
     }
 
-    local f="$VSHELPERSTATEDIR/$xid"
+    local f="$__VSHELPERSTATEDIR/$xid"
     
     set -C
     $_RM -f "$f"
@@ -832,13 +839,14 @@ function vshelper.doDestroy
 {
     vshelper.isEnabled || return 0
 
-    $_RM -f "$VSHELPERSTATEDIR/$2"
+    $_RM -f "$__VSHELPERSTATEDIR/$2"
 }
 
 ## Usage: vshelper.initSync <vserver> <pipe-varname>
 function vshelper.initSync
 {
-    local _vis_tmpdir=$($_MKTEMPDIR /tmp/vserver-stop.XXXXXX) || {
+    local _vis_tmpdir
+    _vis_tmpdir=$($_MKTEMPDIR /tmp/vserver-stop.XXXXXX) || {
        warning $"Failed to generate temporary directory for vshelper sync"
        return 1
     }
@@ -852,10 +860,10 @@ function vshelper.initSync
 ## Usage: vshelper.getSyncTimeout <vserver> <varname>
 function vshelper.getSyncTimeout
 {
-    local _vgst_appdir=$($_VSERVER_INFO "$1" APPDIR vshelper) || _vgst_appdir=
-    local _vgst_file _vgst_tmp
+    local _vgst_appdir _vgst_file _vgst_tmp
+    _vgst_appdir=$($_VSERVER_INFO "$1" APPDIR vshelper) || _vgst_appdir=
 
-    findFile _vgst_file ${_vgst_appdir:+"$_vgst_appdir"/sync-timeout} "$CONFDIR"/.defaults/apps/vshelper/sync-timeout ''
+    findFile _vgst_file ${_vgst_appdir:+"$_vgst_appdir"/sync-timeout} "$__CONFDIR"/.defaults/apps/vshelper/sync-timeout ''
     test -n "$_vgst_file" || return 1
     read _vgst_tmp <"$_vgst_file"
     eval $2=\$_vgst_tmp