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: {
|
serviceMountDeps = serviceName: dirs: pkgs: {
|
||||||
systemd.services."${serviceName}_mounts" =
|
systemd.services."${serviceName}_mounts" =
|
||||||
let
|
let
|
||||||
|
lib = nixpkgs.lib;
|
||||||
zfslistmounted = pkgs.writeShellApplication {
|
zfslistmounted = pkgs.writeShellApplication {
|
||||||
name = "zfslistmounted";
|
name = "zfslistmounted";
|
||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
@ -146,16 +147,11 @@
|
|||||||
gawk
|
gawk
|
||||||
coreutils
|
coreutils
|
||||||
];
|
];
|
||||||
text =
|
text = ''
|
||||||
let
|
#!/bin/sh
|
||||||
lib = nixpkgs.lib;
|
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
|
'';
|
||||||
''
|
|
||||||
#!/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)}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
unitConfig.Wants = "zfs.target";
|
unitConfig.Wants = "zfs.target";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user