[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lsb-base



Le Ven 22 Juillet 2005 11:14, Thomas Hood a écrit :
> I have a couple of initscripts that print progress messages and I do
> not want to be too hasty in eliminating them so I am thinking of
> doing the following for now:
>
> ...
>
> if [ -r /lib/lsb/init-functions ] ; then
> 	. /lib/lsb/init-functions
> 	print_warning_msg() { log_warning_msg "$*" ; }
> 	print_begin_msg() { log_begin_msg "$*" ; }
> 	print_progress_msg() { : ; }
> 	print_end_msg_and_exit() { log_end_msg "$1" ; exit $1 ; }
> else
> 	print_warning_msg() { echo -n "$*" >&2 ; }
> 	print_begin_msg() { echo -n "$*" ; }
> 	print_progress_msg() { echo -n " $*" ; }
> 	print_end_msg_and_exit() { case "$1" in (0) echo "${2}." ;; (*) echo
> "${3}." ;; esac ; exit $1 ; } fi
>
> ...

well, it seems complicated, why don't you fake the lsb-base names ? like 
it :

###
### fake lsb
###

if [ -r /lib/lsb/init-functions ] ; then
    . /lib/lsb/init-functions
else
    log_warning_msg () { echo -n "$*" &>2; }
    log_begin_msg ()   { echo -n "$*"; }
    log_progress_msg() { echo -n "$*"; }
    // put here what you need
fi

###
### my functions
###

print_end_msg_and_exit() { log_end_msg "$1" ; exit $1 ; }


it seems simple, does it ?

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpDhk9tCXET0.pgp
Description: PGP signature


Reply to: