Added a debugging and a verbose mode
This commit is contained in:
parent
ca40720609
commit
d06c652d2a
|
@ -19,12 +19,14 @@
|
||||||
|
|
||||||
|
|
||||||
#environment
|
#environment
|
||||||
|
DEBUG=0
|
||||||
DEVNULL="/dev/null"
|
DEVNULL="/dev/null"
|
||||||
|
VERBOSE=0
|
||||||
#executables
|
#executables
|
||||||
CVS="cvs"
|
CVS="_debug cvs"
|
||||||
MAKE="make"
|
MAKE="_debug make"
|
||||||
RM="echo rm -f"
|
RM="_debug rm -f"
|
||||||
TAR="tar"
|
TAR="_debug tar"
|
||||||
TR="tr"
|
TR="tr"
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ deforaos_release()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_info "Obtaining latest version..."
|
_info "Obtaining latest version..."
|
||||||
$CVS up -A > "$DEVNULL"
|
$CVS up -A
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_error "Could not update the sources"
|
_error "Could not update the sources"
|
||||||
return $?
|
return $?
|
||||||
|
@ -57,14 +59,14 @@ deforaos_release()
|
||||||
|
|
||||||
_info "Checking for differences..."
|
_info "Checking for differences..."
|
||||||
#XXX this method may be obsoleted in a future version of CVS
|
#XXX this method may be obsoleted in a future version of CVS
|
||||||
$CVS diff > "$DEVNULL"
|
$CVS diff
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_error "The sources were modified"
|
_error "The sources were modified"
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_info "Creating the archive..."
|
_info "Creating the archive..."
|
||||||
$MAKE dist > $DEVNULL
|
$MAKE dist
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_error "Could not create the archive"
|
_error "Could not create the archive"
|
||||||
return $?
|
return $?
|
||||||
|
@ -73,7 +75,7 @@ deforaos_release()
|
||||||
#check the archive
|
#check the archive
|
||||||
_info "Checking the archive..."
|
_info "Checking the archive..."
|
||||||
archive="$PACKAGE-$VERSION.tar.gz"
|
archive="$PACKAGE-$VERSION.tar.gz"
|
||||||
$TAR -xzf "$archive" > $DEVNULL &&
|
$TAR -xzf "$archive"
|
||||||
(cd "$PACKAGE-$VERSION" && $MAKE)
|
(cd "$PACKAGE-$VERSION" && $MAKE)
|
||||||
res=$?
|
res=$?
|
||||||
$RM -r "$PACKAGE-$VERSION"
|
$RM -r "$PACKAGE-$VERSION"
|
||||||
|
@ -103,6 +105,19 @@ deforaos_release()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#debug
|
||||||
|
_debug()
|
||||||
|
{
|
||||||
|
if [ $DEBUG -eq 1 ]; then
|
||||||
|
echo "$@"
|
||||||
|
elif [ $VERBOSE -eq 0 ]; then
|
||||||
|
"$@" > "$DEVNULL"
|
||||||
|
else
|
||||||
|
"$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#error
|
#error
|
||||||
_error()
|
_error()
|
||||||
{
|
{
|
||||||
|
@ -121,14 +136,22 @@ _info()
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: deforaos-release.sh version" 1>&2
|
echo "Usage: deforaos-release.sh [-Dv] version" 1>&2
|
||||||
|
echo " -D Run in debugging mode" 1>&2
|
||||||
|
echo " -v Verbose mode" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#main
|
#main
|
||||||
while getopts "" name; do
|
while getopts "Dv" name; do
|
||||||
case "$name" in
|
case "$name" in
|
||||||
|
D)
|
||||||
|
DEBUG=1
|
||||||
|
;;
|
||||||
|
v)
|
||||||
|
VERBOSE=1
|
||||||
|
;;
|
||||||
?)
|
?)
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user