commit 38bd4256a1350250b37c853dbf77ee0cce330b1b Author: Jan Pokorný jpokorny@redhat.com Date: Thu Mar 8 14:20:37 2012 +0100
third-party/init.sh: minor cleanup
Signed-off-by: Jan Pokorný jpokorny@redhat.com
third-party/init.sh | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-) --- diff --git a/third-party/init.sh b/third-party/init.sh index ad2dc44..3780389 100755 --- a/third-party/init.sh +++ b/third-party/init.sh @@ -42,7 +42,7 @@ do_del () { }
do_announce () { - # usage: see announce ($1, $3) + [$2 = colour (defaults to 32/green)] + # usage: see announce ($1, $3) + $2=colour # use colours if available if [ "$3" = "delimit" ] && $PRINTED; then echo @@ -50,11 +50,7 @@ do_announce () { PRINTED=true fi if test -t 1; then - colour=$2 - if [ -z "$colour" ]; then - colour=$CLR_USR - fi - echo -en "\033[${colour}m" + echo -en "\033[${2}m" echo -n "$1" echo -e "\033[0m" else @@ -106,8 +102,8 @@ init_register () { }
init_announce () { - # usage: $1=message to output [, $2 = start with extra newline if "delimit")] - do_announce "$1" $CLR_OK $2 + # usage: $1=message to output [, $2=start with extra newline if "delimit")] + do_announce "$1" $CLR_USR $2 }
init_verbosely () { @@ -124,7 +120,7 @@ init_require () { $tester $1 >/dev/null ret=$? [ $ret -eq 0 ] \ - && do_announce "require $1: checked ok" $CLR_OK \ + && do_announce "require $1: checked ok" $CLR_INF \ || do_announce "require $1: not met" $CLR_BAD return $ret } @@ -163,7 +159,6 @@ init_git_submodule () { # usage: $1=action ($1 passed from main), $2..$N=submodule(s) # + optionally, if last arg is a function, it is used # for hooking-in - #local -f get_refresh_hook get_refresh_hook () { pushd "$(git rev-parse --show-toplevel)" >/dev/null # TODO: --recursive seems to be buggy? @@ -208,7 +203,6 @@ init_url_wget () { fi other_params="${@:3}"
- local -f get_refresh_hook get_refresh_hook () { wget --no-verbose --no-clobber --execute robots=off \ --directory-prefix "$toplevel" "$other_params" 2>&1 @@ -234,7 +228,6 @@ init_svn () { rev="--revision $4" fi
- local -f get_refresh_hook get_refresh_hook () { svn checkout --force $rev "$svn" "$toplevel" | grep "revision" }
sunzi-devel@lists.fedorahosted.org