Merge pull request #49354 from aanderse/fstab-escaping
filesystems: escape spaces in fstab with \040
This commit is contained in:
commit
b2099d21cf
|
@ -230,6 +230,8 @@ in
|
||||||
let
|
let
|
||||||
fsToSkipCheck = [ "none" "bindfs" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" "glusterfs" ];
|
fsToSkipCheck = [ "none" "bindfs" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" "glusterfs" ];
|
||||||
skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck;
|
skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck;
|
||||||
|
# https://wiki.archlinux.org/index.php/fstab#Filepath_spaces
|
||||||
|
escape = string: builtins.replaceStrings [ " " ] [ "\\040" ] string;
|
||||||
in ''
|
in ''
|
||||||
# This is a generated file. Do not edit!
|
# This is a generated file. Do not edit!
|
||||||
#
|
#
|
||||||
|
@ -238,10 +240,10 @@ in
|
||||||
|
|
||||||
# Filesystems.
|
# Filesystems.
|
||||||
${concatMapStrings (fs:
|
${concatMapStrings (fs:
|
||||||
(if fs.device != null then fs.device
|
(if fs.device != null then escape fs.device
|
||||||
else if fs.label != null then "/dev/disk/by-label/${fs.label}"
|
else if fs.label != null then "/dev/disk/by-label/${escape fs.label}"
|
||||||
else throw "No device specified for mount point ‘${fs.mountPoint}’.")
|
else throw "No device specified for mount point ‘${fs.mountPoint}’.")
|
||||||
+ " " + fs.mountPoint
|
+ " " + escape fs.mountPoint
|
||||||
+ " " + fs.fsType
|
+ " " + fs.fsType
|
||||||
+ " " + builtins.concatStringsSep "," fs.options
|
+ " " + builtins.concatStringsSep "," fs.options
|
||||||
+ " 0"
|
+ " 0"
|
||||||
|
|
Loading…
Reference in a new issue