mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-08 04:04:06 +01:00
nixos/swap: resolve shellcheck warnings
And enable `enableStrictShellChecks` to ensure it stays that way.
This commit is contained in:
parent
7975df2bbb
commit
0fc9a4dc80
1 changed files with 2 additions and 1 deletions
|
|
@ -297,7 +297,7 @@ in
|
|||
${lib.optionalString (sw.size != null) ''
|
||||
currentSize=$(( $(stat -c "%s" "$DEVICE" 2>/dev/null || echo 0) / 1024 / 1024 ))
|
||||
if [[ ! -b "$DEVICE" && "${toString sw.size}" != "$currentSize" ]]; then
|
||||
if [[ $(stat -f -c %T "$(dirname "$DEVICE")") == "btrfs" ]]; then
|
||||
if [[ "$(stat -f -c %T "$(dirname "$DEVICE")")" == "btrfs" ]]; then
|
||||
# Use btrfs mkswapfile to speed up the creation of swapfile.
|
||||
rm -f "$DEVICE"
|
||||
btrfs filesystem mkswapfile --size "${toString sw.size}M" --uuid clear "$DEVICE"
|
||||
|
|
@ -331,6 +331,7 @@ in
|
|||
mkswap ${sw.realDevice}
|
||||
''}
|
||||
'';
|
||||
enableStrictShellChecks = true;
|
||||
|
||||
unitConfig.RequiresMountsFor = [ "${dirOf sw.device}" ];
|
||||
unitConfig.DefaultDependencies = false; # needed to prevent a cycle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue