Merge pull request #785 from nix-community/smaller-fixes

Fix shellcheck for mounoptions with commas + escape filesystem args
This commit is contained in:
Jörg Thalheim authored and GitHub committed 2024-09-20 15:23:44 +02:00
commit 0fe779905f
4 files changed
+14 -4

No files matched your search

+7 -1
View File
@@ -23,6 +23,13 @@
type = "filesystem"; type = "filesystem";
format = "f2fs"; format = "f2fs";
mountpoint = "/"; mountpoint = "/";
extraArgs = [
"-O"
"extra_attr,inode_checksum,sb_checksum,compression"
];
mountOptions = [
"compress_algorithm=zstd:6,compress_chksum,atgc,gc_merge,lazytime,nodiscard"
];
}; };
}; };
}; };
@@ -31,4 +38,3 @@
}; };
}; };
} }
+2
View File
@@ -93,6 +93,8 @@
cache = [ "cache" ]; cache = [ "cache" ];
}; };
}; };
# Workaround: cannot import 'zroot': I/O error in disko tests
options.cachefile = "none";
rootFsOptions = { rootFsOptions = {
compression = "zstd"; compression = "zstd";
+3 -1
View File
@@ -261,7 +261,9 @@ let
interpreter = if noDeps then "/usr/bin/env bash" else "${pkgs.bash}/bin/bash"; interpreter = if noDeps then "/usr/bin/env bash" else "${pkgs.bash}/bin/bash";
check = lib.optionalString (checked && !pkgs.hostPlatform.isRiscV64 && !pkgs.hostPlatform.isx86_32) (pkgs.writeScript "check" '' check = lib.optionalString (checked && !pkgs.hostPlatform.isRiscV64 && !pkgs.hostPlatform.isx86_32) (pkgs.writeScript "check" ''
set -efu set -efu
${pkgs.shellcheck}/bin/shellcheck -e SC2034 "$1" # SC2054: our toShellVars function doesn't quote list elements with commas
# SC2034: We don't use all variables exported by hooks.
${pkgs.shellcheck}/bin/shellcheck -e SC2034,SC2054 "$1"
''); '');
}; };
+2 -2
View File
@@ -46,7 +46,7 @@
default = '' default = ''
if ! (blkid '${config.device}' | grep -q 'TYPE='); then if ! (blkid '${config.device}' | grep -q 'TYPE='); then
mkfs.${config.format} \ mkfs.${config.format} \
${toString config.extraArgs} \ ${lib.escapeShellArgs config.extraArgs} \
${config.device} ${config.device}
fi fi
''; '';
@@ -58,7 +58,7 @@
if ! findmnt ${config.device} "${rootMountPoint}${config.mountpoint}" >/dev/null 2>&1; then if ! findmnt ${config.device} "${rootMountPoint}${config.mountpoint}" >/dev/null 2>&1; then
mount ${config.device} "${rootMountPoint}${config.mountpoint}" \ mount ${config.device} "${rootMountPoint}${config.mountpoint}" \
-t "${config.format}" \ -t "${config.format}" \
${lib.concatMapStringsSep " " (opt: "-o ${opt}") config.mountOptions} \ ${lib.concatMapStringsSep " " (opt: "-o ${lib.escapeShellArg opt}") config.mountOptions} \
-o X-mount.mkdir -o X-mount.mkdir
fi fi
''; '';