simplify script
This commit is contained in:
parent
5597fd9c3b
commit
8e829637ac
14
flake.nix
14
flake.nix
@ -138,6 +138,7 @@
|
||||
serviceMountDeps = serviceName: dirs: pkgs: {
|
||||
systemd.services."${serviceName}_mounts" =
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
zfslistmounted = pkgs.writeShellApplication {
|
||||
name = "zfslistmounted";
|
||||
runtimeInputs = with pkgs; [
|
||||
@ -146,16 +147,11 @@
|
||||
gawk
|
||||
coreutils
|
||||
];
|
||||
text =
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
in
|
||||
''
|
||||
#!/bin/sh
|
||||
zfs get mounted | grep yes | awk '{print $1}' | while read -r i; do zfs get mountpoint "$i" | awk 'FNR==2 {print $3}'; done | grep -c '${lib.strings.concatStringsSep "\|" dirs}' | grep -Fq ${toString (lib.length dirs)}
|
||||
'';
|
||||
text = ''
|
||||
#!/bin/sh
|
||||
zfs list -o mountpoint,mounted | awk 'FNR > 1 && $2 == "yes" {print $1}' | grep -c '${lib.strings.concatStringsSep "\|" dirs}' | grep -Fq ${toString (lib.length dirs)}
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
unitConfig.Wants = "zfs.target";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user