From d10c673dd8c15e23ebdb62bf9d1ea5dc8515dc12 Mon Sep 17 00:00:00 2001 From: Steven Mondji-Lerider Date: Wed, 12 Dec 2012 16:06:14 +0000 Subject: [PATCH] Bugfixing quota_get for LVM partition ( again ) need testing --- src/quota_get | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/quota_get b/src/quota_get index 8f3b936d..e45901bf 100755 --- a/src/quota_get +++ b/src/quota_get @@ -39,21 +39,24 @@ if [ -z "$QUOTA_PART" ]; then UUID=$( $BLKID | grep "$QUOTA_PART" | cut -f2 -s -d" " | sed 's/\(UUID="\)\(.*\)\(\"$\)/\2/') fi +#We check that quotas are activated on the right partition +quot=$(sudo quota -A -wg "$MID" | awk 'NR==3 { print $1; }') +part=$( $BLKID | grep "$quot" | cut -f2 -s -d" " | sed 's/\(UUID="\)\(.*\)\(\"$\)/\2/') +# If the quotas are activated on another part we return 0 meaning that the quotas are infinite +if [ "$UUID" != "$part" ]; then + echo -e "0\n0" + exit 0 +fi # Now we get the quota -#first by testing if the partition is referenced by UUID -val=$(sudo quota -A -wg "$MID" |grep "$UUID" | awk '{ print $2 "\n" $3; }') -if [ -z "$val" ] ; then - val=$(sudo quota -A -wg "$MID" |grep "$QUOTA_PART" | awk '{ print $2 "\n" $3; }') - - # If the quota aren't activated, I return something anyway - if [ -z "$val" ] ; then - echo -e "0\n0" - else - echo -e "0\n0" - fi +val=$(sudo quota -A -wg "$MID" | awk 'NR==3 { print $2 "\n" $3; }') +if [ -z "$val" ] ; then + # If the quota aren't activated, I return something anyway + if [ "$UUID" != "$part" ]; then + echo -e "0\n0" + fi else echo -e "$val" fi