X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=functions.sh;h=43909786eeff605ffda737f96eaf22950cc24fc8;hb=f92ca6d3e60974b73c375e2a72fa6fd02e7820dc;hp=cd0bdee3178f1ab41a8c52e0d337cb0318d4e9ec;hpb=ea01a241287a74a8a5b3576f6fdda3c801786cb7;p=carnet-tools-cn.git diff --git a/functions.sh b/functions.sh index cd0bdee..4390978 100644 --- a/functions.sh +++ b/functions.sh @@ -1,3 +1,9 @@ +# Initialize "public" CP_ECHO_RETURN variable once +if [ -z "$_CP_INIT_ECHO_RETURN" ]; then + _CP_INIT_ECHO_RETURN=1 + CP_ECHO_RETURN="" +fi + # by ddzeko & ico, Fri, 18 Mar 2005 14:44:08 +0100 cp_get_ifaddr() { [ "$CP_SCRIPT_DEBUG" ] && set -vx @@ -232,7 +238,7 @@ cp_check_and_sed() { fi ret=0 done - [ "$ret" -eq 2 -a "$grepret" ] && ret=1 || true + [ "$ret" -eq 2 -a "$grepret" ] && ret=1 return $ret } @@ -261,8 +267,12 @@ cp_mail () { quiet=1 shift fi - [ -n "$1" ] && pkg="$1" # barf if no package - [ -n "$2" ] && version=" $2" || true + if [ -n "$1" ]; then + pkg="$1" + else + return 1 # must have at least the package name as argument + fi + [ -n "$2" ] && version=" $2" if [ "$(echo $CP_NOTICE|wc -w)" -gt 0 ]; then [ -n "$quiet" ] || echo "Mailing upgrade output to root." CP_NOTICE="From: $pkg postinst script