diff options
author | Silvan Mosberger <infinisil@icloud.com> | 2018-11-17 02:53:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-17 02:53:43 +0100 |
commit | 5c4ed80ad7b7dc080dfc8563c2407972f5576bc7 (patch) | |
tree | 598f4055fd8da76ad0ca93b99309782c6385c3fe /nixos/modules/installer | |
parent | 40449fe1aeda930d95a424e3d02507a77bdf2544 (diff) | |
parent | ce65df3a3643706f27ed21fecf973ce0600ed386 (diff) | |
download | nixlib-5c4ed80ad7b7dc080dfc8563c2407972f5576bc7.tar nixlib-5c4ed80ad7b7dc080dfc8563c2407972f5576bc7.tar.gz nixlib-5c4ed80ad7b7dc080dfc8563c2407972f5576bc7.tar.bz2 nixlib-5c4ed80ad7b7dc080dfc8563c2407972f5576bc7.tar.lz nixlib-5c4ed80ad7b7dc080dfc8563c2407972f5576bc7.tar.xz nixlib-5c4ed80ad7b7dc080dfc8563c2407972f5576bc7.tar.zst nixlib-5c4ed80ad7b7dc080dfc8563c2407972f5576bc7.zip |
Merge pull request #49835 from Synthetica9/fix-49826
nixos-generate-config: fix for swapless kernels
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index b70faa380e54..52a129b39bcd 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -314,14 +314,16 @@ push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDr # Generate the swapDevices option from the currently activated swap # devices. -my @swaps = read_file("/proc/swaps"); -shift @swaps; +my @swaps = read_file("/proc/swaps", err_mode => 'carp'); my @swapDevices; -foreach my $swap (@swaps) { - $swap =~ /^(\S+)\s/; - next unless -e $1; - my $dev = findStableDevPath $1; - push @swapDevices, "{ device = \"$dev\"; }"; +if (@swaps) { + shift @swaps; + foreach my $swap (@swaps) { + $swap =~ /^(\S+)\s/; + next unless -e $1; + my $dev = findStableDevPath $1; + push @swapDevices, "{ device = \"$dev\"; }"; + } } |