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 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 09:21:29 -04:00
parent 1e43f408bc
commit b2f12824ac
+11 -7
View File
@@ -40,13 +40,17 @@ help:
# Setup commands # Setup commands
check-deps: check-deps:
@echo "Checking system dependencies..." @echo "Checking system dependencies..."
@which python3 >/dev/null 2>&1 || (echo "Installing python3..." && sudo apt-get install -y python3) @which python3 >/dev/null 2>&1 || \
@which pip3 >/dev/null 2>&1 || (echo "Installing pip3..." && sudo apt-get install -y python3-pip) { echo "Installing python3..." && sudo -n apt-get install -y python3 2>/dev/null || \
@python3 -c "import cryptography" 2>/dev/null || \ { echo "ERROR: python3 not found. Run: sudo apt-get install -y python3" ; exit 1 ; } ; }
(echo "Installing python3-cryptography..." && \ @python3 -c "import cryptography" 2>/dev/null || { \
(sudo apt-get install -y python3-cryptography 2>/dev/null || \ echo "Installing python3-cryptography..." ; \
pip3 install --break-system-packages cryptography 2>/dev/null || \ sudo -n apt-get install -y python3-cryptography 2>/dev/null || \
pip3 install cryptography)) 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." @echo "Dependencies OK."
setup: check-deps setup: check-deps