openmamba-netsrpms: added -f option to force package reinstallation
This commit is contained in:
parent
a8672f6db8
commit
0b5540707d
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# netsrpm-install.sh - Build srpms that download sources from network
|
# netsrpm-install.sh - Build srpms that download sources from network
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (C) 2003-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
# Copyright (C) 2005 by Massimo Pintore <massimo.pintore@qilinux.it>
|
# Copyright (C) 2005 by Massimo Pintore <massimo.pintore@qilinux.it>
|
||||||
# Copyright (C) 2005-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
# Copyright (C) 2005-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
||||||
|
|
||||||
@ -13,7 +13,10 @@ rpmdir=$(rpm --eval=%{_rpmdir} 2>/dev/null)
|
|||||||
while [ "$1" ]; do
|
while [ "$1" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c) CHECK_MODE=1 ;;
|
-c) CHECK_MODE=1 ;;
|
||||||
|
-f) FORCE_MODE=1 ;;
|
||||||
-u) UPGRADE_MODE=1 ;;
|
-u) UPGRADE_MODE=1 ;;
|
||||||
|
-h|--help) PACKAGES= ; break ;;
|
||||||
|
-*) echo "Error: invalid option $1; aborting."; exit 1 ;;
|
||||||
*) PACKAGES="$PACKAGES $1"
|
*) PACKAGES="$PACKAGES $1"
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
@ -21,9 +24,11 @@ done
|
|||||||
|
|
||||||
if [ -z "$PACKAGES" ]; then
|
if [ -z "$PACKAGES" ]; then
|
||||||
echo "Usage:
|
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)
|
-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
|
-u: only upgrade if already installed
|
||||||
"
|
"
|
||||||
exit 255
|
exit 255
|
||||||
@ -125,6 +130,9 @@ for pckname in $PACKAGES; do
|
|||||||
RPM_PATH=`find $tmpdir -name \*.rpm`
|
RPM_PATH=`find $tmpdir -name \*.rpm`
|
||||||
|
|
||||||
# install rpm
|
# install rpm
|
||||||
|
if [ "$FORCE_MODE" = "1" ]; then
|
||||||
|
sudo smart remove -y $pckname
|
||||||
|
fi
|
||||||
sudo smart install -y $RPM_PATH
|
sudo smart install -y $RPM_PATH
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
echo "$me: "$"error installing \`$RPM_PATH'."" "$"Aborting..." >&2
|
echo "$me: "$"error installing \`$RPM_PATH'."" "$"Aborting..." >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user