X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fgrml%2Flsb-functions;h=5f0f145f01acfe8b6182464f8cf563603d1931af;hb=2eb0a57ff591566506abc54810333d464f10e3a5;hp=d3c8c01229d51fdb600112a21915b2a89d25ade8;hpb=45d8e206efcad56bb8e8324c81565b259ff80b1c;p=grml-etc-core.git diff --git a/etc/grml/lsb-functions b/etc/grml/lsb-functions index d3c8c01..5f0f145 100644 --- a/etc/grml/lsb-functions +++ b/etc/grml/lsb-functions @@ -31,18 +31,18 @@ TPUT="${TPUT:-"/usr/bin/tput"}" -have_tput() { +_have_tput() { [ -x "$TPUT" ] && "$TPUT" hpa 60 >/dev/null 2>&1 \ && return 0 \ || return 1 } -log_success_msg () { +log_success_msg() { printf " * $@\n" } -log_failure_msg () { - if have_tput ; then +log_failure_msg() { + if _have_tput ; then RED="$("$TPUT" setaf 1)" #NORMAL="$("$TPUT" op)" printf " ${RED}*${NORMAL} $@\n" @@ -51,8 +51,8 @@ log_failure_msg () { fi } -log_warning_msg () { - if have_tput ; then +log_warning_msg() { + if _have_tput ; then YELLOW="$("$TPUT" setaf 3)" #NORMAL="$("$TPUT" op")" # printf " *${NORMAL} $@\n" @@ -62,8 +62,8 @@ log_warning_msg () { fi } -log_warning_msg_nn () { - if have_tput ; then +log_warning_msg_nn() { + if _have_tput ; then YELLOW="$("$TPUT" setaf 3)" printf " ${BLUE}*${NORMAL} $@" else @@ -72,14 +72,14 @@ log_warning_msg_nn () { } # int log_begin_message (char *message) -log_begin_msg () { +log_begin_msg() { if [ "$#" -eq 0 ]; then return 1 fi printf " ${GREEN}*${NORMAL} $@\n" } -log_begin_msg_nn () { +log_begin_msg_nn() { if [ "$#" -eq 0 ]; then return 1 fi @@ -90,14 +90,14 @@ log_begin_msg_nn () { SUBMSG=" ${GREEN}-${NORMAL} " # int log_end_message (int exitstatus) -log_end_msg () { +log_end_msg() { # If no arguments were passed, return [ "$#" -eq 0 ] && return 1 # 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 )) @@ -488,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}" ] || [ -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