refactor: Split mkdir -m … into mkdir + chmod

As recommended by ShellCheck
<https://www.shellcheck.net/wiki/SC2174>.
This commit is contained in:
Victor Engmark 2023-06-08 15:07:07 +12:00
parent b0a9abedea
commit 8deaa732a8
2 changed files with 8 additions and 4 deletions

View file

@ -217,7 +217,8 @@ in
''
# Various log/runtime directories.
mkdir -m 1777 -p /var/tmp
mkdir -p /var/tmp
chmod 1777 /var/tmp
# Empty, immutable home directory of many system accounts.
mkdir -p /var/empty
@ -231,7 +232,8 @@ in
system.activationScripts.usrbinenv = if config.environment.usrbinenv != null
then ''
mkdir -m 0755 -p /usr/bin
mkdir -p /usr/bin
chmod 0755 /usr/bin
ln -sfn ${config.environment.usrbinenv} /usr/bin/.env.tmp
mv /usr/bin/.env.tmp /usr/bin/env # atomically replace /usr/bin/env
''
@ -251,7 +253,8 @@ in
if mountpoint -q "$mountPoint"; then
local options="remount,$options"
else
mkdir -m 0755 -p "$mountPoint"
mkdir -p "$mountPoint"
chmod 0755 "$mountPoint"
fi
mount -t "$fsType" -o "$options" "$device" "$mountPoint"
}

View file

@ -317,7 +317,8 @@ in {
environment.etc."binfmt.d/nixos.conf".source = builtins.toFile "binfmt_nixos.conf"
(lib.concatStringsSep "\n" (lib.mapAttrsToList makeBinfmtLine config.boot.binfmt.registrations));
system.activationScripts.binfmt = stringAfter [ "specialfs" ] ''
mkdir -p -m 0755 /run/binfmt
mkdir -p /run/binfmt
chmod 0755 /run/binfmt
${lib.concatStringsSep "\n" (lib.mapAttrsToList activationSnippet config.boot.binfmt.registrations)}
'';
systemd = lib.mkIf (config.boot.binfmt.registrations != {}) {