lsb-functions: removed dolisting()
[grml-etc-core.git] / etc / grml / lsb-functions
index 22dc9e0..f565f0f 100644 (file)
@@ -31,7 +31,7 @@
 
 TPUT="${TPUT:-"/usr/bin/tput"}"
 
-have_tput() {
+_have_tput() {
     [ -x "$TPUT" ] && "$TPUT" hpa 60 >/dev/null 2>&1 \
         && return 0 \
         || return 1
@@ -42,7 +42,7 @@ log_success_msg () {
 }
 
 log_failure_msg () {
-    if have_tput ; then
+    if _have_tput ; then
         RED="$("$TPUT" setaf 1)"
         #NORMAL="$("$TPUT" op)"
         printf " ${RED}*${NORMAL} $@\n"
@@ -52,7 +52,7 @@ log_failure_msg () {
 }
 
 log_warning_msg () {
-    if have_tput ; then
+    if _have_tput ; then
         YELLOW="$("$TPUT" setaf 3)"
         #NORMAL="$("$TPUT" op")"
         # printf " *${NORMAL} $@\n"
@@ -63,7 +63,7 @@ log_warning_msg () {
 }
 
 log_warning_msg_nn () {
-    if have_tput ; then
+    if _have_tput ; then
         YELLOW="$("$TPUT" setaf 3)"
         printf " ${BLUE}*${NORMAL} $@"
     else
@@ -97,7 +97,7 @@ log_end_msg () {
 
     # Only do the fancy stuff if we have an appropriate terminal
     # and if /usr is already mounted
-    if have_tput ; then
+    if _have_tput ; then
         COLS="$("$TPUT" cols)"
         if [ -n "$COLS" ]; then
             COL=$(( "$COLS" - 7 ))
@@ -191,9 +191,9 @@ profiling() {
 #    parameters.
 #
 get_bootconfig() {
-    local copt=
-    local newbootlevel=
-    local newsoftlevel=
+    local copt
+    local newbootlevel
+    local newsoftlevel
 
     for copt in $(</proc/cmdline) ; do
         case "${copt%=*}" in
@@ -239,8 +239,8 @@ get_libdir() {
 #    use the system logger to log a message
 #
 esyslog() {
-    local pri=
-    local tag=
+    local pri
+    local tag
 
     if [ -x /usr/bin/logger ]
     then
@@ -437,11 +437,11 @@ ewend() {
 
 # v-e-commands honor RC_VERBOSE which defaults to no.
 # The condition is negated so the return value will be zero.
-veinfo()  { [ "${RC_VERBOSE}" != yes ] || einfo  "$@"; }
-veinfon() { [ "${RC_VERBOSE}" != yes ] || einfon "$@"; }
-vewarn()  { [ "${RC_VERBOSE}" != yes ] || ewarn  "$@"; }
-veerror() { [ "${RC_VERBOSE}" != yes ] || eerror "$@"; }
-vebegin() { [ "${RC_VERBOSE}" != yes ] || ebegin "$@"; }
+veinfo()  { [ "${RC_VERBOSE}" != "yes" ] || einfo  "$@"; }
+veinfon() { [ "${RC_VERBOSE}" != "yes" ] || einfon "$@"; }
+vewarn()  { [ "${RC_VERBOSE}" != "yes" ] || ewarn  "$@"; }
+veerror() { [ "${RC_VERBOSE}" != "yes" ] || eerror "$@"; }
+vebegin() { [ "${RC_VERBOSE}" != "yes" ] || ebegin "$@"; }
 veend() {
     [ "${RC_VERBOSE}" = "yes" ] && { eend "$@"; return $?; }
     return ${1:-0}
@@ -451,79 +451,6 @@ veend() {
     return ${1:-0}
 }
 
-# char *KV_major(string)
-#
-#    Return the Major (X of X.Y.Z) kernel version
-#
-KV_major() {
-    [ -z "$1" ] && return 1
-
-    local KV=$@
-    printf "${KV%%.*}\n"
-}
-
-# char *KV_minor(string)
-#
-#    Return the Minor (Y of X.Y.Z) kernel version
-#
-KV_minor() {
-    [ -z "$1" ] && return 1
-
-    local KV="$@"
-    KV="${KV#*.}"
-    printf "${KV%%.*}\n"
-}
-
-# char *KV_micro(string)
-#
-#    Return the Micro (Z of X.Y.Z) kernel version.
-#
-KV_micro() {
-    [ -z "$1" ] && return 1
-
-    local KV="$@"
-    KV="${KV#*.*.}"
-    printf "${KV%%[^[:digit:]]*}\n"
-}
-
-# int KV_to_int(string)
-#
-#    Convert a string type kernel version (2.4.0) to an int (132096)
-#    for easy compairing or versions ...
-#
-KV_to_int() {
-    [ -z "$1" ] && return 1
-
-    local KV_MAJOR="$(KV_major "$1")"
-    local KV_MINOR="$(KV_minor "$1")"
-    local KV_MICRO="$(KV_micro "$1")"
-    local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-    # We make version 2.2.0 the minimum version we will handle as
-    # a sanity check ... if its less, we fail ...
-    if [ "${KV_int}" -ge 131584 ] ; then
-        printf "${KV_int}\n"
-        return 0
-    fi
-
-    return 1
-}
-
-# int get_KV()
-#
-#    Return the kernel version (major, minor and micro concated) as an integer.
-#    Assumes X and Y of X.Y.Z are numbers.  Also assumes that some leading
-#    portion of Z is a number.
-#    e.g. 2.4.25, 2.6.10, 2.6.4-rc3, 2.2.40-poop, 2.0.15+foo
-#
-get_KV() {
-    local KV="$(uname -r)"
-
-    printf "$(KV_to_int "${KV}")\n"
-
-    return $?
-}
-
 # bool get_bootparam(param)
 #
 #   return 0 if gentoo=param was passed to the kernel
@@ -561,50 +488,6 @@ get_bootparam() {
     return ${retval}
 }
 
-# Safer way to list the contents of a directory,
-# as it do not have the "empty dir bug".
-#
-# char *dolisting(param)
-#
-#    print a list of the directory contents
-#
-#    NOTE: quote the params if they contain globs.
-#          also, error checking is not that extensive ...
-#
-dolisting() {
-    local x=
-    local y=
-    local tmpstr=
-    local mylist=
-    local mypath="$*"
-
-    if [ "${mypath%/\*}" != "${mypath}" ]
-    then
-        mypath="${mypath%/\*}"
-    fi
-
-    for x in ${mypath}
-    do
-        [ ! -e "${x}" ] && continue
-
-        if [ ! -d "${x}" ] && ( [ -L "${x}" -o -f "${x}" ] )
-        then
-            mylist="${mylist} $(ls "${x}" 2> /dev/null)"
-        else
-            [ "${x%/}" != "${x}" ] && x="${x%/}"
-
-            cd "${x}"; tmpstr="$(ls)"
-
-            for y in ${tmpstr}
-            do
-                mylist="${mylist} ${x}/${y}"
-            done
-        fi
-    done
-
-    printf "${mylist}\n"
-}
-
 # char *add_suffix(char * configfile)
 #
 #    Returns a config file name with the softlevel suffix