revise code to display SVN version; thanks to Mauro Giachero for the suggestion; add a continue when search_package fails to avoid ugly breakage from cli; add in a preliminary check to make sure -b and -i are not used together (I know there is a correct way to test the getopts arguments but this will do until I have more time to spend on it).

This commit is contained in:
chess.griffin 2009-01-12 15:45:28 +00:00
parent 1367d419e7
commit 809e15bf02

View File

@ -46,8 +46,7 @@ INSTALLPKGS=""
BUILDOPTIONS=""
SBOPKG_CONF="${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}"
CWD="$(pwd)"
SBOVER=svn_r$(cat ${0} | grep '$Id: ' | head -1 | \
sed -e 's/^.*Id: sbopkg \([0-9.]*\) .*$/\1/')
SBOVER=svn_r$(grep -m1 '$Id$0 | cut -d " " -f4)
config_check () {
# Check if config file is there and if so check that it has all
@ -968,6 +967,7 @@ if [ ! $(find -type d -mindepth 2 -name "$PKG") ]; then
if [ "$BUILDPKGS" = 1 ]; then
echo "ERROR: Package \"$PKG\" not found" >> $PRECHECKLOG
echo "ERROR: Package \"$PKG\" not found - skipped" >> $SUMMARYLOG
continue
else
if [ "$DIAG" = 1 ]; then
dialog --title "ERROR" --msgbox "Package $PKG not found" 0 0
@ -1890,7 +1890,8 @@ fi
# This is the command line options and help.
while getopts ":b:cd:f:hi:lpq:rs:uv:" OPT; do
case $OPT in
b ) BUILDPKGS=1
b ) BFLAG=1
BUILDPKGS=1
BUILD="$OPTARG"
;;
c ) CHK_UPDATES=1
@ -1899,7 +1900,8 @@ while getopts ":b:cd:f:hi:lpq:rs:uv:" OPT; do
;;
f ) SBOPKG_CONF="$OPTARG"
;;
i ) BUILDPKGS=1
i ) IFLAG=1
BUILDPKGS=1
INSTALLPKGS=1
BUILD="$OPTARG"
;;
@ -1955,6 +1957,13 @@ done
# End of option parsing.
shift $(($OPTIND - 1))
if [[ "$BFLAG" = 1 && "$BUILD" = "i" || "$IFLAG" = 1 && \
"$BUILD" = "b" ]]; then
echo "Error: The -b and -i options cannot be used together."
echo "Please use one or the other. Exiting."
exit 0
fi
# Check for a good config file and set initial variables
config_check