Revert "sanoid: replace paths with mountpoints"

This reverts commit 32f7869460.
This commit is contained in:
Motiejus Jakštys 2023-01-05 14:59:24 +02:00
parent 0d59d3ae81
commit 604a83cdee
2 changed files with 8 additions and 8 deletions

View File

@ -87,8 +87,8 @@ let ssh_pubkeys = {
autoprune = true; autoprune = true;
post_snapshot_script = "/var/src/snaplink"; post_snapshot_script = "/var/src/snaplink";
}; };
datasets."/home".use_template = [ "prod" ]; datasets."rpool/nixos/home".use_template = [ "prod" ];
datasets."/var".use_template = [ "prod" ]; datasets."rpool/nixos/var".use_template = [ "prod" ];
extraArgs = [ "--verbose" ]; extraArgs = [ "--verbose" ];
}; };

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
snap_path="$SANOID_TARGET/.zfs/snapshot/$SANOID_SNAPNAME" _fatal() { >&2 echo "ERROR: $*"; exit 1; }
[[ -d "$snap_path" ]] || { mountpoint=$(zfs list -H -t filesystem -o mountpoint "$SANOID_TARGET")
>&2 echo "expected to find a directory in $snap_path" [[ -n "$mountpoint" ]] || _fatal "expected non-empty $SANOID_TARGET"
exit 1 snap_path="$mountpoint/.zfs/snapshot/$SANOID_SNAPNAME"
} [[ -d "$snap_path" ]] || _fatal "expected to find a directory in $snap_path"
link_path="$SANOID_TARGET/.snapshot-latest" link_path="$mountpoint/.snapshot-latest"
ln -sf "$snap_path" "$link_path" ln -sf "$snap_path" "$link_path"
>&2 printf "successfully created %s -> %s\n" "$link_path" "$snap_path" >&2 printf "successfully created %s -> %s\n" "$link_path" "$snap_path"