48 lines
2.1 KiB
Bash
Executable File
48 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Empaqueta artefactos en dist/release/
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
RELEASE="$ROOT/dist/release"
|
|
mkdir -p "$RELEASE"
|
|
|
|
[[ -f "$ROOT/dist/CloudRestoreAS.exe" ]] && cp -f "$ROOT/dist/CloudRestoreAS.exe" "$RELEASE/"
|
|
[[ -f "$ROOT/dist/CloudRestoreAS" ]] && cp -f "$ROOT/dist/CloudRestoreAS" "$RELEASE/CloudRestoreAS-linux" && chmod +x "$RELEASE/CloudRestoreAS-linux"
|
|
cp -f "$ROOT/packaging/LEEME.txt" "$RELEASE/"
|
|
|
|
# Paquete Windows: carpeta raíz CloudRestoreAS/ con .exe + install.ps1 + LEEME
|
|
# (paridad con el .tar.gz de Linux).
|
|
if [[ -f "$RELEASE/CloudRestoreAS.exe" ]]; then
|
|
ROOT="$ROOT" RELEASE="$RELEASE" python3 <<'PY'
|
|
import os, zipfile
|
|
from pathlib import Path
|
|
root = Path(os.environ["ROOT"]); release = Path(os.environ["RELEASE"])
|
|
items = [(release / "CloudRestoreAS.exe", "CloudRestoreAS/CloudRestoreAS.exe"),
|
|
(root / "packaging" / "LEEME.txt", "CloudRestoreAS/LEEME.txt")]
|
|
if (root / "install.ps1").exists():
|
|
items.append((root / "install.ps1", "CloudRestoreAS/install.ps1"))
|
|
with zipfile.ZipFile(release / "CloudRestoreAS-win.zip", "w", zipfile.ZIP_DEFLATED) as z:
|
|
for src, arc in items:
|
|
z.write(src, arc)
|
|
print(" zip Windows:", release / "CloudRestoreAS-win.zip")
|
|
PY
|
|
fi
|
|
|
|
if [[ -f "$RELEASE/CloudRestoreAS-linux" ]]; then
|
|
# Paquete de despliegue completo: binario + instalador + unit systemd + LEEME,
|
|
# bajo una carpeta raíz para que extraiga limpio. install.sh encuentra el binario
|
|
# (CloudRestoreAS-linux) y la unit (packaging/linux/) relativos a su ubicación.
|
|
STAGE="$RELEASE/CloudRestoreAS-linux"
|
|
PKG="$RELEASE/pkg-linux/CloudRestoreAS"
|
|
rm -rf "$RELEASE/pkg-linux"
|
|
mkdir -p "$PKG/packaging/linux"
|
|
cp -f "$STAGE" "$PKG/CloudRestoreAS-linux"; chmod +x "$PKG/CloudRestoreAS-linux"
|
|
cp -f "$ROOT/install.sh" "$PKG/install.sh"; chmod +x "$PKG/install.sh"
|
|
cp -f "$ROOT/packaging/linux/cloudrestoreas.service" "$PKG/packaging/linux/"
|
|
cp -f "$ROOT/packaging/LEEME.txt" "$PKG/LEEME.txt"
|
|
tar czf "$RELEASE/CloudRestoreAS-linux.tar.gz" -C "$RELEASE/pkg-linux" CloudRestoreAS
|
|
rm -rf "$RELEASE/pkg-linux"
|
|
fi
|
|
|
|
echo "Release en: $RELEASE"
|
|
ls -lh "$RELEASE"
|