openmamba-netsrpms: fix messages in case of installation error or already installed

This commit is contained in:
Silvan Calarco 2018-07-18 17:37:32 +02:00
parent 2d7a50a044
commit fa4c63e9af

View File

@ -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-2017 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (C) 2003-2018 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>
@ -37,10 +37,8 @@ Options:
fi fi
function check_if_already_installed() { function check_if_already_installed() {
rpm -q $1 &>/dev/null rpm -q $1-$2 &>/dev/null
if [ $? -eq 0 ]; then return $?
notify-send -a $"Network software installation" -i $icon "$pckname" "$pckname: "$"already installed."
fi
} }
declare -A SRPMVERSION SRPMRELEASE declare -A SRPMVERSION SRPMRELEASE
@ -128,7 +126,7 @@ for pckname in $PACKAGES; do
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo "$me: "$"error rebuilding \`$pckname'."" "$"Aborting..." >&2 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 exit 255
fi fi
RPM_PATH=`find $tmpdir -name \*.rpm` RPM_PATH=`find $tmpdir -name \*.rpm`
@ -140,7 +138,12 @@ for pckname in $PACKAGES; do
pkcon install-local -y $RPM_PATH pkcon install-local -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
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 exit 255
fi fi