If no ZFS, exit with error message

This commit is contained in:
Jeremy Gardais 2022-07-21 15:57:37 +02:00
parent c410051864
commit 5985288620
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 5 additions and 5 deletions

View File

@ -277,7 +277,7 @@ main() { # {{{
## If ZFS command is absent from the system {{{ ## If ZFS command is absent from the system {{{
### Exit ### Exit
is_command_absent "zfs" \ is_command_absent "zfs" \
&& exit 0 && error_message "Please verify that ZFS is available on this system and zfs command is in the PATH." 2
## }}} ## }}}
## Define all vars ## Define all vars
@ -286,13 +286,13 @@ main() { # {{{
## If ZFS pool/dataset is not available {{{ ## If ZFS pool/dataset is not available {{{
### Exit ### Exit
is_zfs_dataset_exists "${zfs_dataset}" \ is_zfs_dataset_exists "${zfs_dataset}" \
|| error_message "Please verify your ZFS pool (${zfs_dataset} doesn't seems available" 2 || error_message "Please verify your ZFS pool (${zfs_dataset} doesn't seems available." 3
## }}} ## }}}
## Try to get the user list of ZFS pool/dataset {{{ ## Try to get the user list of ZFS pool/dataset {{{
### OR Exit ### OR Exit
get_dataset_user_list "${zfs_dataset}" \ get_dataset_user_list "${zfs_dataset}" \
|| error_message "Can't get the user list of ${zfs_dataset} ZFS pool/dataset. Please use --debug option." 3 || error_message "Can't get the user list of ${zfs_dataset} ZFS pool/dataset. Please use --debug option." 4
## }}} ## }}}
## If a previous list of users exists {{{ ## If a previous list of users exists {{{
@ -315,7 +315,7 @@ main() { # {{{
### From quota file if any information for this user ### 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." 5)"
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})." 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})."
else else
### Default quota by default ### Default quota by default
@ -325,7 +325,7 @@ main() { # {{{
### Try to apply the quota to the user {{{ ### Try to apply the quota to the user {{{
### OR Exit with error ### OR Exit with error
apply_zfs_userquota "${zfs_username}" "${user_zfs_quota}" \ apply_zfs_userquota "${zfs_username}" "${user_zfs_quota}" \
|| error_message "Can't define the new quota (${user_zfs_quota}) for ${zfs_username} user in ${zfs_dataset} ZFS pool/dataset. Please use --debug option." 4 || error_message "Can't define the new quota (${user_zfs_quota}) for ${zfs_username} user in ${zfs_dataset} ZFS pool/dataset. Please use --debug option." 6
### }}} ### }}}
done < "${zfs_user_list_path}" done < "${zfs_user_list_path}"