diff options
author | Erich Eckner <git@eckner.net> | 2020-05-09 07:37:18 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-05-09 07:37:18 +0200 |
commit | a80ee323836c7b9c69ae251ee6cd4e9bd59610b5 (patch) | |
tree | 7a732a266f09c7749b92a59a494a35449c75e7f4 | |
parent | 3c6d2ceb5905ad2a2c24a2443168e1dbeeaa5f2a (diff) | |
download | update-all-a80ee323836c7b9c69ae251ee6cd4e9bd59610b5.tar.xz |
update-me: erneute Chance auch bei preCmds und postCmds geben
-rw-r--r-- | update-me.in | 41 |
1 files 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} |