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