diff --git a/bin/v-add-sys-quota b/bin/v-add-sys-quota index 769d993..36e3973 100755 --- a/bin/v-add-sys-quota +++ b/bin/v-add-sys-quota @@ -54,8 +54,8 @@ if [ "$file_system" == "xfs" ]; then RED='\033[0;31m' NC='\033[0m' YELLOW='\033[1;33m' - printf "${RED}!!!!!!!Detected rootflags in grub!!!!!!!${NC}" - echo "${YELLOW}Add manualy 'uquota,pquota' and reboot the system${NC}" + printf "${RED}!!!!!!!Detected rootflags in grub!!!!!!!${NC}\n" + echo "${YELLOW}Add manualy 'uquota,pquota' and reboot the system${NC}\n" else grubby --args="rootflags=uquota,pquota" --update-kernel=ALL fi diff --git a/bin/v-delete-sys-quota b/bin/v-delete-sys-quota index 0f35a7c..54217db 100755 --- a/bin/v-delete-sys-quota +++ b/bin/v-delete-sys-quota @@ -30,31 +30,53 @@ check_hestia_demo_mode #----------------------------------------------------------# # Deleting group and user quota on /home partition +file_system=$(df -T /home | tail -n1 | awk '{print $2}') mnt=$(df -P /home | awk '{print $6}' | tail -n1) lnr=$(cat -n /etc/fstab | awk '{print $1,$3}' | grep "$mnt$" | cut -f 1 -d ' ') opt=$(sed -n ${lnr}p /etc/fstab | awk '{print $4}') -fnd='usrquota\|grpquota\|usrjquota=\|grpjquota=\|jqfmt=' -if [ -n "$(echo $opt | grep $fnd)" ]; then - rep=$(echo $(echo $opt | tr ',' '\n' | grep -v $fnd) | tr ' ' ',') - sed -i "$lnr s/$opt/$rep/" /etc/fstab - mount -o remount "$mnt" -fi +if [ "$file_system" == "xfs" ]; then + fnd='usrquota\|grpquota' + if [ -n "$(echo $opt | grep $fnd)" ]; then + rep=$(echo $(echo $opt | tr ',' '\n' | grep -v $fnd) | tr ' ' ',') + sed -i "$lnr s/$opt/$rep/" /etc/fstab + mount -o remount "$mnt" + fi + if [ "$mnt" == "/" ]; then + check_args=$(grubby --info=`grubby --default-kernel` | grep -oP "rootflags=[^\"]*" | head -n1) + if [ "$check_args" != "rootflags=uquota,pquota" ]; then + RED='\033[0;31m' + NC='\033[0m' + YELLOW='\033[1;33m' + printf "${RED}!!!!!!!Delete uquota,pquota from grub!!!!!!!${NC}\n" + echo "${YELLOW}Delete manualy 'uquota,pquota' and reboot the system${NC}\n" + else + grubby --remove-args="rootflags=uquota,pquota" --update-kernel=ALL + fi + fi +else + fnd='usrquota\|grpquota\|usrjquota=\|grpjquota=\|jqfmt=' + if [ -n "$(echo $opt | grep $fnd)" ]; then + rep=$(echo $(echo $opt | tr ',' '\n' | grep -v $fnd) | tr ' ' ',') + sed -i "$lnr s/$opt/$rep/" /etc/fstab + mount -o remount "$mnt" + fi -# Disabling group and user quota -quotaoff=$(which --skip-alias --skip-functions quotaoff 2> /dev/null) -if [ $? -eq 0 ]; then - if [ -n "$(quotaon -pa | grep " $mnt " | grep 'user\|group' | grep 'is on')" ]; then - $quotaoff $mnt + # Disabling group and user quota + quotaoff=$(which --skip-alias --skip-functions quotaoff 2> /dev/null) + if [ $? -eq 0 ]; then + if [ -n "$(quotaon -pa | grep " $mnt " | grep 'user\|group' | grep 'is on')" ]; then + $quotaoff $mnt + fi fi -fi -# Deleting v1 + v2 group and user quota index -for idx in $(echo 'quota.user quota.group aquota.user aquota.group'); do - [ -e "$mnt/$idx" ] && rm -f "$mnt/$idx" -done + # Deleting v1 + v2 group and user quota index + for idx in $(echo 'quota.user quota.group aquota.user aquota.group'); do + [ -e "$mnt/$idx" ] && rm -f "$mnt/$idx" + done -# Deleting cron job -rm -f /etc/cron.daily/quotacheck + # Deleting cron job + rm -f /etc/cron.daily/quotacheck +fi # Updating hestia.conf value if [ -z "$(grep DISK_QUOTA $HESTIA/conf/hestia.conf)" ]; then