@@ -22,8 +22,7 @@ source_conf "$HESTIA/conf/hestia.conf"
2222# ----------------------------------------------------------#
2323
2424# Ensure that quota kernel modules are installed
25- kernel_module_check=$( find /lib/modules/$( uname -r) -type f -name ' *quota_v*.ko*' | egrep ' .*' && [ $? -eq 0 ])
26- if [ -z " $kernel_module_check " ]; then
25+ if ! find " /lib/modules/$( uname -r) " -type f -name ' *quota_v*.ko*' | grep -q ' .*' ; then
2726 # Install kernel modules for quota support.
2827 # Requires reboot to activate updated kernel.
2928 echo " Installing required kernel modules for quota support..."
@@ -33,8 +32,7 @@ if [ -z "$kernel_module_check" ]; then
3332fi
3433
3534# Checking quota package
36- quota=$( which --skip-alias --skip-functions quota 2> /dev/null)
37- if [ $? -ne 0 ]; then
35+ if ! type -P quota & > /dev/null; then
3836 if [ -f " /etc/redhat-release" ]; then
3937 dnf -y install quota > /dev/null 2>&1
4038 else
@@ -56,10 +54,11 @@ mnt=$(df -P /home | awk '{print $6}' | tail -n1)
5654lnr=$( cat -n /etc/fstab | grep -v " #" | awk ' {print $1,$3}' | grep " $mnt $" | cut -f 1 -d ' ' )
5755opt=$( sed -n ${lnr} p /etc/fstab | awk ' {print $4}' )
5856fnd=' usrquota\|grpquota\|usrjquota=aquota.user\|grpjquota=aquota.group\|jqfmt=vfsv0'
59- if [ $( echo $opt | tr ' ,' ' \n' | grep -x $fnd | wc -l ) -ne 5 ]; then
57+ if [ " $( echo " $opt " | tr ' ,' ' \n' | grep -c - x $fnd ) " -ne 5 ]; then
6058 old=$( echo $( echo $opt | tr ' ,' ' \n' | grep -v ' usrquota\|grpquota\|usrjquota=\|grpjquota=\|jqfmt=' ) | tr ' ' ' ,' )
6159 new=' usrquota,grpquota,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0'
6260 sed -i " $lnr s/$opt /$old ,$new /" /etc/fstab
61+ systemctl daemon-reload
6362 mount -o remount " $mnt "
6463fi
6564
@@ -83,11 +82,7 @@ if [ -n "$(quotaon -pa | grep " $mnt " | grep 'user\|group' | grep 'is off')" ];
8382fi
8483
8584# Updating hestia.conf value
86- if [ -z " $( grep DISK_QUOTA $HESTIA /conf/hestia.conf) " ]; then
87- echo " DISK_QUOTA='yes'" >> $HESTIA /conf/hestia.conf
88- else
89- sed -i " s/DISK_QUOTA=.*/DISK_QUOTA='yes'/g" $HESTIA /conf/hestia.conf
90- fi
85+ $BIN /v-change-sys-config-value " DISK_QUOTA" " yes"
9186
9287# Rebuilding user quota
9388for user in $( " $BIN /v-list-users" list) ; do
0 commit comments