Codebase list debian-goodies / 380e65d
Exit proper error message when apt-get is failing (Closes: #714964) Javier Fernandez-Sanguino 8 years ago
1 changed file(s) with 20 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
3131 # Version of debmany
3232 version=1.5
3333
34 errormsg()
35 {
36 # show message
37 echo "ERROR: $*" >&2
38 if [ "$cmd" = "zenity" ]
39 then
40 $cmd --error --text="$*"
41 fi
42 }
43
3444 error()
3545 {
3646 # show errorcode and quit
37 echo "ERROR: $*" >&2
38 if [ "$cmd" = "zenity" ]
39 then
40 $cmd --error --text="$*"
41 fi
47 errormsg $*
4248 exit 1
4349 }
4450
242248
243249 if [ -z "$file" ]
244250 then
245 debug "Mode3: Determining the path of '$package'" # comment
251 debug "Mode3: Determining the path of '$package' using 'apt-get -q2 --print-uris --reinstall install'" # comment
246252 aptdata=`apt-get -q2 --print-uris --reinstall install "$package" 2>/dev/null | grep "$package"_`
247253 if [ -z "$aptdata" ]
248254 then
249 error "There is no package called '$package'."
255 errormsg "There was an error looking for package '$package'."
256 apt-get -q2 --print-uris --reinstall install "dpkg" 2>&1 >/dev/null
257 if [ $? -eq 0 ] ; then
258 error "The package does not exist."
259 else
260 error "Apt-get might not be working properly Possible failure when running 'apt-get -q2 --print-uris --reinstall install \"$package\"'"
261 fi
262 # Note: We do not get here, error() exits before
250263 exit 1
251264 fi
252265