From 666d485da7c7f45f04b71a2c1b6c361b78240b08 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Wed, 29 Apr 2015 12:02:37 +0200 Subject: [PATCH] adding NFS_QUOTA=no to local.sh => default is now to NOT enable NFS-based quota --- debian/alternc.postinst | 14 +++++++++++++- debian/changelog | 1 + src/quota_get | 12 +++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/debian/alternc.postinst b/debian/alternc.postinst index ee7b4513..89b894c1 100644 --- a/debian/alternc.postinst +++ b/debian/alternc.postinst @@ -131,7 +131,12 @@ ALTERNC_LOGS="" # But you may merge your logs in other directory. In order to view them, # Uncomment and complete the following variable to use it instead of ALTERNC_LOGS. #ALTERNC_LOGS_ARCHIVE="" - + +# Shall we enable QUOTA over NFS ? +# the default is NO, since this dramatically block /usr/lib/alternc/quota* functions +# called from the panel. To enable quota-over-NFS, put yes here +NFS_QUOTA=no + EOF chown root:alterncpanel $CONFIGFILE @@ -165,6 +170,13 @@ EOF sed -e "$SED_SCRIPT" < $CONFIGFILE > $CONFIGFILE.tmp mv -f $CONFIGFILE.tmp $CONFIGFILE + # Add NFS_QUOTA instructions if they are not in the config file: + grep -Eq "^ *NFS_QUOTA=" $CONFIGFILE || echo " +# Shall we enable QUOTA over NFS ? +# the default is NO, since this dramatically block /usr/lib/alternc/quota* functions +# called from the panel. To enable quota-over-NFS, put yes here +NFS_QUOTA=no" >> $CONFIGFILE + # Erase all apacheconf file # They will be regenerated without the bug by upgrade_check.sh below. if dpkg --compare-versions "$2" le "0.9.3.9-globenet14"; then diff --git a/debian/changelog b/debian/changelog index 25df8788..fe6467cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ alternc (3.1.5) oldstable; urgency=low * fix alias changes not working in some cases * fix ;;; END ALTERNC zones bug also for older versions + * fix manage remote NFS-based quota when *explicitely* stated in local.sh (QUOTA_NFS=y) -- Benjamin Sonntag Wed, 29 Apr 2015 10:30:01 +0200 diff --git a/src/quota_get b/src/quota_get index 2558544e..67dae34c 100755 --- a/src/quota_get +++ b/src/quota_get @@ -17,6 +17,12 @@ if [ "x$MID" == "x" ] ; then exit 1 fi +QUOTA_OPTIONS="-l" +if [ "$NFS_QUOTA" = "yes" -o "$NFS_QUOTA" = "YES" -o "$NFS_QUOTA" = "Yes" ] +then + QUOTA_OPTIONS="" +fi + #checking if quotas are installed command -v $QUOTA >/dev/null || { echo "Quotas uninstalled"; exit 0; } @@ -40,13 +46,13 @@ if [ -z "$QUOTA_PART" ]; then UUID=$( $BLKID | grep "$QUOTA_PART" | cut -f2 -s -d" " | sed 's/\(UUID="\)\(.*\)\(\"$\)/\2/') fi -quot=$(sudo quota -wvg "$MID" | grep "$QUOTA_PART" | $AWK 'NR==1 {print $1;}' ) +quot=$(sudo quota $QUOTA_OPTIONS -wvg "$MID" | grep "$QUOTA_PART" | $AWK 'NR==1 {print $1;}' ) # Now we get the quota #first by testing if the partition is referenced by UUID -val=$(sudo quota -vwg "$MID" |grep "$UUID" | awk 'END { print $2 "\n" $3; }') +val=$(sudo quota $QUOTA_OPTIONS -vwg "$MID" |grep "$UUID" | awk 'END { print $2 "\n" $3; }') if [ -z "$val" ] ; then - val=$(sudo quota -A -wg "$MID" |grep "$QUOTA_PART" | awk 'END { print $2 "\n" $3; }') + val=$(sudo quota $QUOTA_OPTIONS -A -wg "$MID" |grep "$QUOTA_PART" | awk 'END { print $2 "\n" $3; }') # If the quota aren't activated, I return something anyway if [ -z "$val" ] ; then