From fa4c63e9af17342afb5c36725ee605bc3e2b22bd Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Wed, 18 Jul 2018 17:37:32 +0200 Subject: [PATCH] openmamba-netsrpms: fix messages in case of installation error or already installed --- openmamba-update/openmamba-netsrpms | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/openmamba-update/openmamba-netsrpms b/openmamba-update/openmamba-netsrpms index f15b194..e93bac0 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-2017 by Silvan Calarco +# Copyright (C) 2003-2018 by Silvan Calarco # Copyright (C) 2005 by Massimo Pintore # Copyright (C) 2005-2007 by Davide Madrisan @@ -37,10 +37,8 @@ Options: fi function check_if_already_installed() { - rpm -q $1 &>/dev/null - if [ $? -eq 0 ]; then - notify-send -a $"Network software installation" -i $icon "$pckname" "$pckname: "$"already installed." - fi + rpm -q $1-$2 &>/dev/null + return $? } declare -A SRPMVERSION SRPMRELEASE @@ -128,7 +126,7 @@ for pckname in $PACKAGES; do if [ $? -gt 0 ]; then echo "$me: "$"error rebuilding \`$pckname'."" "$"Aborting..." >&2 - notify-send -a $"Network software installation" -i $icon "$pckname" $"There was an error installing"" $pckname!" + notify-send -a $"Network software installation" -i $icon "$pckname" $"There was an error building"" $pckname!" exit 255 fi RPM_PATH=`find $tmpdir -name \*.rpm` @@ -140,7 +138,12 @@ for pckname in $PACKAGES; do pkcon install-local -y $RPM_PATH if [ $? -gt 0 ]; then echo "$me: "$"error installing \`$RPM_PATH'."" "$"Aborting..." >&2 - check_if_already_installed $pckname + check_if_already_installed $pckname $SRPM_VERSION + if [ $? -eq 0 ]; then + notify-send -a $"Network software installation" -i $icon "$pckname" "$pckname: "$"already installed." + else + notify-send -a $"Network software installation" -i $icon "$pckname" $"There was an error installing"" $pckname!" + fi exit 255 fi