File size: 2,689 Bytes
ba6b4f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
#
# setup.sh
#
# Run the RunPod ComfyUI setup steps.
#
# Usage:
#
#   ./setup.sh
#

set -eu

########################################################################
# Configuration
########################################################################

CONFIG_FILE="config.env"
HF_SCRIPT="download_hf.sh"
WORKFLOW_LIST="workflow_files.txt"
INSTALL_NODES_SCRIPT="install_nodes.sh"
CIVITAI_SCRIPT="download_civitai.sh"

########################################################################
# Locate script directory
########################################################################

SCRIPT_DIR=$(
    CDPATH= cd -- "$(dirname -- "$0")" &&
    pwd
)

########################################################################
# Load configuration
########################################################################

CONFIG_PATH="$SCRIPT_DIR/$CONFIG_FILE"

if [ -f "$CONFIG_PATH" ]
then
    # shellcheck source=/dev/null
    . "$CONFIG_PATH"
else
    echo "Warning: config.env not found:"
    echo "    $CONFIG_PATH"
    echo "If private Hugging Face repositories or Civitai downloads are needed, create config.env first."
fi

########################################################################
# Helpers
########################################################################

run_step()
{
    STEP_NAME=$1
    SCRIPT_PATH=$2
    shift 2

    echo
    echo "=================================================="
    echo "$STEP_NAME"
    echo "=================================================="

    if [ ! -f "$SCRIPT_PATH" ]
    then
        echo "Error: script not found:"
        echo "    $SCRIPT_PATH"
        exit 1
    fi

    if [ ! -x "$SCRIPT_PATH" ]
    then
        echo "Error: script is not executable:"
        echo "    $SCRIPT_PATH"
        echo "Run: chmod +x $SCRIPT_PATH"
        exit 1
    fi

    "$SCRIPT_PATH" "$@"
}

########################################################################
# Main
########################################################################

echo

echo "=================================================="
echo "RunPod ComfyUI setup started."
echo "Script directory: $SCRIPT_DIR"
echo "=================================================="

run_step "Step 1: Download Hugging Face files" "$SCRIPT_DIR/$HF_SCRIPT"
run_step "Step 2: Download workflow files" "$SCRIPT_DIR/$HF_SCRIPT" "$WORKFLOW_LIST"
run_step "Step 3: Install custom nodes" "$SCRIPT_DIR/$INSTALL_NODES_SCRIPT"
run_step "Step 4: Download Civitai files" "$SCRIPT_DIR/$CIVITAI_SCRIPT"

echo

echo "=================================================="
echo "RunPod ComfyUI setup completed."
echo "=================================================="