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 #### Changed
- WordOps is now installed from PyPI using pip [WordOps](https://pypi.org/project/wordops/) - 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 #### Fixed
- `wo stack upgrade` when using nginx-ee - `wo stack upgrade` when using nginx-ee
- `wo secure --auth` - `wo secure --auth`
- `wo secure --sshport` not working with default ssh config - `wo secure --sshport` not working with default ssh config
- Issues after APT repositories informations changed
### v3.9.9.2 - 2019-10-04 ### v3.9.9.2 - 2019-10-04

47
install
View File

@@ -9,7 +9,7 @@
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# wget -qO wo wops.cc && sudo bash wo # 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 # CONTENTS
@@ -90,14 +90,15 @@ if [[ $EUID -ne 0 ]]; then
exit 100 exit 100
fi fi
###
# 1- Update the apt sewers with fresh info
###
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
unset LANG unset LANG
export LANG='en_US.UTF-8' export LANG='en_US.UTF-8'
export LC_ALL='C.UTF-8' export LC_ALL='C.UTF-8'
###
# 1- Main functions
###
# check if a command exist # check if a command exist
command_exists() { command_exists() {
command -v "$@" > /dev/null 2>&1 command -v "$@" > /dev/null 2>&1
@@ -114,14 +115,9 @@ _run() {
} }
check_path() { ###
if [ -d "$1" ]; then # 1- Update the apt sewers with fresh info
return 0 ###
else
return 1
fi
}
if [ -z "$wo_travis" ]; then if [ -z "$wo_travis" ]; then
if command_exists curl; then if command_exists curl; then
apt-get update -qq 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 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() { wo_install_dep() {
if [ "$wo_linux_distro" == "Ubuntu" ]; then if [ "$wo_linux_distro" == "Ubuntu" ]; then
# install dependencies # install dependencies
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ 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 \ build-essential curl gzip python3-dev sqlite3 git tar software-properties-common pigz \
gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1 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 add-apt-repository ppa:wordops/nginx-wo -yn
else else
# install dependencies # install dependencies
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ 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 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 # 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; } [ -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 # WordOps install
wo_install() { wo_install() {
python3 -m pip install pip --upgrade
python3 -m pip install wordops --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/etc/* /etc/
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/ cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
@@ -465,7 +474,6 @@ wo_install() {
# WordOps install # WordOps install
wo_travis_install() { wo_travis_install() {
python3 -m pip install pip --upgrade
python3 -m pip install dist/*.whl --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/etc/* /etc/
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/ cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
@@ -588,7 +596,9 @@ wo_backup_ee() {
} }
wo_backup_wo() { 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 return 0
} }
@@ -774,6 +784,7 @@ else
_run wo_remove_ee_cron "Removing EasyEngine cronjob" _run wo_remove_ee_cron "Removing EasyEngine cronjob"
_run wo_sync_db "Syncing WO database" _run wo_sync_db "Syncing WO database"
fi fi
_run wo_apt_mirror "Finding the fastest APT mirror"
_run wo_install_dep "Installing wo dependencies" _run wo_install_dep "Installing wo dependencies"
_run wo_timesync _run wo_timesync
#if [ "$ufw" = "y" ]; then #if [ "$ufw" = "y" ]; then

View File

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

View File

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

View File

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