adding NFS_QUOTA=no to local.sh => default is now to NOT enable NFS-based quota

This commit is contained in:
Benjamin Sonntag 2015-04-29 12:02:37 +02:00
parent f5b309aaca
commit 666d485da7
3 changed files with 23 additions and 4 deletions

View File

@ -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

1
debian/changelog vendored
View File

@ -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 <benjamin@sonntag.fr> Wed, 29 Apr 2015 10:30:01 +0200

View File

@ -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