From a80ee323836c7b9c69ae251ee6cd4e9bd59610b5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 9 May 2020 07:37:18 +0200 Subject: update-me: erneute Chance auch bei preCmds und postCmds geben --- update-me.in | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/update-me.in b/update-me.in index 5b80572..7112311 100644 --- a/update-me.in +++ b/update-me.in @@ -105,6 +105,19 @@ exit_or_rescue_shell() { exit "$1" } +nochmal_versuchen() { + >&2 printf '%s (%s): Fehler - nochmal versuchen?\n' "$(hostname)" "${cmd}" + while read -t 0.0001; do + : + done + read s + if [ -n "${s}" ]; then + return 1 + else + return 0 + fi +} + . #ETCDIR#/update-me.conf if ! command -v sudo >/dev/null; then @@ -155,6 +168,15 @@ do eval ${cmd} fi err=$? + while [ ${err} -ne 0 ] && nochmal_versuchen; do + if [ -z "${cmd%%check-kernel*}" ] \ + || [ -z "${cmd%%mount*}" ]; then + eval ${pre} ${cmd} + else + eval ${cmd} + fi + err=$? + done if [ ${err} -ne 0 ] then exit_or_rescue_shell ${err} @@ -165,15 +187,7 @@ for cmd in "${cmds[@]}" do eval ${pre} ${cmd} err=$? - while [ ${err} -ne 0 ]; do - >&2 printf '%s (%s): Fehler - nochmal versuchen?\n' "$(hostname)" "${cmd}" - while read -t 0.0001; do - : - done - read s - if [ -n "${s}" ]; then - break - fi + while [ ${err} -ne 0 ] && nochmal_versuchen; do eval ${pre} ${cmd} err=$? done @@ -193,6 +207,15 @@ do eval ${cmd} fi err=$? + while [ ${err} -ne 0 ] && nochmal_versuchen; do + if [ -z "${cmd%%check-kernel*}" ] \ + || [ -z "${cmd%%mount*}" ]; then + eval ${pre} ${cmd} + else + eval ${cmd} + fi + err=$? + done if [ ${err} -ne 0 ] then exit_or_rescue_shell ${err} -- cgit v1.2.3-70-g09d2