From 5dda97041f8a7405961afa0963f70ca4dd8141a6 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Tue, 17 Sep 2024 07:43:10 +0500 Subject: [PATCH] quotas for al8/9 --- install/install.py | 55 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/install/install.py b/install/install.py index 186eb7098..b196af349 100755 --- a/install/install.py +++ b/install/install.py @@ -153,6 +153,11 @@ def installQuota(self,): command, 1, 0, os.EX_OSERR) + self.edit_fstab('/', '/') + + command = 'mount -o remount /' + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + ## if self.distro == ubuntu: @@ -171,42 +176,42 @@ def installQuota(self,): preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - self.edit_fstab('/','/') + self.edit_fstab('/','/') - command = 'mount -o remount /' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + command = 'mount -o remount /' + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - command = 'quotacheck -ugm /' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + command = 'quotacheck -ugm /' + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - #### + #### - command = "find /lib/modules/ -type f -name '*quota_v*.ko*'" - iResult = subprocess.run(command, capture_output=True, text=True, shell=True) - print(repr(iResult.stdout)) + command = "find /lib/modules/ -type f -name '*quota_v*.ko*'" + iResult = subprocess.run(command, capture_output=True, text=True, shell=True) + print(repr(iResult.stdout)) - # Only if the first command works, run the rest + # Only if the first command works, run the rest - if iResult.returncode == 0: - command = "echo '{}' | sed -n 's|/lib/modules/\\([^/]*\\)/.*|\\1|p' | sort -u".format(iResult.stdout) - result = subprocess.run(command, capture_output=True, text=True, shell=True) - fResult = result.stdout.rstrip('\n') - print(repr(result.stdout.rstrip('\n'))) + if iResult.returncode == 0: + command = "echo '{}' | sed -n 's|/lib/modules/\\([^/]*\\)/.*|\\1|p' | sort -u".format(iResult.stdout) + result = subprocess.run(command, capture_output=True, text=True, shell=True) + fResult = result.stdout.rstrip('\n') + print(repr(result.stdout.rstrip('\n'))) - command = 'uname -r' - ffResult = subprocess.run(command, capture_output=True, text=True, shell=True) - ffResult = ffResult.stdout.rstrip('\n') + command = 'uname -r' + ffResult = subprocess.run(command, capture_output=True, text=True, shell=True) + ffResult = ffResult.stdout.rstrip('\n') - command = f"apt-get install linux-modules-extra-{ffResult}" - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + command = f"apt-get install linux-modules-extra-{ffResult}" + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - ### + ### - command = f'modprobe quota_v1 -S {ffResult}' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + command = f'modprobe quota_v1 -S {ffResult}' + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - command = f'modprobe quota_v2 -S {ffResult}' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + command = f'modprobe quota_v2 -S {ffResult}' + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) command = f'quotacheck -ugm /' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)