You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
479 lines
14 KiB
479 lines
14 KiB
#!/bin/bash |
|
# Script per creare il pacchetto DEB di ComfyUI Launcher |
|
|
|
set -e |
|
|
|
# Colori per output |
|
RED='\033[0;31m' |
|
GREEN='\033[0;32m' |
|
YELLOW='\033[1;33m' |
|
BLUE='\033[0;34m' |
|
NC='\033[0m' # No Color |
|
|
|
# Funzione per stampare messaggi colorati |
|
print_message() { |
|
echo -e "${BLUE}[INFO]${NC} $1" |
|
} |
|
|
|
print_success() { |
|
echo -e "${GREEN}[SUCCESS]${NC} $1" |
|
} |
|
|
|
print_warning() { |
|
echo -e "${YELLOW}[WARNING]${NC} $1" |
|
} |
|
|
|
print_error() { |
|
echo -e "${RED}[ERROR]${NC} $1" |
|
} |
|
|
|
# Verifica prerequisiti |
|
check_prerequisites() { |
|
print_message "Verifica prerequisiti per la creazione del pacchetto DEB..." |
|
|
|
# Lista dei pacchetti necessari |
|
local packages=( |
|
"build-essential" |
|
"devscripts" |
|
"debhelper" |
|
"dh-python" |
|
"python3-dev" |
|
"python3-setuptools" |
|
"python3-pip" |
|
"lintian" |
|
) |
|
|
|
local missing_packages=() |
|
|
|
for package in "${packages[@]}"; do |
|
if ! dpkg -l "$package" &>/dev/null; then |
|
missing_packages+=("$package") |
|
fi |
|
done |
|
|
|
if [ ${#missing_packages[@]} -gt 0 ]; then |
|
print_error "I seguenti pacchetti sono mancanti:" |
|
printf '%s\n' "${missing_packages[@]}" |
|
print_message "Installa i pacchetti mancanti con:" |
|
echo "sudo apt-get install ${missing_packages[*]}" |
|
exit 1 |
|
fi |
|
|
|
print_success "Tutti i prerequisiti sono soddisfatti" |
|
} |
|
|
|
# Prepara l'ambiente per il packaging |
|
prepare_environment() { |
|
print_message "Preparazione dell'ambiente per il packaging DEB..." |
|
|
|
local project_name="comfyui-launcher" |
|
local version="1.0.0" |
|
local upstream_version="1.0.0" |
|
local debian_version="1" |
|
|
|
# Nomi dei file |
|
local orig_tarball="${project_name}_${upstream_version}.orig.tar.gz" |
|
local package_dir="${project_name}-${upstream_version}" |
|
|
|
# Pulizia ambiente precedente |
|
rm -rf "/tmp/deb-build" |
|
mkdir -p "/tmp/deb-build" |
|
cd "/tmp/deb-build" |
|
|
|
# Crea l'archivio originale (upstream tarball) |
|
print_message "Creazione del tarball upstream..." |
|
|
|
local temp_dir=$(mktemp -d) |
|
local upstream_dir="$temp_dir/$package_dir" |
|
|
|
# Copia i file del progetto |
|
mkdir -p "$upstream_dir" |
|
|
|
# File principali |
|
cp /home/enne2/Development/gtk-app/main.py "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/style.css "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/LICENSE "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/README.md "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/README_EN.md "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/CHANGELOG.md "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/pyproject.toml "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/requirements.txt "$upstream_dir/" |
|
cp /home/enne2/Development/gtk-app/config.example.json "$upstream_dir/" |
|
|
|
# Crea il tarball originale |
|
(cd "$temp_dir" && tar -czf "/tmp/deb-build/$orig_tarball" "$package_dir") |
|
|
|
# Estrai per lavorarci |
|
tar -xzf "$orig_tarball" |
|
cd "$package_dir" |
|
|
|
# Pulisci temp |
|
rm -rf "$temp_dir" |
|
|
|
print_success "Ambiente preparato in /tmp/deb-build/$package_dir" |
|
} |
|
|
|
# Crea la struttura debian/ |
|
create_debian_structure() { |
|
print_message "Creazione della struttura debian/..." |
|
|
|
mkdir -p debian/source |
|
|
|
# Crea tutti i file debian necessari |
|
create_debian_changelog |
|
create_debian_control |
|
create_debian_copyright |
|
create_debian_rules |
|
create_debian_compat |
|
create_debian_install |
|
create_debian_dirs |
|
create_debian_desktop |
|
create_debian_source_format |
|
create_debian_watch |
|
create_debian_docs |
|
|
|
print_success "Struttura debian/ creata" |
|
} |
|
|
|
# Crea debian/changelog |
|
create_debian_changelog() { |
|
cat > debian/changelog << 'EOF' |
|
comfyui-launcher (1.0.0-1) unstable; urgency=medium |
|
|
|
* Initial release. |
|
* Modern GTK4 launcher for ComfyUI with conda environment support |
|
* Features: |
|
- Automatic conda environment detection |
|
- Real-time ComfyUI process monitoring |
|
- Modern GTK4/libadwaita interface |
|
- Configuration management |
|
- Installation automation |
|
|
|
-- ComfyUI Launcher Team <your-email@example.com> Mon, 29 Sep 2025 17:00:00 +0200 |
|
EOF |
|
} |
|
|
|
# Crea debian/control |
|
create_debian_control() { |
|
cat > debian/control << 'EOF' |
|
Source: comfyui-launcher |
|
Section: graphics |
|
Priority: optional |
|
Maintainer: ComfyUI Launcher Team <your-email@example.com> |
|
Build-Depends: debhelper-compat (= 13), |
|
dh-python, |
|
python3-all, |
|
python3-setuptools, |
|
python3-dev, |
|
python3-pip, |
|
python3-wheel |
|
Standards-Version: 4.6.2 |
|
Homepage: https://github.com/your-username/comfyui-launcher |
|
Vcs-Git: https://github.com/your-username/comfyui-launcher.git |
|
Vcs-Browser: https://github.com/your-username/comfyui-launcher |
|
Rules-Requires-Root: no |
|
|
|
Package: comfyui-launcher |
|
Architecture: all |
|
Depends: ${python3:Depends}, |
|
${misc:Depends}, |
|
python3-gi, |
|
python3-gi-cairo, |
|
gir1.2-gtk-4.0, |
|
gir1.2-adw-1, |
|
libgtk-4-1, |
|
libadwaita-1-0, |
|
conda | miniconda3 |
|
Recommends: python3-psutil |
|
Suggests: git |
|
Description: Modern GTK4 launcher for ComfyUI with conda environment support |
|
ComfyUI Launcher is a modern GTK4 application that provides an easy-to-use |
|
interface for launching ComfyUI with conda environment support. |
|
. |
|
Features: |
|
* Automatic conda environment detection |
|
* Real-time ComfyUI process monitoring |
|
* Modern GTK4/libadwaita interface |
|
* Configuration management |
|
* Installation automation |
|
. |
|
The launcher simplifies the process of running ComfyUI by automatically |
|
detecting available conda environments and providing a user-friendly |
|
interface for launching and monitoring ComfyUI instances. |
|
EOF |
|
} |
|
|
|
# Crea debian/copyright |
|
create_debian_copyright() { |
|
cat > debian/copyright << 'EOF' |
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ |
|
Upstream-Name: comfyui-launcher |
|
Source: https://github.com/your-username/comfyui-launcher |
|
|
|
Files: * |
|
Copyright: 2025 ComfyUI Launcher Team <your-email@example.com> |
|
License: MIT |
|
|
|
Files: debian/* |
|
Copyright: 2025 ComfyUI Launcher Team <your-email@example.com> |
|
License: MIT |
|
|
|
License: MIT |
|
Permission is hereby granted, free of charge, to any person obtaining a |
|
copy of this software and associated documentation files (the "Software"), |
|
to deal in the Software without restriction, including without limitation |
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
and/or sell copies of the Software, and to permit persons to whom the |
|
Software is furnished to do so, subject to the following conditions: |
|
. |
|
The above copyright notice and this permission notice shall be included |
|
in all copies or substantial portions of the Software. |
|
. |
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
EOF |
|
} |
|
|
|
# Crea debian/rules |
|
create_debian_rules() { |
|
cat > debian/rules << 'EOF' |
|
#!/usr/bin/make -f |
|
|
|
export DH_VERBOSE=1 |
|
export PYBUILD_NAME=comfyui-launcher |
|
|
|
%: |
|
dh $@ --with python3 --buildsystem=pybuild |
|
|
|
override_dh_auto_install: |
|
dh_auto_install |
|
# Installa l'eseguibile principale |
|
install -Dm755 main.py debian/comfyui-launcher/usr/bin/comfyui-launcher |
|
# Installa i file di supporto |
|
install -Dm644 style.css debian/comfyui-launcher/usr/share/comfyui-launcher/style.css |
|
install -Dm644 config.example.json debian/comfyui-launcher/usr/share/comfyui-launcher/config.example.json |
|
|
|
override_dh_installdesktop: |
|
dh_installdesktop |
|
# Valida il file desktop |
|
desktop-file-validate debian/comfyui-launcher/usr/share/applications/comfyui-launcher.desktop |
|
|
|
override_dh_auto_test: |
|
# Salta i test per ora |
|
EOF |
|
chmod +x debian/rules |
|
} |
|
|
|
# Crea debian/compat (compatibilità con versioni precedenti) |
|
create_debian_compat() { |
|
echo "13" > debian/compat |
|
} |
|
|
|
# Crea debian/install |
|
create_debian_install() { |
|
cat > debian/install << 'EOF' |
|
README.md usr/share/doc/comfyui-launcher/ |
|
README_EN.md usr/share/doc/comfyui-launcher/ |
|
CHANGELOG.md usr/share/doc/comfyui-launcher/ |
|
EOF |
|
} |
|
|
|
# Crea debian/dirs |
|
create_debian_dirs() { |
|
cat > debian/dirs << 'EOF' |
|
usr/bin |
|
usr/share/applications |
|
usr/share/comfyui-launcher |
|
usr/share/doc/comfyui-launcher |
|
usr/share/icons/hicolor/scalable/apps |
|
EOF |
|
} |
|
|
|
# Crea il file desktop |
|
create_debian_desktop() { |
|
mkdir -p debian/ |
|
cat > debian/comfyui-launcher.desktop << 'EOF' |
|
[Desktop Entry] |
|
Name=ComfyUI Launcher |
|
Comment=Modern GTK4 launcher for ComfyUI with conda environment support |
|
Comment[it]=Launcher GTK4 moderno per ComfyUI con supporto per ambienti conda |
|
Exec=comfyui-launcher |
|
Icon=comfyui-launcher |
|
Terminal=false |
|
Type=Application |
|
Categories=Graphics;Photography; |
|
Keywords=ComfyUI;AI;MachineLearning;ImageGeneration;StableDiffusion; |
|
MimeType=image/png;image/jpeg; |
|
StartupNotify=true |
|
EOF |
|
} |
|
|
|
# Crea debian/source/format |
|
create_debian_source_format() { |
|
echo "3.0 (quilt)" > debian/source/format |
|
} |
|
|
|
# Crea debian/watch (per monitorare nuove versioni upstream) |
|
create_debian_watch() { |
|
cat > debian/watch << 'EOF' |
|
version=4 |
|
opts="uversionmangle=s/-/./g" \ |
|
https://github.com/your-username/comfyui-launcher/tags \ |
|
.*/v?(\d\S*)\.tar\.gz |
|
EOF |
|
} |
|
|
|
# Crea debian/docs |
|
create_debian_docs() { |
|
cat > debian/docs << 'EOF' |
|
README.md |
|
README_EN.md |
|
CHANGELOG.md |
|
EOF |
|
} |
|
|
|
# Crea l'icona SVG |
|
create_icon() { |
|
print_message "Creazione dell'icona SVG..." |
|
|
|
mkdir -p debian/ |
|
cat > debian/comfyui-launcher.svg << 'EOF' |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<svg width="128" height="128" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> |
|
<defs> |
|
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%"> |
|
<stop offset="0%" style="stop-color:#3584e4;stop-opacity:1" /> |
|
<stop offset="100%" style="stop-color:#1c71d8;stop-opacity:1" /> |
|
</linearGradient> |
|
</defs> |
|
|
|
<!-- Sfondo principale --> |
|
<rect width="128" height="128" rx="16" ry="16" fill="url(#gradient)"/> |
|
|
|
<!-- Icona ComfyUI stylizzata --> |
|
<g transform="translate(16,16)"> |
|
<!-- Elemento centrale --> |
|
<circle cx="48" cy="48" r="32" fill="#ffffff" opacity="0.9"/> |
|
<circle cx="48" cy="48" r="24" fill="url(#gradient)"/> |
|
|
|
<!-- Nodi connessi --> |
|
<circle cx="16" cy="24" r="8" fill="#ffffff" opacity="0.8"/> |
|
<circle cx="80" cy="24" r="8" fill="#ffffff" opacity="0.8"/> |
|
<circle cx="16" cy="72" r="8" fill="#ffffff" opacity="0.8"/> |
|
<circle cx="80" cy="72" r="8" fill="#ffffff" opacity="0.8"/> |
|
|
|
<!-- Connessioni --> |
|
<line x1="24" y1="24" x2="40" y2="40" stroke="#ffffff" stroke-width="3" opacity="0.7"/> |
|
<line x1="72" y1="24" x2="56" y2="40" stroke="#ffffff" stroke-width="3" opacity="0.7"/> |
|
<line x1="24" y1="72" x2="40" y2="56" stroke="#ffffff" stroke-width="3" opacity="0.7"/> |
|
<line x1="72" y1="72" x2="56" y2="56" stroke="#ffffff" stroke-width="3" opacity="0.7"/> |
|
</g> |
|
</svg> |
|
EOF |
|
} |
|
|
|
# Costruzione del pacchetto |
|
build_package() { |
|
print_message "Costruzione del pacchetto DEB..." |
|
|
|
# Verifica dei file debian prima del build |
|
print_message "Verifica dei file debian con lintian..." |
|
if command -v lintian &> /dev/null; then |
|
lintian --check debian/control || print_warning "Alcuni warning in debian/control" |
|
fi |
|
|
|
# Build del pacchetto |
|
print_message "Avvio del build con debuild..." |
|
|
|
if debuild -us -uc -b; then |
|
print_success "Pacchetto DEB costruito con successo" |
|
else |
|
print_error "Errore nella costruzione del pacchetto DEB" |
|
exit 1 |
|
fi |
|
} |
|
|
|
# Verifica del pacchetto |
|
verify_package() { |
|
print_message "Verifica del pacchetto finale..." |
|
|
|
cd /tmp/deb-build |
|
|
|
local deb_file=$(find . -name "comfyui-launcher_*.deb" -type f | head -1) |
|
|
|
if [ -n "$deb_file" ]; then |
|
print_message "Verifica con lintian..." |
|
lintian "$deb_file" || print_warning "Alcuni warning trovati, ma il pacchetto è utilizzabile" |
|
|
|
print_message "Informazioni sul pacchetto:" |
|
dpkg-deb --info "$deb_file" |
|
|
|
print_message "Lista dei file nel pacchetto:" |
|
dpkg-deb --contents "$deb_file" |
|
|
|
print_success "Pacchetto DEB verificato: $deb_file" |
|
|
|
# Copia il pacchetto nella directory originale |
|
cp "$deb_file" /home/enne2/Development/gtk-app/ |
|
print_success "Pacchetto copiato in: /home/enne2/Development/gtk-app/$(basename "$deb_file")" |
|
else |
|
print_error "Pacchetto DEB non trovato" |
|
exit 1 |
|
fi |
|
} |
|
|
|
# Funzione di installazione del pacchetto |
|
install_package() { |
|
local deb_file=$(find /home/enne2/Development/gtk-app -name "comfyui-launcher_*.deb" -type f | head -1) |
|
|
|
if [ -n "$deb_file" ]; then |
|
print_message "Per installare il pacchetto, esegui:" |
|
echo "sudo dpkg -i '$deb_file'" |
|
echo "sudo apt-get install -f # per risolvere eventuali dipendenze" |
|
echo "oppure:" |
|
echo "sudo apt install '$deb_file'" |
|
|
|
read -p "Vuoi installare il pacchetto ora? (y/n): " -n 1 -r |
|
echo |
|
if [[ $REPLY =~ ^[Yy]$ ]]; then |
|
if sudo apt install "$deb_file"; then |
|
print_success "Pacchetto installato con successo" |
|
else |
|
print_warning "Installazione fallita, prova con:" |
|
echo "sudo dpkg -i '$deb_file'" |
|
echo "sudo apt-get install -f" |
|
fi |
|
fi |
|
fi |
|
} |
|
|
|
# Funzione principale |
|
main() { |
|
print_message "=== Script di creazione pacchetto DEB per ComfyUI Launcher ===" |
|
print_message "Questo script creerà un pacchetto DEB per ComfyUI Launcher" |
|
echo |
|
|
|
# Esegui tutti i passi |
|
check_prerequisites |
|
prepare_environment |
|
create_debian_structure |
|
create_icon |
|
build_package |
|
verify_package |
|
|
|
echo |
|
print_success "=== Pacchetto DEB creato con successo! ===" |
|
echo |
|
|
|
install_package |
|
} |
|
|
|
# Esegui lo script |
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then |
|
main "$@" |
|
fi
|
|
|