From 947efe1e21b4bd2d08632a2dc4fe65e2e4e080a1 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 11 Oct 2019 13:01:00 +0200 Subject: [PATCH] More improvement in aptget.py --- .travis.yml | 2 -- install | 75 ++--------------------------------------------- wo/core/aptget.py | 28 +++++++++--------- 3 files changed, 16 insertions(+), 89 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d62b60..7880919 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ dist: bionic language: bash notifications: - slack: wordops:MyZBNbI7JfhbAi3YyFckMdaa webhooks: secure: "JiGtzYplTyFg/L6Rsi7ptEQIV29O5qCWU2Zf5pLITsQrBrQO4cIXXp9G4Z+cenXjfIiqbqIgU0US3zXeIAl4g14xdfzmMYeMMwuKBpI8afMYv8MD6ldoP0MTFHQfROE6OXxKLVUvZn1R0oLLU1fzVSI0qGjNkt20cf/Lrt/reH/zS5hAI92kWI3u2zPu7Zn/g/a8MO/Y3Iv7v1PSQaVkVJVqtOK3U2GJqhIv2G1AVcaPb7Nh/V2zm2dDYBVT0UotBnlBUcUXbEMP77D9pjtWXd1/0rWuJIHixMjwUybpZqY75UMee5INynU6OZRsv029LRHAIMkWhfBkdVN/U5jhQJzui14+vRQrb5nfUMG8Cd8INojDlu6dk/ps2GzTCCXBITeMQKAouUoHD2LEbsNp17xi1K4ZlKb3+0lrOAiS4JYFE6wOo4yMlLTYoquYSqk7AuxuUS8A5OD5MYxhk9uafiTSxKFOo39KYWTSaACsPD8q1swaTSjoYm9skyZvIkIFq5bHBCYEGFe6X/NY9l5tz3hSe+TJOerCHsg+dXVuQl+pIp5nw2as9TH9ox5Vgqc9Zh4GbTDQVvdAmUpmlsZ/SKoOMCkmkB1aRNFq/7RnERIJyAEGJbauHWmjtOM4cCxesl0L0b2Eab89zQpSn7pzE8JTiJgpzCUc22p653PTaqM=" @@ -31,7 +30,6 @@ before_script: after_script: - sudo cat /var/log/wo/install.log | ccze -A -p syslog - sudo bash install --purge - - sudo curl --progress-bar --upload-file /var/log/wo/wordops.log https://transfer.vtbox.net/"$(basename wordops.log)" && echo "" | sudo tee -a $HOME/.transfer.log && echo "" script: diff --git a/install b/install index 501e955..6128193 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo bash wo # ------------------------------------------------------------------------- -# Version 3.9.9.3 - 2019-10-08 +# Version 3.9.9.3 - 2019-10-11 # ------------------------------------------------------------------------- # CONTENTS @@ -126,7 +126,7 @@ if [ -z "$wo_travis" ]; then apt-get update -qq > /dev/null 2>&1 fi if ! command_exists curl; then - apt-get update -qq && apt-get -y install curl -qq > /dev/null 2>&1 + apt-get -y install curl -qq > /dev/null 2>&1 fi fi @@ -171,13 +171,8 @@ WO_ARCH="$(uname -m)" if [ -x /usr/local/bin/ee ]; then ee_migration=1 - ufw="n" elif [ -x /usr/local/bin/wo ]; then wo_upgrade=1 - ufw="n" -fi -if [ -z "$ufw" ]; then - ufw="y" fi ### # 1 - Checking linux distro @@ -689,66 +684,6 @@ wo_uninstall() { rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates } -wo_ufw_setup() { - if ! grep -q "ENABLED=yes" /etc/ufw/ufw.conf; then - # get custom ssh port - if [ -f /etc/ssh/sshd_config ]; then - CURRENT_SSH_PORT=$(grep "Port" /etc/ssh/sshd_config | awk -F " " '{print $2}') - fi - # define firewall rules - if ! grep -q "LOGLEVEL=low" /etc/ufw/ufw.conf; then - ufw logging low - fi - if ! grep -q 'DEFAULT_OUTPUT_POLICY="ACCEPT"' /etc/default/ufw; then - ufw default allow outgoing - fi - if ! grep -q 'DEFAULT_INPUT_POLICY="DROP"' /etc/default/ufw; then - ufw default deny incoming - fi - if ! grep -q "\-\-dport 22 -j" /etc/ufw/user.rules; then - # default ssh port - ufw limit 22 - fi - - # custom ssh port - if [ "$CURRENT_SSH_PORT" != "22" ]; then - if ! grep -q "\-\-dport $CURRENT_SSH_PORT -j" /etc/ufw/user.rules; then - ufw limit "$CURRENT_SSH_PORT" - fi - fi - - # nginx - if ! grep -q "\-\-dport 80 -j" /etc/ufw/user.rules; then - # http - ufw allow http - fi - if ! grep -q "\-\-dport 443 -j" /etc/ufw/user.rules; then - # https - ufw allow https - fi - - # ntp - if ! grep -q "\-\-dport 123 -j" /etc/ufw/user.rules; then - ufw allow 123 - fi - - if ! grep -q "\-\-dport 22222 -j" /etc/ufw/user.rules; then - # wordops backend - ufw limit 22222 - fi - # enable ufw - if [ -n "$CURRENT_SSH_PORT" ]; then - ufw --force enable - fi - - # remove ufw from syslog - if [ -f /etc/rsyslog.d/20-ufw.conf ]; then - sed -i 's/\#\& stop/\& stop/' /etc/rsyslog.d/20-ufw.conf - service rsyslog restart - fi - fi -} - wo_cheat_install() { curl -sL https://cht.sh/:cht.sh > /usr/local/bin/cht.sh chmod +x /usr/local/bin/cht.sh @@ -793,9 +728,6 @@ else fi _run wo_install_dep "Installing wo dependencies" _run wo_timesync - #if [ "$ufw" = "y" ]; then - # _run wo_ufw_setup "Configuring UFW" - #fi # skip steps if travis if [ -z "$wo_travis" ]; then _run wo_dist_upgrade @@ -860,6 +792,3 @@ else wo_lib_echo "Give WordOps a GitHub star : https://github.com/WordOps/WordOps/" echo fi -# if [ -z "$wo_travis" ]; then -# /bin/bash --init-file "/var/lib/wo/tmp/WordOps-$wo_branch/tests/init-file" -# fi diff --git a/wo/core/aptget.py b/wo/core/aptget.py index f7281c4..2fe2be9 100644 --- a/wo/core/aptget.py +++ b/wo/core/aptget.py @@ -154,19 +154,19 @@ class WOAptGet(): try: with open('/var/log/wo/wordops.log', 'a') as f: if purge: - proc = subprocess.Popen('DEBIAN_FRONTEND=noninteractive ' - 'apt-get autoremove --purge ' - '-qq {0}' - .format(all_packages), shell=True, - stdin=None, stdout=f, stderr=f, - executable="/bin/bash") + proc = subprocess.Popen( + 'DEBIAN_FRONTEND=noninteractive ' + 'apt-get autoremove --purge -qq {0}' + .format(all_packages), shell=True, + stdin=None, stdout=f, stderr=f, + executable="/bin/bash") else: - proc = subprocess.Popen('DEBIAN_FRONTEND=noninteractive ' - 'apt-get autoremove ' - '-qq {0}' - .format(all_packages), shell=True, - stdin=None, stdout=f, stderr=f, - executable="/bin/bash") + proc = subprocess.Popen( + 'DEBIAN_FRONTEND=noninteractive ' + 'apt-get autoremove -qq {0}' + .format(all_packages), shell=True, + stdin=None, stdout=f, stderr=f, + executable="/bin/bash") proc.wait() if proc.returncode == 0: return True @@ -235,13 +235,13 @@ class WOAptGet(): WORepo.add_key(self, repo_key) proc = subprocess.Popen( "DEBIAN_FRONTEND=noninteractive apt-get update " - "--allow-releaseinfo-change && " + "-qq && " "DEBIAN_FRONTEND=noninteractive " "apt-get install -o " "Dpkg::Options::=\"--force-confdef\"" " -o " "Dpkg::Options::=\"--force-confold\"" - " -y --download-only {0}" + " -y --download-only {0}" .format(packages), shell=True, stdin=None, stdout=f, stderr=f, executable="/bin/bash")