Commit Graph

5 Commits

Author SHA1 Message Date
Erik Arvstedt
3f54dfa475
treewide: fix bash exit handlers
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.
2022-07-02 16:13:12 +02:00
aszlig
5e7a1cf955
build-support: Fix nix-prefetch-* on OS X.
Fixes a regression on OS X introduced by f83af95.

Don't use --tmpdir for mktemp, because that flag doesn't exist on OS X.
However, using -t is deprecated in GNU coreutils, so as suggested by
@ip1981 we're now using parameter expansion on ${TMPDIR:-/tmp} to
provide /tmp as a fallback if TMPDIR is not set and use it instead.

Also use this approach for nix-prefetch-cvs now in order to stay
consistent.

Reported-by: Vladimir Kirillov <proger@wilab.org.ua>
Tested-by: Igor Pashev <pashev.igor@gmail.com>
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-08-27 11:22:34 +02:00
Eelco Dolstra
b94af47b86 * Quick hack to support checkout by date.
svn path=/nixpkgs/trunk/; revision=10890
2008-02-28 23:43:21 +00:00
Eelco Dolstra
66738cc356 * fetchcvs: cleanup, use nix-store --add-fixed like fetchurl/svn.
Argument "url" renamed to "cvsRoot" (it's not a URL).

svn path=/nixpkgs/trunk/; revision=10889
2008-02-28 22:36:37 +00:00
Roy van den Broek
9ece10787e Added fetchcvs.
svn path=/nixpkgs/trunk/; revision=5295
2006-05-11 12:36:16 +00:00