From b1e9262f920ccbdc784d02cd8a36eedf57287fc6 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 26 Feb 2020 10:01:27 +0100 Subject: [PATCH] Fix install on raspberry pi 4 --- install | 8 ++++---- wo/cli/plugins/stack_pref.py | 28 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/install b/install index 5c296c1..0656fe8 100755 --- a/install +++ b/install @@ -7,9 +7,9 @@ # Copyright (c) 2019-2020 - WordOps # This script is licensed under M.I.T # ------------------------------------------------------------------------- -# wget -qO wo wops.cc && sudo bash wo +# wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.11.4 - 2020-01-17 +# Version 3.11.5 - 2020-02-11 # ------------------------------------------------------------------------- # CONTENTS @@ -433,10 +433,10 @@ wo_install() { rm -f /usr/local/bin/wo if [ "$wo_branch" = "master" ]; then python3 -m pip uninstall wo -y - python3 -m pip install --upgrade wordops + python3 -m pip install -I wordops else python3 -m pip uninstall wo -y - python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" + python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" fi cp -rf /usr/local/lib/python3."$python_ver"/dist-packages/usr/* /usr/ cp -rn /usr/local/lib/python3."$python_ver"/dist-packages/etc/* /etc/ diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index c4c341b..c63b670 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -322,14 +322,28 @@ def post_pref(self, apt_packages, packages, upgrade=False): os.makedirs('/etc/nginx/sites-enabled') # 22222 port settings + if os.path.exists('/etc/nginx/sites-available/22222'): + Log.debug(self, "looking for the current backend port") + for line in open('/etc/nginx/sites-available/22222', + encoding='utf-8'): + if 'listen' in line: + listen_line = line.strip() + break + port = (listen_line).split(' ') + current_backend_port = (port[1]).strip() + else: + current_backend_port = '22222' + + if 'current_backend_port' not in locals(): + current_backend_port = '22222' + data = dict(webroot=ngxroot, - release=WOVar.wo_version, port='22222') - if not WOFileUtils.grepcheck( - self, 'WordOps', '/etc/nginx/sites-available/22222'): - WOTemplate.deploy( - self, - '/etc/nginx/sites-available/22222', - '22222.mustache', data, overwrite=True) + release=WOVar.wo_version, port=current_backend_port) + WOTemplate.deploy( + self, + '/etc/nginx/sites-available/22222', + '22222.mustache', data, overwrite=True) + passwd = ''.join([random.choice (string.ascii_letters + string.digits) for n in range(24)])