File tree 3 files changed +13
-0
lines changed
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,7 @@ set -efux -o pipefail
4
4
disk=$( realpath " $1 " )
5
5
6
6
lsblk -a -f >&2
7
+ # since we currently cannot recursively deactivate swaps on zfs volumes, we need to deactivate all of them.
8
+ lsblk --output-all --json | jq -r -f " $( dirname " $0 " ) /zfs-swap-deactivate.jq" | bash -x
7
9
lsblk --output-all --json | jq -r --arg disk_to_clear " $disk " -f " $( dirname " $0 " ) /disk-deactivate.jq" | bash -x
8
10
lsblk -a -f >&2
Original file line number Diff line number Diff line change
1
+ def turnOffSwaps :
2
+ if (.name | test ("^zd[0-9]+$" )) and .type == "disk" then
3
+ "swapoff /dev/" + .name
4
+ else
5
+ []
6
+ end
7
+ ;
8
+
9
+ .blockdevices | map (turnOffSwaps ) | flatten | join ("\n " )
10
+
Original file line number Diff line number Diff line change 71
71
72
72
checkJqSyntax = pkgs . runCommand "check-jq-syntax" { nativeBuildInputs = [ pkgs . jq ] ; } ''
73
73
echo '{ "blockdevices" : [] }' | jq -r -f ${ ./disk-deactivate/disk-deactivate.jq } --arg disk_to_clear foo
74
+ echo '{ "blockdevices" : [] }' | jq -r -f ${ ./disk-deactivate/zfs-swap-deactivate.jq }
74
75
touch $out
75
76
'' ;
76
77
You can’t perform that action at this time.
0 commit comments