Bugfixing quota_get for LVM partition ( again ) need testing

This commit is contained in:
Steven Mondji-Lerider 2012-12-12 16:06:14 +00:00
parent d7101646ba
commit d10c673dd8
1 changed files with 14 additions and 11 deletions

View File

@ -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; }')
val=$(sudo quota -A -wg "$MID" | awk 'NR==3 { 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"
if [ "$UUID" != "$part" ]; then
echo -e "0\n0"
fi
else
echo -e "$val"
fi