Skip to content

Commit

Permalink
fix: missing $* in generated run.sh
Browse files Browse the repository at this point in the history
add: install-comfy-cli-redhat.sh
  • Loading branch information
ltdrdata committed May 11, 2024
1 parent 4b4ddde commit 66efb90
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 7 deletions.
81 changes: 81 additions & 0 deletions scripts/install-comfy-cli-redhat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

# Flag to track if yum update has been run
update_flag=false

# Check if ~/comfy directory exists, create it if not
if [ ! -d "$(pwd)/comfy" ]; then
mkdir "$(pwd)/comfy"
fi

echo "[1/6] CHECK: python3"

# Check if Python3 is installed
if ! command -v python3 &> /dev/null; then
echo "Python3 is not installed. Starting installation..."
if [ "$(id -u)" -eq 0 ]; then # Check if running as root
yum update -y
yum install -y python3
else
sudo yum update -y
sudo yum install -y python3
fi
update_flag=true
fi

echo "[2/6] CHECK: git"

# Check if Git is installed
if ! command -v git &> /dev/null; then
echo "Git is not installed. Starting installation..."
if [ "$update_flag" == false ]; then
if [ "$(id -u)" -eq 0 ]; then # Check if running as root
yum update -y
else
sudo yum update -y
fi
update_flag=true
fi
if [ "$(id -u)" -eq 0 ]; then # Check if running as root
yum install -y git-core
else
sudo yum install -y git-core
fi
fi

echo "[3/6] CREATE: venv (~/comfy/venv)"

# Create virtual environment
if [ ! -d "$(pwd)/comfy/venv" ]; then
echo "Creating Python virtual environment..."
python3 -m venv "$(pwd)/comfy/venv"
fi

echo "[4/6] INSTALL: comfy-cli into venv"

# Install Comfy-CLI
echo "Installing Comfy-CLI..."
source "$(pwd)/comfy/venv/bin/activate"
pip install comfy-cli

echo "[5/6] INSTALL: ComfyUI into $(pwd)/comfy/ComfyUI"

# Run comfy install
echo "Running comfy install..."
comfy install

echo "[6/6] CREATE: Script for 'comfy launch'"
if [ ! -f "$(pwd)/comfy/run.sh" ]; then
echo "source $(pwd)/comfy/venv/bin/activate" > "$(pwd)/comfy/run.sh"
echo "comfy launch -- \$*" >> "$(pwd)/comfy/run.sh"
chmod +x "$(pwd)/comfy/run.sh"
else
echo "Script file already exists: ~/comfy/run.sh"
fi

# Print virtual environment path
echo "==========================================================="
echo "Virtual environment path: $(pwd)/comfy/venv"
echo "ComfyUI path: $(pwd)/comfy/ComfyUI"
echo "Default launch script path: $(pwd)/comfy/run.sh"
echo "DONE."
14 changes: 7 additions & 7 deletions scripts/install-comfy-cli-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ ! -d $(pwd)/comfy ]; then
mkdir $(pwd)/comfy
fi

echo "[1/6] CHECK: python3"
echo "[1/7] CHECK: python3"
# Check if Python3 is installed
if ! command -v python3 &> /dev/null
then
Expand All @@ -24,7 +24,7 @@ then
update_flag=true
fi

echo "[2/6] CHECK: python3-venv"
echo "[2/7] CHECK: python3-venv"
# Check if Python venv is installed
if ! dpkg -l | grep -qE 'python3\.[0-9]+-venv'; then
echo "Python3-venv is not installed. Starting installation..."
Expand All @@ -47,7 +47,7 @@ if ! dpkg -l | grep -qE 'python3\.[0-9]+-venv'; then
fi
fi

echo "[3/6] CHECK: git"
echo "[3/7] CHECK: git"
# Check if Git is installed
if ! command -v git &> /dev/null
then
Expand All @@ -72,21 +72,21 @@ then
fi
fi

echo "[4/6] CREATE: venv (~/comfy/venv)"
echo "[4/7] CREATE: venv (~/comfy/venv)"
# Create virtual environment
if [ ! -d $(pwd)/comfy/venv ]
then
echo "Creating Python virtual environment..."
python3 -m venv $(pwd)/comfy/venv
fi

echo "[5/6] INSTALL: comfy-cli into venv"
echo "[5/7] INSTALL: comfy-cli into venv"
# Install Comfy-CLI
echo "Installing Comfy-CLI..."
source $(pwd)/comfy/venv/bin/activate
pip install comfy-cli

echo "[6/6] INSTALL: ComfyUI into $(pwd)/comfy/ComfyUI"
echo "[6/7] INSTALL: ComfyUI into $(pwd)/comfy/ComfyUI"
# Run comfy install
echo "Running comfy install..."
comfy install
Expand All @@ -95,7 +95,7 @@ echo "[7/7] CREATE: Script for 'comfy launch'"
if [ ! -f $(pwd)/comfy/run.sh ]
then
echo "source $(pwd)/comfy/venv/bin/activate" > $(pwd)/comfy/run.sh
echo "comfy launch -- $*" >> $(pwd)/comfy/run.sh
echo "comfy launch -- \$*" >> $(pwd)/comfy/run.sh
chmod +x $(pwd)/comfy/run.sh
else
echo "Script file already exists: ~/comfy/run.sh"
Expand Down

0 comments on commit 66efb90

Please sign in to comment.