From: Valentin Vidic Date: Mon, 31 Mar 2008 09:14:04 +0000 (+0200) Subject: Display dialog notice when an action fails. X-Git-Tag: debian/4.0.1~8 X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=commitdiff_plain;h=3644e9d0594b99d9403add0ac784270dfe3552af;p=carnet-upgrade.git Display dialog notice when an action fails. --- diff --git a/src/functions.sh b/src/functions.sh index 1d83c80..f1fbc02 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -231,8 +231,13 @@ run_actions() { [ "$check" != "true" ] && checkmsg="if '$check'" if eval $check; then log "$(printf 'action %02d' $lineno) starting: '${action}' $checkmsg " - eval $action - log "$(printf 'action %02d' $lineno) finished: '${action}' $checkmsg" + if ! eval $action; then + log "$(printf 'action %02d' $lineno) failed: '${action}' $checkmsg " + display_action_failure "$action" + exit 1 + else + log "$(printf 'action %02d' $lineno) finished: '${action}' $checkmsg" + fi else log "$(printf 'action %02d' $lineno) skipping: '${action}' $checkmsg" fi @@ -242,6 +247,24 @@ run_actions() { log "-----" } +# report action failure +display_action_failure () { + local action=$1 + + notice " +Doslo je do greske prilikom izvrsavanja akcije '$action'. Detalje problema moguce je vidjeti u log datotekama: + + /var/log/carnet-upgrade.log + /var/log/carnet-upgrade.typescript + +Da bi dovrsili zapocete operacije nad paketima pokrenite: + + # dpkg --configure -a + # apt-get -f install + +Nakon toga ponovno pozovite carnet-upgrade skriptu." +} + # funkcija vraca popis paketa koje treba upgradeati what_upgrade () { local IFSOLD name version package