2017-11-12 00:07:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-27 03:53:03 +00:00
|
|
|
set -o nounset
|
|
|
|
|
2017-11-12 00:07:54 +00:00
|
|
|
# For each Borg sub-command that borgmatic uses, print out the Borg flags that borgmatic does not
|
|
|
|
# appear to support yet. This script isn't terribly robust. It's intended as a basic tool to ferret
|
|
|
|
# out unsupported Borg options so that they can be considered for addition to borgmatic.
|
|
|
|
|
2018-10-05 04:45:31 +00:00
|
|
|
# Generate a sample borgmatic configuration with all options set, and uncomment all options.
|
2017-11-12 00:07:54 +00:00
|
|
|
generate-borgmatic-config --destination temp.yaml
|
2018-10-05 04:45:31 +00:00
|
|
|
cat temp.yaml | sed -e 's/# \S.*$//' | sed -e 's/#//' > temp.yaml.uncommented
|
|
|
|
mv temp.yaml.uncommented temp.yaml
|
2017-11-12 00:07:54 +00:00
|
|
|
|
|
|
|
# For each sub-command (prune, create, and check), collect the Borg command-line flags that result
|
|
|
|
# from running borgmatic with the generated configuration. Then, collect the full set of available
|
|
|
|
# Borg flags as reported by "borg --help" for that sub-command. Finally, compare the two lists of
|
|
|
|
# flags to determine which Borg flags borgmatic doesn't yet support.
|
2018-05-27 03:53:03 +00:00
|
|
|
for sub_command in prune create check list info; do
|
2017-11-12 00:07:54 +00:00
|
|
|
echo "********** borg $sub_command **********"
|
|
|
|
|
2019-06-23 23:30:16 +00:00
|
|
|
for line in $(borgmatic --config temp.yaml $sub_command -v 2 2>&1 | grep "borg\w* $sub_command") ; do
|
2017-11-12 00:07:54 +00:00
|
|
|
echo "$line" | grep '^-' >> borgmatic_borg_flags
|
|
|
|
done
|
|
|
|
sort borgmatic_borg_flags > borgmatic_borg_flags.sorted
|
|
|
|
mv borgmatic_borg_flags.sorted borgmatic_borg_flags
|
|
|
|
|
2018-08-19 18:24:48 +00:00
|
|
|
for word in $(borg $sub_command --help | grep '^ -') ; do
|
2017-11-12 00:07:54 +00:00
|
|
|
# Exclude a bunch of flags that borgmatic actually supports, but don't get exercised by the
|
|
|
|
# generated sample config, and also flags that don't make sense to support.
|
2018-08-19 18:24:48 +00:00
|
|
|
echo "$word" | grep ^-- | sed -e 's/,$//' \
|
2017-11-12 00:07:54 +00:00
|
|
|
| grep -v '^--archives-only$' \
|
|
|
|
| grep -v '^--critical$' \
|
2018-08-19 18:24:48 +00:00
|
|
|
| grep -v '^--debug$' \
|
|
|
|
| grep -v '^--dry-run$' \
|
2017-11-12 00:07:54 +00:00
|
|
|
| grep -v '^--error$' \
|
2018-08-19 18:24:48 +00:00
|
|
|
| grep -v '^--help$' \
|
2017-11-12 00:07:54 +00:00
|
|
|
| grep -v '^--info$' \
|
2018-10-05 04:45:31 +00:00
|
|
|
| grep -v '^--json$' \
|
2018-10-05 04:54:23 +00:00
|
|
|
| grep -v '^--keep-last$' \
|
2018-08-19 18:24:48 +00:00
|
|
|
| grep -v '^--list$' \
|
2022-02-10 05:11:00 +00:00
|
|
|
| grep -v '^--bsdflags$' \
|
2018-08-19 18:24:48 +00:00
|
|
|
| grep -v '^--pattern$' \
|
2018-11-22 06:03:39 +00:00
|
|
|
| grep -v '^--progress$' \
|
2018-12-06 22:58:14 +00:00
|
|
|
| grep -v '^--stats$' \
|
2018-09-09 18:21:06 +00:00
|
|
|
| grep -v '^--read-special$' \
|
2018-08-19 18:24:48 +00:00
|
|
|
| grep -v '^--repository-only$' \
|
2018-08-19 19:44:40 +00:00
|
|
|
| grep -v '^--show-rc$' \
|
2018-08-19 18:24:48 +00:00
|
|
|
| grep -v '^--stats$' \
|
|
|
|
| grep -v '^--verbose$' \
|
|
|
|
| grep -v '^--warning$' \
|
2019-06-25 17:18:30 +00:00
|
|
|
| grep -v '^--exclude' \
|
|
|
|
| grep -v '^--exclude-from' \
|
|
|
|
| grep -v '^--first' \
|
|
|
|
| grep -v '^--format' \
|
|
|
|
| grep -v '^--glob-archives' \
|
2022-10-04 05:50:37 +00:00
|
|
|
| grep -v '^--match-archives' \
|
2019-06-25 17:18:30 +00:00
|
|
|
| grep -v '^--last' \
|
2022-02-09 19:08:02 +00:00
|
|
|
| grep -v '^--format' \
|
2019-06-25 17:18:30 +00:00
|
|
|
| grep -v '^--patterns-from' \
|
|
|
|
| grep -v '^--prefix' \
|
|
|
|
| grep -v '^--short' \
|
|
|
|
| grep -v '^--sort-by' \
|
2018-08-19 18:24:48 +00:00
|
|
|
| grep -v '^-h$' \
|
2017-11-12 00:07:54 +00:00
|
|
|
>> all_borg_flags
|
|
|
|
done
|
2018-08-19 18:24:48 +00:00
|
|
|
|
2017-11-12 00:07:54 +00:00
|
|
|
sort all_borg_flags > all_borg_flags.sorted
|
|
|
|
mv all_borg_flags.sorted all_borg_flags
|
|
|
|
|
|
|
|
comm -13 borgmatic_borg_flags all_borg_flags
|
|
|
|
|
|
|
|
rm ./*_borg_flags
|
|
|
|
done
|
|
|
|
|
|
|
|
rm temp.yaml
|