Fix issues with APT repositories

This commit is contained in:
VirtuBox
2019-10-08 17:14:22 +02:00
parent 91a91abeef
commit c90ac2620e
5 changed files with 63 additions and 50 deletions

View File

@@ -48,9 +48,11 @@ class WORepo():
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to add repo")
if ppa is not None:
WOShellExec.cmd_exec(
self, "LC_ALL=C.UTF-8 add-apt-repository -yu '{ppa_name}'"
.format(ppa_name=ppa))
if WOShellExec.cmd_exec(
self, "LC_ALL=C.UTF-8 add-apt-repository -yu '{ppa_name}'"
.format(ppa_name=ppa)):
return True
return False
def remove(self, ppa=None, repo_url=None):
"""

View File

@@ -18,11 +18,11 @@ class WOAptGet():
"""
try:
with open('/var/log/wo/wordops.log', 'a') as f:
proc = subprocess.Popen('apt-mirror-updater -u',
shell=True,
stdin=None, stdout=f,
stderr=subprocess.PIPE,
executable="/bin/bash")
proc = subprocess.Popen(
'DEBIAN_FRONTEND=noninteractive apt-get update '
'--allow-releaseinfo-change',
shell=True, stdin=None, stdout=f,
stderr=subprocess.PIPE, executable="/bin/bash")
proc.wait()
output, error_output = proc.communicate()
@@ -83,18 +83,16 @@ class WOAptGet():
"""
try:
with open('/var/log/wo/wordops.log', 'a') as f:
proc = subprocess.Popen("DEBIAN_FRONTEND=noninteractive "
"apt-get dist-upgrade "
"--option=Dpkg::options::="
"--force-confdef "
"--option=Dpkg::options::="
"--force-unsafe-io "
"--option=Dpkg::options::="
"--force-confold "
"--assume-yes --quiet ",
shell=True, stdin=None,
stdout=f, stderr=f,
executable="/bin/bash")
proc = subprocess.Popen(
"DEBIAN_FRONTEND=noninteractive "
"apt-get dist-upgrade "
"--option=Dpkg::options::=--force-confdef "
"--option=Dpkg::options::=--force-unsafe-io "
"--option=Dpkg::options::=--force-confold "
"--assume-yes --quiet ",
shell=True, stdin=None,
stdout=f, stderr=f,
executable="/bin/bash")
proc.wait()
if proc.returncode == 0:
@@ -228,16 +226,18 @@ class WOAptGet():
WORepo.add(self, repo_url=repo_url)
if repo_key is not None:
WORepo.add_key(self, repo_key)
proc = subprocess.Popen("apt-get update && "
"DEBIAN_FRONTEND=noninteractive "
"apt-get install -o "
"Dpkg::Options::=\"--force-confdef\""
" -o "
"Dpkg::Options::=\"--force-confold\""
" -y --download-only {0}"
.format(packages), shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc = subprocess.Popen(
"DEBIAN_FRONTEND=noninteractive apt-get update "
"--allow-releaseinfo-change && "
"DEBIAN_FRONTEND=noninteractive "
"apt-get install -o "
"Dpkg::Options::=\"--force-confdef\""
" -o "
"Dpkg::Options::=\"--force-confold\""
" -y --download-only {0}"
.format(packages), shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc.wait()
if proc.returncode == 0: