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

@@ -11,13 +11,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
#### Changed
- WordOps is now installed from PyPI using pip [WordOps](https://pypi.org/project/wordops/)
- New Nginx package built with OpenSSL 1.1.1d and updated brotli module
- New Nginx package built with OpenSSL_1.1.1d and the latest ngx_brotli module
#### Fixed
- `wo stack upgrade` when using nginx-ee
- `wo secure --auth`
- `wo secure --sshport` not working with default ssh config
- Issues after APT repositories informations changed
### v3.9.9.2 - 2019-10-04

47
install
View File

@@ -9,7 +9,7 @@
# -------------------------------------------------------------------------
# wget -qO wo wops.cc && sudo bash wo
# -------------------------------------------------------------------------
# Version 3.9.9.3 - 2019-10-05
# Version 3.9.9.3 - 2019-10-08
# -------------------------------------------------------------------------
# CONTENTS
@@ -90,14 +90,15 @@ if [[ $EUID -ne 0 ]]; then
exit 100
fi
###
# 1- Update the apt sewers with fresh info
###
export DEBIAN_FRONTEND=noninteractive
unset LANG
export LANG='en_US.UTF-8'
export LC_ALL='C.UTF-8'
###
# 1- Main functions
###
# check if a command exist
command_exists() {
command -v "$@" > /dev/null 2>&1
@@ -114,14 +115,9 @@ _run() {
}
check_path() {
if [ -d "$1" ]; then
return 0
else
return 1
fi
}
###
# 1- Update the apt sewers with fresh info
###
if [ -z "$wo_travis" ]; then
if command_exists curl; then
apt-get update -qq
@@ -219,18 +215,32 @@ wo_dist_upgrade() {
apt-get dist-upgrade --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet
}
# install apt-mirror-updater and find the fastest mirror available
wo_apt_mirror() {
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
python3-pip python3-wheel python3-apt python3-setuptools > /dev/null 2>&1
python3 -m pip install pip --upgrade
if {
python3 -m pip install apt-mirror-updater --upgrade
}; then
/usr/local/bin/apt-mirror-updater -a
fi
}
wo_install_dep() {
if [ "$wo_linux_distro" == "Ubuntu" ]; then
# install dependencies
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
build-essential curl gzip python3-pip python3-wheel python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz \
gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1
build-essential curl gzip python3-dev sqlite3 git tar software-properties-common pigz \
gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1
add-apt-repository ppa:wordops/nginx-wo -yn
else
# install dependencies
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
build-essential curl gzip dirmngr sudo python3 python3-pip python3-wheel python3-apt python3-setuptools python3-dev ca-certificates sqlite3 git tar \
build-essential curl gzip dirmngr sudo python3-dev ca-certificates sqlite3 git tar \
software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1
# add php repository gpg key
[ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; }
@@ -455,7 +465,6 @@ wo_git_config() {
# WordOps install
wo_install() {
python3 -m pip install pip --upgrade
python3 -m pip install wordops --upgrade
cp -rf /usr/local/lib/python3.*/dist-packages/etc/* /etc/
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
@@ -465,7 +474,6 @@ wo_install() {
# WordOps install
wo_travis_install() {
python3 -m pip install pip --upgrade
python3 -m pip install dist/*.whl --upgrade
cp -rf /usr/local/lib/python3.*/dist-packages/etc/* /etc/
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
@@ -588,7 +596,9 @@ wo_backup_ee() {
}
wo_backup_wo() {
/bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /etc/wo /var/lib/wo
if [ -d /etc/nginx ] && [ -d /etc/wo ] && [ -d /var/lib/wo ]; then
/bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /etc/wo /var/lib/wo
fi
return 0
}
@@ -774,6 +784,7 @@ else
_run wo_remove_ee_cron "Removing EasyEngine cronjob"
_run wo_sync_db "Syncing WO database"
fi
_run wo_apt_mirror "Finding the fastest APT mirror"
_run wo_install_dep "Installing wo dependencies"
_run wo_timesync
#if [ "$ufw" = "y" ]; then

View File

@@ -63,7 +63,6 @@ setup(name='wordops',
'SQLAlchemy >= 1.3.8',
'requests >= 2.22.0',
'distro >= 1.4.0',
'apt-mirror-updater >= 6.1',
],
extras_require={ # Optional
'testing': ['nose', 'coverage'],

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: