Spaces:
Running
Running
adds graceful fallback when root in launch.ch
Browse files
launch.sh
CHANGED
|
@@ -400,8 +400,29 @@ print_step "Step 7: Environment Setup"
|
|
| 400 |
echo "============================"
|
| 401 |
|
| 402 |
print_info "Installing system dependencies..."
|
| 403 |
-
|
| 404 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 405 |
|
| 406 |
print_info "Creating Python virtual environment..."
|
| 407 |
python3 -m venv smollm3_env
|
|
|
|
| 400 |
echo "============================"
|
| 401 |
|
| 402 |
print_info "Installing system dependencies..."
|
| 403 |
+
|
| 404 |
+
# Check if we're already root or if sudo is available
|
| 405 |
+
if [ "$EUID" -eq 0 ]; then
|
| 406 |
+
# Already root, no need for sudo
|
| 407 |
+
print_info "Running as root, skipping sudo..."
|
| 408 |
+
apt-get update
|
| 409 |
+
apt-get install -y git curl wget unzip python3-pip python3-venv
|
| 410 |
+
elif command -v sudo >/dev/null 2>&1; then
|
| 411 |
+
# sudo is available, use it
|
| 412 |
+
print_info "Using sudo for system dependencies..."
|
| 413 |
+
sudo apt-get update
|
| 414 |
+
sudo apt-get install -y git curl wget unzip python3-pip python3-venv
|
| 415 |
+
else
|
| 416 |
+
# No sudo available, try without it
|
| 417 |
+
print_warning "sudo not available, attempting to install without sudo..."
|
| 418 |
+
if command -v apt-get >/dev/null 2>&1; then
|
| 419 |
+
apt-get update
|
| 420 |
+
apt-get install -y git curl wget unzip python3-pip python3-venv
|
| 421 |
+
else
|
| 422 |
+
print_warning "apt-get not available, skipping system dependencies..."
|
| 423 |
+
print_info "Please ensure git, curl, wget, unzip, python3-pip, and python3-venv are installed"
|
| 424 |
+
fi
|
| 425 |
+
fi
|
| 426 |
|
| 427 |
print_info "Creating Python virtual environment..."
|
| 428 |
python3 -m venv smollm3_env
|