From b2f12824ac5cc33e56f9a5f33e4402a77d5b9329 Mon Sep 17 00:00:00 2001 From: Dmitrii Date: Wed, 22 Apr 2026 09:21:29 -0400 Subject: [PATCH] fix: check-deps uses sudo -n and pip --user, no TTY required sudo -n skips apt silently if no sudo rights (SSH non-interactive). Falls back to python3 -m pip install --user which never needs root, then ensurepip if pip module is missing. Friendly error if all fail. Co-Authored-By: Claude Sonnet 4.6 --- Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0981e01..f4cf846 100644 --- a/Makefile +++ b/Makefile @@ -40,13 +40,17 @@ help: # Setup commands check-deps: @echo "Checking system dependencies..." - @which python3 >/dev/null 2>&1 || (echo "Installing python3..." && sudo apt-get install -y python3) - @which pip3 >/dev/null 2>&1 || (echo "Installing pip3..." && sudo apt-get install -y python3-pip) - @python3 -c "import cryptography" 2>/dev/null || \ - (echo "Installing python3-cryptography..." && \ - (sudo apt-get install -y python3-cryptography 2>/dev/null || \ - pip3 install --break-system-packages cryptography 2>/dev/null || \ - pip3 install cryptography)) + @which python3 >/dev/null 2>&1 || \ + { echo "Installing python3..." && sudo -n apt-get install -y python3 2>/dev/null || \ + { echo "ERROR: python3 not found. Run: sudo apt-get install -y python3" ; exit 1 ; } ; } + @python3 -c "import cryptography" 2>/dev/null || { \ + echo "Installing python3-cryptography..." ; \ + sudo -n apt-get install -y python3-cryptography 2>/dev/null || \ + python3 -m pip install --user cryptography 2>/dev/null || \ + { python3 -m ensurepip --upgrade 2>/dev/null && python3 -m pip install --user cryptography 2>/dev/null ; } || \ + { echo "ERROR: Cannot install python3-cryptography. Run: sudo apt-get install python3-cryptography" ; exit 1 ; } ; } + @python3 -c "import cryptography" >/dev/null 2>&1 || \ + { echo "ERROR: python3-cryptography still not found. Run: sudo apt-get install python3-cryptography" ; exit 1 ; } @echo "Dependencies OK." setup: check-deps