diff --git a/debmany/debmany b/debmany/debmany index 2984a04..8855574 100755 --- a/debmany/debmany +++ b/debmany/debmany @@ -32,14 +32,20 @@ # Version of debmany version=1.5 +errormsg() +{ + # show message + echo "ERROR: $*" >&2 + if [ "$cmd" = "zenity" ] + then + $cmd --error --text="$*" + fi +} + error() { # show errorcode and quit - echo "ERROR: $*" >&2 - if [ "$cmd" = "zenity" ] - then - $cmd --error --text="$*" - fi + errormsg $* exit 1 } @@ -243,11 +249,18 @@ if [ -z "$file" ] then - debug "Mode3: Determining the path of '$package'" # comment + debug "Mode3: Determining the path of '$package' using 'apt-get -q2 --print-uris --reinstall install'" # comment aptdata=`apt-get -q2 --print-uris --reinstall install "$package" 2>/dev/null | grep "$package"_` if [ -z "$aptdata" ] then - error "There is no package called '$package'." + errormsg "There was an error looking for package '$package'." + apt-get -q2 --print-uris --reinstall install "dpkg" 2>&1 >/dev/null + if [ $? -eq 0 ] ; then + error "The package does not exist." + else + error "Apt-get might not be working properly Possible failure when running 'apt-get -q2 --print-uris --reinstall install \"$package\"'" + fi + # Note: We do not get here, error() exits before exit 1 fi