Added a verbose mode

This commit is contained in:
Pierre Pronchery 2012-10-07 19:56:58 +00:00
parent df1b975166
commit 1700f12978

View File

@ -28,6 +28,7 @@ LICENSE=
METHOD= METHOD=
PACKAGE= PACKAGE=
PROJECTCONF="project.conf" PROJECTCONF="project.conf"
VERBOSE=0
VERSION= VERSION=
#executables #executables
CKSUM="cksum" CKSUM="cksum"
@ -724,7 +725,7 @@ _error()
#info #info
_info() _info()
{ {
echo "deforaos-package.sh: $@" 1>&2 [ "$VERBOSE" -ne 0 ] && echo "deforaos-package.sh: $@" 1>&2
return 0 return 0
} }
@ -749,8 +750,9 @@ _size()
#usage #usage
_usage() _usage()
{ {
echo "Usage: deforaos-package.sh [-D][-e e-mail][-i id][-l license][-m method][-n name][-O name=value...] revision" 1>&2 echo "Usage: deforaos-package.sh [-Dv][-e e-mail][-i id][-l license][-m method][-n name][-O name=value...] revision" 1>&2
echo " -D Run in debugging mode" 1>&2 echo " -D Run in debugging mode" 1>&2
echo " -v Verbose mode" 1>&2
return 1 return 1
} }
@ -764,7 +766,7 @@ _warning()
#main #main
#parse options #parse options
while getopts "De:i:l:m:n:O:" name; do while getopts "De:i:l:m:n:O:v" name; do
case "$name" in case "$name" in
D) D)
DEBUG="_debug" DEBUG="_debug"
@ -787,6 +789,9 @@ while getopts "De:i:l:m:n:O:" name; do
O) O)
export "${OPTARG%%=*}"="${OPTARG#*=}" export "${OPTARG%%=*}"="${OPTARG#*=}"
;; ;;
v)
VERBOSE=1
;;
?) ?)
_usage _usage
exit $? exit $?