refactor(script): Put ZFS property in a variable (#1)
This commit is contained in:
parent
204a2a49b1
commit
562ffbdc0f
@ -31,7 +31,8 @@ snap_op_remove_suffix="${snap_op_remove_suffix:-rmvl}"
|
||||
snap_op_upgrade_suffix="${snap_op_upgrade_suffix:-upgr}"
|
||||
|
||||
# Internal
|
||||
declare pkg_separator max_zfs_snapshot_name_length color_reset color_lyellow color_red
|
||||
declare zfs_prop pkg_separator max_zfs_snapshot_name_length color_reset color_lyellow color_red
|
||||
zfs_prop='space.quico:auto-snapshot'
|
||||
pkg_separator=':'
|
||||
max_zfs_snapshot_name_length='255'
|
||||
color_reset='\e[0m'
|
||||
@ -95,12 +96,12 @@ function set_severity () {
|
||||
|
||||
function get_globally_snappable_datasets () {
|
||||
local datasets_list
|
||||
# For all datasets show their 'space.quico:auto-snapshot' property; only
|
||||
# print dataset name in column 1 and property value in column 2. In awk
|
||||
# limit this list to datasets where tab-delimited column 2 has exact
|
||||
# string '^true$' then further limit output by eliminating snapshots
|
||||
# from list, i.e. dataset names that contain an '@' character.
|
||||
datasets_list="$(zfs get -H -o 'name,value' 'space.quico:auto-snapshot' | \
|
||||
# For all datasets show their "${zfs_prop}" property; only print dataset
|
||||
# name in column 1 and property value in column 2. In awk limit this
|
||||
# list to datasets where tab-delimited column 2 has exact string
|
||||
# '^true$' then further limit output by eliminating snapshots from list,
|
||||
# i.e. dataset names that contain an '@' character.
|
||||
datasets_list="$(zfs get -H -o 'name,value' "${zfs_prop}" | \
|
||||
awk -F'\t' '{if($2 ~ /^true$/ && $1 !~ /@/) print $1}')"
|
||||
while IFS= read -u10 -r dataset; do
|
||||
globally_snappable_datasets+=("${dataset}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user