fix: auto-install libnss3-tools if certutil is missing

- Checks for certutil command before use
- Automatically installs libnss3-tools package if needed
- Works with sudo for non-root users
- Prevents 'command not found' errors
This commit is contained in:
root
2025-10-23 10:15:02 +02:00
parent 23afabb28e
commit 823c6a9056

View File

@@ -26,6 +26,17 @@ else
RUNNING_AS_ROOT=false
fi
# Check for certutil
if ! command -v certutil &> /dev/null; then
echo "⚠ certutil not found, installing libnss3-tools..."
if [ "$RUNNING_AS_ROOT" = true ]; then
apt-get update && apt-get install -y libnss3-tools
else
$SUDO apt-get update && $SUDO apt-get install -y libnss3-tools
fi
echo ""
fi
# Step 1: Download CA certificate from UCS server
echo "[1/5] Downloading CA certificate from UCS server..."
scp root@${UCS_SERVER}:/etc/univention/ssl/ucsCA/CAcert.pem "$TEMP_CERT"