Merge pull request #164068 from cab404/master
os-release: preserve fields from being excessively quoted
This commit is contained in:
commit
1e49b301b9
|
@ -8,8 +8,12 @@ let
|
||||||
concatStringsSep mapAttrsToList toLower
|
concatStringsSep mapAttrsToList toLower
|
||||||
literalExpression mkRenamedOptionModule mkDefault mkOption trivial types;
|
literalExpression mkRenamedOptionModule mkDefault mkOption trivial types;
|
||||||
|
|
||||||
|
needsEscaping = s: null != builtins.match "[a-zA-Z0-9]+" s;
|
||||||
|
escapeIfNeccessary = s: if needsEscaping s then s else ''"${lib.escape [ "\$" "\"" "\\" "\`" ] s}"'';
|
||||||
attrsToText = attrs:
|
attrsToText = attrs:
|
||||||
concatStringsSep "\n" (mapAttrsToList (n: v: ''${n}="${toString v}"'') attrs);
|
concatStringsSep "\n" (
|
||||||
|
mapAttrsToList (n: v: ''${n}=${escapeIfNeccessary (toString v)}'') attrs
|
||||||
|
);
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue