mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-11 11:12:41 +02:00
quotas for xfs
This commit is contained in:
@@ -277,13 +277,6 @@ class preFlightsChecks:
|
||||
try:
|
||||
if parts[1] == '/' and parts[3].find('usrquota,grpquota') == -1 and len(parts[3]) > 4:
|
||||
|
||||
### if xfx dont move forward for now
|
||||
if line.find('xfs') > -1:
|
||||
retValue = 0
|
||||
WriteToFile.write(line)
|
||||
continue
|
||||
###
|
||||
|
||||
parts[3] = f'{parts[3]},usrquota,grpquota'
|
||||
finalString = '\t'.join(parts)
|
||||
print(finalString)
|
||||
@@ -291,13 +284,6 @@ class preFlightsChecks:
|
||||
|
||||
elif parts[1] == '/':
|
||||
|
||||
### if xfx dont move forward for now
|
||||
if line.find('xfs') > -1:
|
||||
retValue = 0
|
||||
WriteToFile.write(line)
|
||||
continue
|
||||
###
|
||||
|
||||
for ii, p in enumerate(parts):
|
||||
if p.find('defaults') > -1 or p.find('discard') > -1:
|
||||
parts[ii] = f'{parts[ii]},usrquota,grpquota'
|
||||
|
||||
@@ -3629,13 +3629,19 @@ pm.max_spare_servers = 3
|
||||
|
||||
@staticmethod
|
||||
def edit_fstab(mount_point, options_to_add):
|
||||
|
||||
try:
|
||||
retValue = 1
|
||||
# Backup the original fstab file
|
||||
fstab_path = '/etc/fstab'
|
||||
backup_path = fstab_path + '.bak'
|
||||
|
||||
rData = open(fstab_path, 'r').read()
|
||||
|
||||
if rData.find('xfs') > -1:
|
||||
options_to_add = 'uquota'
|
||||
else:
|
||||
options_to_add = 'usrquota,grpquota'
|
||||
|
||||
if not os.path.exists(backup_path):
|
||||
shutil.copy(fstab_path, backup_path)
|
||||
|
||||
@@ -3654,32 +3660,18 @@ pm.max_spare_servers = 3
|
||||
|
||||
print(parts)
|
||||
try:
|
||||
if parts[1] == '/' and parts[3].find('usrquota,grpquota') == -1 and len(parts[3]) > 4:
|
||||
if parts[1] == '/' and parts[3].find(options_to_add) == -1 and len(parts[3]) > 4:
|
||||
|
||||
### if xfx dont move forward for now
|
||||
if line.find('xfs') > -1:
|
||||
retValue = 0
|
||||
WriteToFile.write(line)
|
||||
continue
|
||||
###
|
||||
|
||||
parts[3] = f'{parts[3]},usrquota,grpquota'
|
||||
parts[3] = f'{parts[3]},{options_to_add}'
|
||||
finalString = '\t'.join(parts)
|
||||
print(finalString)
|
||||
WriteToFile.write(finalString)
|
||||
|
||||
elif parts[1] == '/':
|
||||
|
||||
### if xfx dont move forward for now
|
||||
if line.find('xfs') > -1:
|
||||
retValue = 0
|
||||
WriteToFile.write(line)
|
||||
continue
|
||||
###
|
||||
|
||||
for ii, p in enumerate(parts):
|
||||
if p.find('defaults') > -1 or p.find('discard') > -1:
|
||||
parts[ii] = f'{parts[ii]},usrquota,grpquota'
|
||||
parts[ii] = f'{parts[ii]},{options_to_add}'
|
||||
finalString = '\t'.join(parts)
|
||||
print(finalString)
|
||||
WriteToFile.write(finalString)
|
||||
@@ -3701,7 +3693,7 @@ pm.max_spare_servers = 3
|
||||
|
||||
data = open(fstab_path, 'r').read()
|
||||
|
||||
if data.find("usrquota,grpquota") > -1:
|
||||
if data.find("usrquota,grpquota") > -1 or data.find("uquota") > -1:
|
||||
print("Quotas already enabled.")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user