From 59852886202e9253809665a533fba6d7761ff04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 21 Jul 2022 15:57:37 +0200 Subject: [PATCH] If no ZFS, exit with error message --- zfs/zfs.set.user.quota.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zfs/zfs.set.user.quota.sh b/zfs/zfs.set.user.quota.sh index 35736a5..5aa12a9 100755 --- a/zfs/zfs.set.user.quota.sh +++ b/zfs/zfs.set.user.quota.sh @@ -277,7 +277,7 @@ main() { # {{{ ## If ZFS command is absent from the system {{{ ### Exit 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 @@ -286,13 +286,13 @@ main() { # {{{ ## If ZFS pool/dataset is not available {{{ ### Exit 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 {{{ ### OR Exit 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 {{{ @@ -315,7 +315,7 @@ main() { # {{{ ### From quota file if any information for this user user_zfs_quota="$(grep --word-regexp -- "^${zfs_username}" "${quota_file}" | 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})." else ### Default quota by default @@ -325,7 +325,7 @@ main() { # {{{ ### Try to apply the quota to the user {{{ ### OR Exit with error 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}"