diff --git a/module/scripts/worker.sh b/module/scripts/worker.sh index cc63ee9..dee15e3 100644 --- a/module/scripts/worker.sh +++ b/module/scripts/worker.sh @@ -1605,7 +1605,7 @@ restore() { # install APKs (decompress to /data/local/tmp, never leave raw behind) prog 25 installing "$PKG" TMP=/data/local/tmp/vdb.$$; mkdir -p "$TMP" - verifier_off + [ "${IN_BATCH:-0}" = 1 ] || verifier_off # a batch turns it off once in the parent (see restore_batch) RINST="$("$JQ" -r '.package.installer // empty' "$M" 2>/dev/null)" SESSION=""; want_item apk && SESSION="$(fw pm install-create $(pm_install_flags) $(installer_flag "$RINST") --user "$U" 2>/dev/null | sed -n 's/.*\[\([0-9]*\)\].*/\1/p')" if [ -n "$SESSION" ]; then @@ -2612,6 +2612,9 @@ restore_batch() { _base="$ARGS"; IN_BATCH=1; BATCH_I=0; _bok=0; _bfail=0; _bcodes="" _bu="$(jget "$_base" '.user // 0')"; case "$_bu" in ''|*[!0-9]*) _bu=0 ;; esac _BTO="$(cfg .batch_app_timeout)"; case "$_BTO" in ''|null|*[!0-9]*) _BTO=1800 ;; esac + # the verifier is switched off here, once, and put back by the parent: a subshell runs no + # EXIT trap, so per-item verifier_off would save "0" as the old value and never restore it. + verifier_off # each restore runs in a SUBSHELL (fds / shell state reclaimed per item) and reports back # through a status file; failure codes are tallied so a partial names why (issue #5, as backup). while IFS= read -r _r <&3; do @@ -2624,7 +2627,7 @@ restore_batch() { [ "$_lok" = true ] || _lok=false; [ -n "$_lcode" ] || _lcode=ERR_UNKNOWN if [ "$_lok" = true ]; then _bok=$((_bok + 1)); else _bfail=$((_bfail + 1)); _bcodes="$_bcodes $_lcode"; fi done 3< "$_lst" - rm -f "$_lst" "$_rcf"; ARGS="$_base"; IN_BATCH=0 + rm -f "$_lst" "$_rcf"; ARGS="$_base"; IN_BATCH=0; verifier_restore _bfails="$(printf '%s\n' $_bcodes | "$JQ" -R -s -c 'split("\n")|map(select(length>0))|group_by(.)|map({key:.[0],value:length})|from_entries' 2>/dev/null)" case "$_bfails" in ''|null) _bfails='{}' ;; esac _bfree="$(fs_free "$(backups_dir "$_bu")" 2>/dev/null)"; case "$_bfree" in ''|*[!0-9]*) _bfree=0 ;; esac