Update help message

This commit is contained in:
Jeremy Gardais 2022-07-19 15:22:26 +02:00
parent 8cfcb862b3
commit f543e20ec4
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 10 additions and 3 deletions

View File

@ -44,10 +44,16 @@ EXAMPLES:
- Apply default quota to a given dataset - Apply default quota to a given dataset
${PROGNAME} --pool "datastore/backup" ${PROGNAME} --pool "datastore/backup"
- Apply a given quota by default (100G) and use a quota file for specific user
${PROGNAME} --quota 100G --file /datastore/backup/.duplicati/zfs.quota
OPTIONS: OPTIONS:
-d,--debug -d,--debug
Enable debug messages. Enable debug messages.
-f|--file
Specify path to a quota file for specific quota per user.
-h,--help -h,--help
Print this help message. Print this help message.
@ -303,15 +309,16 @@ main() { # {{{
## Read user one by one ## Read user one by one
while IFS= read -r zfs_username; do while IFS= read -r zfs_username; do
### Get quota to use {{{ ### Define quota to use {{{
if [ "${QUOTA_FILE_MODE}" -eq "0" ] \ if [ "${QUOTA_FILE_MODE}" -eq "0" ] \
&& grep --word-regexp -- "^${zfs_username}" "${quota_file}" | grep --only-matching --perl-regexp --quiet -- '[[:digit:].]*.$'; then && grep --word-regexp -- "^${zfs_username}" "${quota_file}" | grep --only-matching --perl-regexp --quiet -- '[[:digit:].]*.$'; then
### From quota file if any information for this user
user_zfs_quota="$(grep --word-regexp -- "^${zfs_username}" "${quota_file}" | user_zfs_quota="$(grep --word-regexp -- "^${zfs_username}" "${quota_file}" |
grep --only-matching --perl-regexp -- '[[:digit:].]*.$' \ grep --only-matching --perl-regexp -- '[[:digit:].]*.$' \
|| error_message "Can't get quota for ${zfs_username} user from ${quota_file} quota file." 4)" || error_message "Can't get quota for ${zfs_username} user from ${quota_file} quota file." 4)"
debug_message "Apply specific quota (${RED}${user_zfs_quota}${COLOR_DEBUG}) to ${zfs_username} user." debug_message "Get specific quota (${RED}${user_zfs_quota}${COLOR_DEBUG}) for ${RED}${zfs_username}${COLOR_DEBUG} user from quota file (${RED}${quota_file}${COLOR_DEBUG})."
exit 0
else else
### Default quota by default
user_zfs_quota="${zfs_quota}" user_zfs_quota="${zfs_quota}"
fi fi
### }}} ### }}}