Improve apt-get update process

This commit is contained in:
VirtuBox
2019-10-11 12:39:00 +02:00
parent e32a2a1102
commit e42eb52bba
2 changed files with 28 additions and 20 deletions

View File

@@ -447,8 +447,8 @@ wo_git_config() {
fi
# .gitconfig inital setup
#cd /var/lib/wo/tmp/WordOps-install || exit 1
#python3 gitconfig.py
cd /var/lib/wo/tmp/WordOps-install || exit 1
python3 gitconfig.py
}

View File

@@ -19,12 +19,21 @@ class WOAptGet():
try:
with open('/var/log/wo/wordops.log', 'a') as f:
proc = subprocess.Popen(
'DEBIAN_FRONTEND=noninteractive apt-get update -qq',
'DEBIAN_FRONTEND=noninteractive apt-get update -qq '
'--allow-releaseinfo-change',
shell=True, stdin=None, stdout=f,
stderr=subprocess.PIPE, executable="/bin/bash")
proc.wait()
output, error_output = proc.communicate()
if "--allow-releaseinfo-change" in str(error_output):
proc = subprocess.Popen(
'DEBIAN_FRONTEND=noninteractive apt-get update -qq',
shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc.wait()
output, error_output = proc.communicate()
# Check what is error in error_output
if "NO_PUBKEY" in str(error_output):
# Split the output
@@ -38,10 +47,11 @@ class WOAptGet():
WORepo.add_key(
self, key, keyserver="hkp://pgp.mit.edu")
proc = subprocess.Popen('apt-get update',
shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc = subprocess.Popen(
'DEBIAN_FRONTEND=noninteractive apt-get update -qq',
shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc.wait()
if proc.returncode == 0:
@@ -84,11 +94,11 @@ class WOAptGet():
with open('/var/log/wo/wordops.log', 'a') as f:
proc = subprocess.Popen(
"DEBIAN_FRONTEND=noninteractive "
"apt-get dist-upgrade "
"apt-get "
"--option=Dpkg::options::=--force-confdef "
"--option=Dpkg::options::=--force-unsafe-io "
"--option=Dpkg::options::=--force-confold "
"--assume-yes --quiet ",
"--assume-yes --quiet dist-upgrade",
shell=True, stdin=None,
stdout=f, stderr=f,
executable="/bin/bash")
@@ -111,17 +121,15 @@ class WOAptGet():
all_packages = ' '.join(packages)
try:
with open('/var/log/wo/wordops.log', 'a') as f:
proc = subprocess.Popen("DEBIAN_FRONTEND=noninteractive "
"apt-get install "
"--option=Dpkg::options::="
"--force-confdef "
"--option=Dpkg::options::="
"--force-confold "
"--assume-yes "
"--allow-unauthenticated {0}"
.format(all_packages), shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc = subprocess.Popen(
"DEBIAN_FRONTEND=noninteractive "
"apt-get install "
"--option=Dpkg::options::=--force-confdef "
"--option=Dpkg::options::=--force-confold "
"--assume-yes --allow-unauthenticated {0}"
.format(all_packages), shell=True,
stdin=None, stdout=f, stderr=f,
executable="/bin/bash")
proc.wait()
if proc.returncode == 0: