diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-10-30 12:01:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-30 12:01:05 +0000 |
commit | 7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2 (patch) | |
tree | d07370cf304aa699dcdf2880ce5f77fab5e729a3 /nixos/modules | |
parent | b4a443d8199a2ab4793da80f5b71fd48f1c6436c (diff) | |
parent | 3e93e2445ab48d167d27cf0d45f684cb0a389810 (diff) | |
download | nixpkgs-7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2.tar nixpkgs-7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2.tar.gz nixpkgs-7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2.tar.bz2 nixpkgs-7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2.tar.lz nixpkgs-7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2.tar.xz nixpkgs-7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2.tar.zst nixpkgs-7f11b9b46bf4693acc2d94a04b2b59ea239c4cc2.zip |
Merge master into staging-next
Diffstat (limited to 'nixos/modules')
-rwxr-xr-x | nixos/modules/system/activation/switch-to-configuration.pl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index b3ff3ac0abf..e2f66a287bc 100755 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -22,6 +22,7 @@ use JSON::PP; use IPC::Cmd; use Sys::Syslog qw(:standard :macros); use Cwd qw(abs_path); +use Fcntl ':flock'; ## no critic(ControlStructures::ProhibitDeepNests) ## no critic(ErrorHandling::RequireCarping) @@ -91,6 +92,8 @@ if (!-f "/etc/NIXOS" && (read_file("/etc/os-release", err_mode => "quiet") // "" } make_path("/run/nixos", { mode => oct(755) }); +open(my $stc_lock, '>>', '/run/nixos/switch-to-configuration.lock') or die "Could not open lock - $!"; +flock($stc_lock, LOCK_EX) or die "Could not acquire lock - $!"; openlog("nixos", "", LOG_USER); # Install or update the bootloader. @@ -985,4 +988,5 @@ if ($res == 0) { syslog(LOG_ERR, "switching to system configuration $toplevel failed (status $res)"); } +close($stc_lock) or die "Could not close lock - $!"; exit($res); |