Skip to content

Commit

Permalink
Merge pull request #49835 from Synthetica9/fix-49826
Browse files Browse the repository at this point in the history
nixos-generate-config: fix for swapless kernels
  • Loading branch information
infinisil committed Nov 17, 2018
2 parents 40449fe + ce65df3 commit 5c4ed80
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions nixos/modules/installer/tools/nixos-generate-config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,16 @@ sub findStableDevPath {

# 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\"; }";
}
}


Expand Down

0 comments on commit 5c4ed80

Please sign in to comment.