Skip to content

Commit

Permalink
bug fix: contabo on quotas
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Sep 20, 2024
1 parent 282ac41 commit 5f0bbf7
Showing 1 changed file with 51 additions and 6 deletions.
57 changes: 51 additions & 6 deletions plogical/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -3544,11 +3544,11 @@ def installQuota():
print("Re-mount failed, restoring original FSTab and existing quota setup.")
return 0


##

if Upgrade.FindOperatingSytem() == Ubuntu22 or Upgrade.FindOperatingSytem() == Ubuntu18 \
or Upgrade.FindOperatingSytem() == Ubuntu20:

print("Install Quota on Ubuntu")
command = 'apt update -y'
Upgrade.executioner(command, command, 0, True)
Expand Down Expand Up @@ -3580,7 +3580,16 @@ def installQuota():
return 0

command = 'quotacheck -ugm /'
Upgrade.executioner(command, command, 0, True)
mResult = subprocess.run(command, capture_output=True, text=True, shell=True)
if mResult.returncode != 0:
fstab_path = '/etc/fstab'
backup_path = fstab_path + '.bak'
if os.path.exists(fstab_path):
os.remove(fstab_path)
shutil.copy(backup_path, fstab_path)

print("Re-mount failed, restoring original FSTab and existing quota setup.")
return 0

####

Expand All @@ -3606,16 +3615,52 @@ def installQuota():
###

command = f'modprobe quota_v1 -S {ffResult}'
Upgrade.executioner(command, command, 0, True)
mResult = subprocess.run(command, capture_output=True, text=True, shell=True)
if mResult.returncode != 0:
fstab_path = '/etc/fstab'
backup_path = fstab_path + '.bak'
if os.path.exists(fstab_path):
os.remove(fstab_path)
shutil.copy(backup_path, fstab_path)

print("Re-mount failed, restoring original FSTab and existing quota setup.")
return 0

command = f'modprobe quota_v2 -S {ffResult}'
Upgrade.executioner(command, command, 0, True)
mResult = subprocess.run(command, capture_output=True, text=True, shell=True)
if mResult.returncode != 0:
fstab_path = '/etc/fstab'
backup_path = fstab_path + '.bak'
if os.path.exists(fstab_path):
os.remove(fstab_path)
shutil.copy(backup_path, fstab_path)

print("Re-mount failed, restoring original FSTab and existing quota setup.")
return 0

command = f'quotacheck -ugm /'
Upgrade.executioner(command, command, 0, True)
mResult = subprocess.run(command, capture_output=True, text=True, shell=True)
if mResult.returncode != 0:
fstab_path = '/etc/fstab'
backup_path = fstab_path + '.bak'
if os.path.exists(fstab_path):
os.remove(fstab_path)
shutil.copy(backup_path, fstab_path)

print("Re-mount failed, restoring original FSTab and existing quota setup.")
return 0

command = f'quotaon -v /'
Upgrade.executioner(command, command, 0, True)
mResult = subprocess.run(command, capture_output=True, text=True, shell=True)
if mResult.returncode != 0:
fstab_path = '/etc/fstab'
backup_path = fstab_path + '.bak'
if os.path.exists(fstab_path):
os.remove(fstab_path)
shutil.copy(backup_path, fstab_path)

print("Re-mount failed, restoring original FSTab and existing quota setup.")
return 0

return 1

Expand Down

0 comments on commit 5f0bbf7

Please sign in to comment.