From 78c0b56bbcbdefa53676ab830db13b0569601f1f Mon Sep 17 00:00:00 2001 From: Andriy Utkin Date: Fri, 5 Jul 2024 11:00:10 +0100 Subject: [PATCH] postinstall: don't try to install pip if it's already there MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Debian 10, using our installer, `apt install bluecherry` step fails. We still want a recent certbot on Debian 10, not the extra-old deb-packaged one. ++ wget --output-document=/tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py --2024-07-05 09:34:20-- https://bootstrap.pypa.io/get-pip.py Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 199.232.72.175, 2a04:4e42:52::175 Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|199.232.72.175|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2277800 (2.2M) [text/x-python] Saving to: ‘/tmp/get-pip.py’ /tmp/get-pip.py 100%[==============================================================================>] 2.17M --.-KB/s in 0.06s 2024-07-05 09:34:20 (34.0 MB/s) - ‘/tmp/get-pip.py’ saved [2277800/2277800] ++ python3 /tmp/get-pip.py ERROR: This script does not work on Python 3.7. The minimum supported Python version is 3.8. Please use https://bootstrap.pypa.io/pip/3.7/get-pip.py instead. ++ return dpkg: error processing package bluecherry (--configure): installed bluecherry package post-installation script subprocess returned error exit status 1 Processing triggers for libc-bin (2.28-10+deb10u4) ... Errors were encountered while processing: bluecherry E: Sub-process /usr/bin/dpkg returned an error code (1) --- misc/postinstall.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/misc/postinstall.sh b/misc/postinstall.sh index 1a618d4a..8e88dd4c 100755 --- a/misc/postinstall.sh +++ b/misc/postinstall.sh @@ -81,6 +81,10 @@ function stop_nginx function install_pip { + # If already installed - nothing to do + if which pip3 >/dev/null; then + return + fi source /etc/os-release if [[ "$ID" == ubuntu ]] && [[ "$VERSION_CODENAME" == bionic ]]; then @@ -110,10 +114,10 @@ function install_certbot install_pip || return # Install pip3 dependencies - /usr/local/bin/pip3 install --user --upgrade setuptools_rust certbot certbot-dns-subdomain-provider - /usr/local/bin/pip3 install --user --upgrade pip - /usr/local/bin/pip3 install --user --upgrade cryptography - /usr/local/bin/pip3 install pyopenssl --upgrade + pip3 install --user --upgrade setuptools_rust certbot certbot-dns-subdomain-provider + pip3 install --user --upgrade pip || true + pip3 install --user --upgrade cryptography + pip3 install pyopenssl --upgrade } function start_apache