File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # https://editorconfig.org
2+
3+ root = true
4+
5+ [* ]
6+ charset = utf-8
7+ end_of_line = lf
8+ indent_style = space
9+ insert_final_newline = true
10+ trim_trailing_whitespace = true
11+
12+ [.gitattributes ]
13+ indent_size = 16
14+
15+ [* .{diff,patch} ]
16+ end_of_line = lf
17+ trim_trailing_whitespace = false
18+
19+ [Makefile* ]
20+ indent_size = 4
21+ indent_style = tab
22+
23+ [* .bash ]
24+ end_of_line = lf
25+ indent_size = 2
26+
27+ [* .{js,json} ]
28+ indent_size = 2
29+
30+ [* .md ]
31+ indent_size = 2
32+ trim_trailing_whitespace = false
Original file line number Diff line number Diff line change 1+ # CAUTION:
2+ # Always run the following command after adding/editing an
3+ # `eol` entry:
4+ #
5+ # git add --renormalize FILES_WITH_AFFECTED_EXTENSION
6+ #
7+ # This keeps existing files consistent with the new setting.
8+ #
9+ # Example:
10+ #
11+ # git add --renormalize '*.foo' '*.bar'
12+
13+ .editorconfig text eol =lf
14+ .gitattributes text eol =lf
15+
16+ # LF required for interactive patching as of Git 2.17.1
17+ * .diff text eol =lf
18+ * .patch text eol =lf
19+
20+ Makefile * text eol =lf
21+
22+ # LF required to allow shell scripts to run
23+ * .bash text eol =lf
24+
25+ * .json text eol =lf
26+ * .md text eol =lf
Original file line number Diff line number Diff line change 1+ {
2+ "recommendations" : [
3+ " editorconfig.editorconfig" ,
4+ " timonwong.shellcheck"
5+ ]
6+ }
Original file line number Diff line number Diff line change 1+ {
2+ "files.exclude" : {
3+ "**/.git" : true
4+ },
5+ "shellcheck.customArgs" : [
6+ " --external-sources"
7+ ],
8+ "shellcheck.useWorkspaceRootAsCwd" : true
9+ }
Original file line number Diff line number Diff line change 11#! /bin/bash
2- pushd " $( dirname -- " ${BASH_SOURCE[0]} " ) /.." > /dev/null
2+ pushd " $( dirname -- " ${BASH_SOURCE[0]} " ) /.." > /dev/null || exit 1
33BASENAME=" $( basename -- " ${BASH_SOURCE[0]} " ) "
44
5+ # shellcheck disable=SC1090
56. " libexec/${BASENAME} .bash"
67
7- popd > /dev/null
8+ popd > /dev/null || exit 1
89shopt -s extglob
910__" ${BASENAME// +([^a-z0-9_])/ _} " " $@ "
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export -f __dataset_id__cleanup
1616
1717function __dataset_id__load_dataset_record {
1818 local pid exitstatus fifodir fifoname
19+ export dataset dataset_id
1920
2021 trap __dataset_id__cleanup EXIT INT HUP TERM
2122 fifodir=" $( mktemp -d) "
@@ -24,7 +25,7 @@ function __dataset_id__load_dataset_record {
2425
2526 (__dataset_id__dataset_record " $@ " ) > " ${fifoname} " &
2627 pid=" $! "
27- IFS=$' \t ' read -d $' \n ' dataset dataset_id < " ${fifoname} " \
28+ IFS=$' \t ' read -r - d $' \n ' dataset dataset_id < " ${fifoname} " \
2829 || true
2930
3031 wait " ${pid} " || exitstatus=" $? "
@@ -62,7 +63,7 @@ function __dataset_id__dataset_record {
6263 esac
6364 done
6465
65- shift " $(( $ OPTIND- 1 )) "
66+ shift " $(( OPTIND- 1 )) "
6667
6768 parent_dataset=" $1 "
6869
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ function __znaphodl__load_target_dataset_record {
7878
7979 (__znaphodl__target_dataset_record) > " ${fifoname} " &
8080 pid=" $! "
81- IFS=$' \t ' read -d $' \n ' target_dataset target_hostname \
81+ IFS=$' \t ' read -r - d $' \n ' target_dataset target_hostname \
8282 < " ${fifoname} " \
8383 || true
8484
@@ -143,10 +143,8 @@ function __znaphodl {
143143 local OPTIND=1
144144 local option
145145
146- local debug=0
147146 local latest_common_snapshot
148147 local last_query_timestamp_property_name
149- local lockfile
150148 local log_available_space=0
151149 local source_dataset
152150 local source_hold_tag
@@ -160,6 +158,8 @@ function __znaphodl {
160158
161159 set -eu
162160
161+ debug=0
162+
163163 while getopts ' :dln' option; do
164164 case " ${option} " in
165165 d)
@@ -180,7 +180,7 @@ function __znaphodl {
180180 esac
181181 done
182182
183- shift " $(( $ OPTIND- 1 )) "
183+ shift " $(( OPTIND- 1 )) "
184184
185185 source_dataset=" ${1?} "
186186 target_dataset_key=" ${2?} "
Original file line number Diff line number Diff line change @@ -6,13 +6,12 @@ function __znaphodlz {
66 local home_poolname
77 local poolnames
88
9- __zpoolz__load_poolnames
10- if [[ " $? " -ne 0 ]]; then
9+ if ! __zpoolz__load_poolnames; then
1110 echo >&2 " Unable to identify pool names"
1211 return 1
1312 fi
1413
15- if [[ ! " ${poolnames[@] } " ]]; then
14+ if [[ ! " ${poolnames} " ]]; then
1615 echo >&2 " No pools found"
1716 return 1
1817 fi
@@ -27,7 +26,7 @@ function __znaphodlz {
2726
2827 for home_poolname in " ${poolnames[@]} " ; do
2928 if {
30- __dataset_id__load_dataset_record -r " ${home_poolname} " ;
29+ __dataset_id__load_dataset_record -r " $@ " " $ {home_poolname}" ;
3130 }; then
3231 echo $' \n ' " Home dataset ${dataset} "
3332 zfs list -H -t snapshot -o name " ${dataset} " \
Original file line number Diff line number Diff line change @@ -65,19 +65,18 @@ function __znaplizt {
6565 esac
6666 done
6767
68- shift " $(( $ OPTIND- 1 )) "
68+ shift " $(( OPTIND- 1 )) "
6969
70- if [[ " $@ " ]]; then
70+ if [[ " $# " -gt 0 ]]; then
7171 poolnames=(" $@ " )
7272 else
73- __zpoolz__load_poolnames
74- if [[ " $? " -ne 0 ]]; then
73+ if ! __zpoolz__load_poolnames; then
7574 echo >&2 " Unable to identify pool names"
7675 return 1
7776 fi
7877 fi
7978
80- if [[ ! " ${poolnames[@]} " ]]; then
79+ if [[ " ${# poolnames[@]} " -eq 0 ]]; then
8180 echo >&2 " No pools found"
8281 return 1
8382 fi
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function __zpoolz__load_poolnames {
1515
1616 (zpool list -H -o name) > " ${fifoname} " &
1717 zpool_pid=" $! "
18- IFS=$' \n ' read -a poolnames -d ' ' < " ${fifoname} " || true
18+ IFS=$' \n ' read -r - a poolnames -d ' ' < " ${fifoname} " || true
1919
2020 wait " ${zpool_pid} " || zpool_status=" $? "
2121
You can’t perform that action at this time.
0 commit comments