adbrasi commited on
Commit
d5483f6
verified
1 Parent(s): fcdfa5b

Upload PackreatorComfyUi.sh

Browse files
Files changed (1) hide show
  1. PackreatorComfyUi.sh +25 -55
PackreatorComfyUi.sh CHANGED
@@ -29,7 +29,7 @@ readonly DOWNLOAD_FILES=(
29
  "https://civitai.com/api/download/models/1761560?type=Model&format=SafeTensor&size=pruned&fp=fp16|checkpoints|"
30
  "https://civitai.com/api/download/models/1268294?type=Model&format=SafeTensor|loras|"
31
  "https://civitai.com/api/download/models/1715330?type=Model&format=SafeTensor|loras|"
32
- "https://civitai.com/api/download/models/1499397?type=Model&format=SafeTensor|loras|" # NOVO LORA ADICIONADO
33
  "https://huggingface.co/Kim2091/AnimeSharpV3/resolve/main/2x-AnimeSharpV3.pth|upscale_models|2x-AnimeSharpV3.pth"
34
  "https://huggingface.co/adbrasi/testedownload/resolve/main/99coins_anime_girl_face_m_seg.pt|ultralytics/bbox|99coins_anime_girl_face_m_seg.pt"
35
  )
@@ -198,7 +198,6 @@ install_comfy_cli() {
198
  install_comfyui_core() {
199
  log_info "Installing ComfyUI core..."
200
 
201
- # MODIFICADO: Adicionado --fast-deps
202
  comfy --workspace "$COMFY_INSTALL_DIR" --skip-prompt install --nvidia --fast-deps || {
203
  log_error "Failed to install ComfyUI core"
204
  exit 1
@@ -230,13 +229,11 @@ create_model_directories() {
230
  install_custom_nodes() {
231
  log_info "Installing custom nodes..."
232
 
233
- # MODIFICADO: Adicionado instala莽茫o via registro
234
  log_info "Installing custom node from registry: civicomfy"
235
  comfy --workspace "$COMFY_INSTALL_DIR" node registry-install civicomfy || {
236
  log_warning "Failed to install custom node from registry: civicomfy"
237
  }
238
 
239
- # MODIFICADO: Nova lista de n贸s a partir do Git
240
  for node_url in "${CUSTOM_NODES[@]}"; do
241
  log_info "Installing custom node from Git: $node_url"
242
  comfy --workspace "$COMFY_INSTALL_DIR" node install "$node_url" || {
@@ -290,16 +287,20 @@ download_file() {
290
 
291
  if ! $success && command_exists curl; then
292
  log_warning "Using curl fallback for $url"
293
- if [ -n "$filename" ]; {
294
- download_cmd="curl -L -C - -o \"$target_dir/$filename\" \"$url\"";
295
- } else {
 
296
  if curl --help 2>/dev/null | grep -q "output-dir"; then
297
- download_cmd="curl -L -J -O --output-dir \"$target_dir\" \"$url\"";
298
  else
299
- local fallback_name; fallback_name=$(basename "$url" | cut -d'?' -f1); [ -z "$fallback_name" ] && fallback_name="downloaded_file"
300
- download_cmd="curl -L -C - -o \"$target_dir/$fallback_name\" \"$url\"";
301
- fi;
302
- }
 
 
 
303
  if eval "$download_cmd"; then success=true; fi
304
  fi
305
 
@@ -359,7 +360,7 @@ download_all_files() {
359
  }
360
 
361
  # ============================================================================
362
- # WORKFLOW DOWNLOAD (NOVA FUN脟脙O)
363
  # ============================================================================
364
 
365
  download_workflow() {
@@ -368,27 +369,20 @@ download_workflow() {
368
 
369
  local success=false
370
 
371
- # Tenta diferentes m茅todos de download
372
  if command_exists wget; then
373
- if wget -q --show-progress -O "$WORKFLOW_FILE" "$WORKFLOW_URL"; then
374
- success=true
375
- fi
376
- elif command_exists curl; then
377
- if curl -L -o "$WORKFLOW_FILE" "$WORKFLOW_URL"; then
378
- success=true
379
- fi
380
- elif command_exists aria2c; then
381
- # aria2c precisa do nome do arquivo e diret贸rio separados
382
- if aria2c -q -o "$(basename "$WORKFLOW_FILE")" -d "$(dirname "$WORKFLOW_FILE")" "$WORKFLOW_URL"; then
383
- success=true
384
- fi
385
- else
386
- log_error "Nenhuma ferramenta de download dispon铆vel (wget, curl ou aria2c)."
387
- exit 1
388
  fi
389
 
390
  if ! $success; then
391
- log_error "Falha ao baixar o arquivo do workflow."
392
  exit 1
393
  fi
394
 
@@ -401,7 +395,7 @@ download_workflow() {
401
  }
402
 
403
  # ============================================================================
404
- # DEPEND脢NCIAS DO WORKFLOW (NOVA FUN脟锟斤拷O)
405
  # ============================================================================
406
 
407
  install_workflow_dependencies() {
@@ -412,7 +406,6 @@ install_workflow_dependencies() {
412
  return 1
413
  fi
414
 
415
- # Usa o workspace correto para instalar as depend锚ncias
416
  comfy --workspace "$COMFY_INSTALL_DIR" node install-deps --workflow="$WORKFLOW_FILE" || {
417
  log_warning "Algumas depend锚ncias do workflow podem ter falhado ao instalar."
418
  log_info "Isso pode ser normal. O ComfyUI mostrar谩 os n贸s ausentes ao iniciar."
@@ -430,7 +423,6 @@ launch_comfyui() {
430
  log_info "Launching ComfyUI on port 8818..."
431
  log_info "ComfyUI will be accessible at: http://0.0.0.0:8818"
432
 
433
- # Launch ComfyUI
434
  exec comfy --workspace "$COMFY_INSTALL_DIR" launch -- --fast --listen 0.0.0.0 --port 8818
435
  }
436
 
@@ -442,37 +434,17 @@ main() {
442
  log_info "Starting ComfyUI automated setup..."
443
  log_info "========================================"
444
 
445
- # Step 1: Environment Detection
446
  detect_environment
447
-
448
- # Step 2: Permission Setup
449
  setup_permissions
450
-
451
- # Step 3: System Dependencies
452
  install_system_dependencies
453
-
454
- # Step 4: Install comfy-cli
455
  install_comfy_cli
456
-
457
- # Step 5: Install ComfyUI Core
458
  install_comfyui_core
459
-
460
- # Step 6: Create Directory Structure
461
  create_model_directories
462
-
463
- # Step 7: Install Custom Nodes
464
  install_custom_nodes
465
-
466
- # Step 8: Download Files in Parallel
467
  download_all_files
468
-
469
- # Step 9: Download Workflow
470
  download_workflow
471
-
472
- # Step 10: Install Workflow Dependencies
473
  install_workflow_dependencies
474
 
475
- # Step 11: Launch ComfyUI
476
  log_info "========================================"
477
  log_info "Setup completed successfully!"
478
  log_info "========================================"
@@ -483,8 +455,6 @@ main() {
483
  # SCRIPT EXECUTION
484
  # ============================================================================
485
 
486
- # Trap to handle script interruption
487
  trap 'log_error "Script interrupted"; exit 1' INT TERM
488
 
489
- # Run main function
490
  main "$@"
 
29
  "https://civitai.com/api/download/models/1761560?type=Model&format=SafeTensor&size=pruned&fp=fp16|checkpoints|"
30
  "https://civitai.com/api/download/models/1268294?type=Model&format=SafeTensor|loras|"
31
  "https://civitai.com/api/download/models/1715330?type=Model&format=SafeTensor|loras|"
32
+ "https://civitai.com/api/download/models/1499397?type=Model&format=SafeTensor|loras|"
33
  "https://huggingface.co/Kim2091/AnimeSharpV3/resolve/main/2x-AnimeSharpV3.pth|upscale_models|2x-AnimeSharpV3.pth"
34
  "https://huggingface.co/adbrasi/testedownload/resolve/main/99coins_anime_girl_face_m_seg.pt|ultralytics/bbox|99coins_anime_girl_face_m_seg.pt"
35
  )
 
198
  install_comfyui_core() {
199
  log_info "Installing ComfyUI core..."
200
 
 
201
  comfy --workspace "$COMFY_INSTALL_DIR" --skip-prompt install --nvidia --fast-deps || {
202
  log_error "Failed to install ComfyUI core"
203
  exit 1
 
229
  install_custom_nodes() {
230
  log_info "Installing custom nodes..."
231
 
 
232
  log_info "Installing custom node from registry: civicomfy"
233
  comfy --workspace "$COMFY_INSTALL_DIR" node registry-install civicomfy || {
234
  log_warning "Failed to install custom node from registry: civicomfy"
235
  }
236
 
 
237
  for node_url in "${CUSTOM_NODES[@]}"; do
238
  log_info "Installing custom node from Git: $node_url"
239
  comfy --workspace "$COMFY_INSTALL_DIR" node install "$node_url" || {
 
287
 
288
  if ! $success && command_exists curl; then
289
  log_warning "Using curl fallback for $url"
290
+ # =================== BLOCO CORRIGIDO ===================
291
+ if [ -n "$filename" ]; then
292
+ download_cmd="curl -L -C - -o \"$target_dir/$filename\" \"$url\""
293
+ else
294
  if curl --help 2>/dev/null | grep -q "output-dir"; then
295
+ download_cmd="curl -L -J -O --output-dir \"$target_dir\" \"$url\""
296
  else
297
+ local fallback_name
298
+ fallback_name=$(basename "$url" | cut -d'?' -f1)
299
+ [ -z "$fallback_name" ] && fallback_name="downloaded_file"
300
+ download_cmd="curl -L -C - -o \"$target_dir/$fallback_name\" \"$url\""
301
+ fi
302
+ fi
303
+ # ======================================================
304
  if eval "$download_cmd"; then success=true; fi
305
  fi
306
 
 
360
  }
361
 
362
  # ============================================================================
363
+ # WORKFLOW DOWNLOAD
364
  # ============================================================================
365
 
366
  download_workflow() {
 
369
 
370
  local success=false
371
 
 
372
  if command_exists wget; then
373
+ if wget -q --show-progress -O "$WORKFLOW_FILE" "$WORKFLOW_URL"; then success=true; fi
374
+ fi
375
+
376
+ if ! $success && command_exists curl; then
377
+ if curl -L -o "$WORKFLOW_FILE" "$WORKFLOW_URL"; then success=true; fi
378
+ fi
379
+
380
+ if ! $success && command_exists aria2c; then
381
+ if aria2c -q -o "$(basename "$WORKFLOW_FILE")" -d "$(dirname "$WORKFLOW_FILE")" "$WORKFLOW_URL"; then success=true; fi
 
 
 
 
 
 
382
  fi
383
 
384
  if ! $success; then
385
+ log_error "Nenhuma ferramenta de download (wget, curl, aria2c) funcionou ou est谩 dispon铆vel."
386
  exit 1
387
  fi
388
 
 
395
  }
396
 
397
  # ============================================================================
398
+ # WORKFLOW DEPENDENCIES
399
  # ============================================================================
400
 
401
  install_workflow_dependencies() {
 
406
  return 1
407
  fi
408
 
 
409
  comfy --workspace "$COMFY_INSTALL_DIR" node install-deps --workflow="$WORKFLOW_FILE" || {
410
  log_warning "Algumas depend锚ncias do workflow podem ter falhado ao instalar."
411
  log_info "Isso pode ser normal. O ComfyUI mostrar谩 os n贸s ausentes ao iniciar."
 
423
  log_info "Launching ComfyUI on port 8818..."
424
  log_info "ComfyUI will be accessible at: http://0.0.0.0:8818"
425
 
 
426
  exec comfy --workspace "$COMFY_INSTALL_DIR" launch -- --fast --listen 0.0.0.0 --port 8818
427
  }
428
 
 
434
  log_info "Starting ComfyUI automated setup..."
435
  log_info "========================================"
436
 
 
437
  detect_environment
 
 
438
  setup_permissions
 
 
439
  install_system_dependencies
 
 
440
  install_comfy_cli
 
 
441
  install_comfyui_core
 
 
442
  create_model_directories
 
 
443
  install_custom_nodes
 
 
444
  download_all_files
 
 
445
  download_workflow
 
 
446
  install_workflow_dependencies
447
 
 
448
  log_info "========================================"
449
  log_info "Setup completed successfully!"
450
  log_info "========================================"
 
455
  # SCRIPT EXECUTION
456
  # ============================================================================
457
 
 
458
  trap 'log_error "Script interrupted"; exit 1' INT TERM
459
 
 
460
  main "$@"