disable repos at appropriate time

This commit is contained in:
Usman Nasir
2020-04-24 17:31:02 +05:00
parent 67c493ca80
commit a43e62d09f
3 changed files with 38 additions and 26 deletions

View File

@@ -1551,3 +1551,22 @@ pip_virtualenv
system_tweak system_tweak
main_install main_install
### Disable Centos Default Repos
disable_repos() {
if [[ $SERVER_OS == "CentOS" ]] ; then
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Debuginfo.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Media.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Vault.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-CR.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-fasttrack.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Sources.repo
fi
}
disable_repos

View File

@@ -398,6 +398,25 @@ rm -f /usr/local/composer.sh
# clean up # clean up
### Disable Centos Default Repos
disable_repos() {
if [[ $SERVER_OS == "CentOS" ]] ; then
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Debuginfo.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Media.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Vault.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-CR.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-fasttrack.repo
sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Sources.repo
fi
}
disable_repos
echo "###################################################################" echo "###################################################################"
echo " CyberPanel Upgraded " echo " CyberPanel Upgraded "
echo "###################################################################" echo "###################################################################"

View File

@@ -2066,31 +2066,6 @@ vmail
writeToFile.write(content) writeToFile.write(content)
writeToFile.close() writeToFile.close()
def enableDisableRepos(self):
if self.distro == centos:
command = "sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Base.repo"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Debuginfo.repo"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Media.repo"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Vault.repo"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-CR.repo"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-fasttrack.repo"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = "sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Sources.repo"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
def main(): def main():
parser = argparse.ArgumentParser(description='CyberPanel Installer') parser = argparse.ArgumentParser(description='CyberPanel Installer')
parser.add_argument('publicip', help='Please enter public IP for your VPS or dedicated server.') parser.add_argument('publicip', help='Please enter public IP for your VPS or dedicated server.')
@@ -2238,7 +2213,6 @@ def main():
checks.installCLScripts() checks.installCLScripts()
#checks.disablePackegeUpdates() #checks.disablePackegeUpdates()
checks.enableDisableRepos()
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")