summary refs log tree commit diff
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2016-09-13 13:52:07 +0300
committerTuomas Tynkkynen <tuomas@tuxera.com>2016-09-13 17:06:13 +0300
commitb4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a (patch)
tree9c10af8b86593a446e35fd4194da86b4efa2acdb
parent246bd302ece734cc0f7f26fa14b72fb9edfdc084 (diff)
downloadnixpkgs-b4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a.tar
nixpkgs-b4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a.tar.gz
nixpkgs-b4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a.tar.bz2
nixpkgs-b4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a.tar.lz
nixpkgs-b4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a.tar.xz
nixpkgs-b4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a.tar.zst
nixpkgs-b4a4a63cc4ed8ebd8c1fbbfb3b89a408e907045a.zip
kernel generate-config.pl: Properly support string options
Or we get something like:

option not set correctly: NLS_DEFAULT (wanted 'utf8', got '"utf8"')
-rw-r--r--pkgs/os-specific/linux/kernel/generate-config.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl
index 3cf1dc34baa..5574cc937af 100644
--- a/pkgs/os-specific/linux/kernel/generate-config.pl
+++ b/pkgs/os-specific/linux/kernel/generate-config.pl
@@ -124,7 +124,10 @@ my %config;
 open CONFIG, "<.config" or die;
 while (<CONFIG>) {
     chomp;
-    if (/^CONFIG_([A-Za-z0-9_]+)=(.*)$/) {
+    if (/^CONFIG_([A-Za-z0-9_]+)="(.*)"$/) {
+        # String options have double quotes, e.g. 'CONFIG_NLS_DEFAULT="utf8"' and allow escaping.
+        ($config{$1} = $2) =~ s/\\([\\"])/$1/g;
+    } elsif (/^CONFIG_([A-Za-z0-9_]+)=(.*)$/) {
         $config{$1} = $2;
     } elsif (/^# CONFIG_([A-Za-z0-9_]+) is not set$/) {
         $config{$1} = "n";