3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules
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
..
config Merge pull request #179204 from jtojnar/no-gtk-xdg-use-portal 2022-06-29 14:24:43 +02:00
hardware maintainers: remove volth 2022-06-29 00:52:12 +02:00
i18n/input-method Merge pull request #174218 from NickCao/fcitx5-qt6 2022-06-11 16:20:20 +00:00
installer nixos-generate-config: detect parallels virtualization 2022-06-29 16:01:08 +02:00
misc nixos/ids: fix typo in comment 2022-06-28 11:58:47 +00:00
profiles nixos/i18n: don't build all supportedLocales by default 2022-06-11 23:29:29 +02:00
programs nixos/xfconf: init 2022-06-26 14:29:01 -03:00
security Revert "nixos/security/wrappers: use an assertion for the existence check" 2022-06-12 15:38:05 -05:00
services treewide: fix bash exit handlers 2022-07-02 16:13:12 +02:00
system nixos/systemd: use cfg.package in systemPackages to avoid confusion 2022-06-09 22:44:28 +02:00
tasks nixos/networkd: add IPv6PrivacyExtensions=kernel for default networks 2022-06-21 17:12:01 +02:00
testing nixos/version: Warn about using the default of system.stateVersion 2022-05-05 12:22:31 +02:00
virtualisation Merge pull request #176146 from pennae/module-docs-markdown 2022-06-21 13:16:02 +02:00
module-list.nix Merge pull request #175335 from wyndon/init-lokinet 2022-07-01 11:54:38 +02:00
rename.nix riak, nixos/riak: remove 2022-06-25 15:51:18 -04:00