diff --git a/openmamba-update/openmamba-netsrpms b/openmamba-update/openmamba-netsrpms index 0c992a7..2af99f6 100755 --- a/openmamba-update/openmamba-netsrpms +++ b/openmamba-update/openmamba-netsrpms @@ -2,7 +2,7 @@ # # netsrpm-install.sh - Build srpms that download sources from network # -# Copyright (C) 2003-2012 by Silvan Calarco +# Copyright (C) 2003-2013 by Silvan Calarco # Copyright (C) 2005 by Massimo Pintore # Copyright (C) 2005-2007 by Davide Madrisan @@ -13,7 +13,10 @@ rpmdir=$(rpm --eval=%{_rpmdir} 2>/dev/null) while [ "$1" ]; do case $1 in -c) CHECK_MODE=1 ;; + -f) FORCE_MODE=1 ;; -u) UPGRADE_MODE=1 ;; + -h|--help) PACKAGES= ; break ;; + -*) echo "Error: invalid option $1; aborting."; exit 1 ;; *) PACKAGES="$PACKAGES $1" esac shift @@ -21,9 +24,11 @@ done if [ -z "$PACKAGES" ]; then echo "Usage: -$me [-c] pkgname ... +$me [options...] pkgname ... +Options: -c: only check and exit (returns: 0: up-to-date; 1: needs update; 2: not installed) +-f: force reinstallation if already installed -u: only upgrade if already installed " exit 255 @@ -125,6 +130,9 @@ for pckname in $PACKAGES; do RPM_PATH=`find $tmpdir -name \*.rpm` # install rpm + if [ "$FORCE_MODE" = "1" ]; then + sudo smart remove -y $pckname + fi sudo smart install -y $RPM_PATH if [ $? -gt 0 ]; then echo "$me: "$"error installing \`$RPM_PATH'."" "$"Aborting..." >&2