Transform exit handlers of the form
trap cleanup EXIT [INT] [TERM] [QUIT] [HUP] [ERR]
(where cleanup is idempotent)
to
trap cleanup EXIT
This fixes a common bash antipattern.
Each of the above signals causes the script to exit. For each signal,
bash first handles the signal by running `cleanup` and then runs
`cleanup` again when handling EXIT.
(Exception: `vscode/*` prevents the second run of `cleanup` by removing
the trap in cleanup`).
Simplify the cleanup logic by just trapping exit, which is always run
when the script exits due to any of the above signals.
Note: In case of borgbackup, the exit handler is not idempotent, but just
trapping EXIT guarantees that it's only run once.
* maintainers/scripts/rebuild-amount.sh: report parallelism setting
This slightly helps discovering parallelism support.
* maintainers/scripts/rebuild-amount.sh: add basic example
It's not clear if script should be used against HEAD or HEAD^.
Let's have a copyable example.
* maintainers/scripts/rebuild-amount.sh: convert tabs to four spaces
One notable change is here-document conversion.
Before:
<TAB>cat <<-FOO
<TAB>...
<TAB>FOO
After:
<sp><sp><sp><sp>cat <<FOO
<sp><sp><sp><sp>...
FOO
Note seemingly misaligned 'FOO': '-FOO' understands leading tabs,
but not spaces.