- Logo/favicon ridisegnati come theta maiuscola: cerchio (anello) con 'H' centrata, clearance verificata (non tocca l'anello); ring ispessito per la favicon; centratura ottica verificata. - Rimosso il badge 'Self-hosted Git' dal hero della homepage (era esteticamente di troppo) - CSS e markup. - Aggiornati generate_theta.py, README, home.tmpl; caricati sul VPS in staging (md5 locali == remoti); tarball ricostruito. - Salvataggio iniziale dell'intero admin pack in git.
81 lines
2.6 KiB
Bash
Executable File
81 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Installa homepage moderna + favicon personalizzate per Gitea.
|
|
# DA ESEGUIRE COME ROOT SUL VPS (o con sudo).
|
|
# Uso: bash install_gitea_theme.sh
|
|
set -euo pipefail
|
|
|
|
CUSTOM_DIR="${CUSTOM_DIR:-/var/lib/gitea/custom}"
|
|
SRC_DIR="$(cd "$(dirname "$0")" && pwd)/custom"
|
|
STAMP="$(date +%Y%m%d-%H%M%S)"
|
|
BACKUP_DIR="${CUSTOM_DIR}/.backup-${STAMP}"
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
echo "ERRORE: devi eseguire questo script come root (o sudo)."
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$SRC_DIR" ]; then
|
|
echo "ERRORE: cartella sorgente '$SRC_DIR' non trovata (script in cartella sbagliata?)."
|
|
exit 1
|
|
fi
|
|
|
|
echo "==> Target custom dir: $CUSTOM_DIR"
|
|
|
|
# 1) Backup delle eventuali personalizzazioni esistenti
|
|
HAD_PREV=no
|
|
if [ -e "$CUSTOM_DIR/templates/home.tmpl" ] || [ -e "$CUSTOM_DIR/public/assets/img" ]; then
|
|
HAD_PREV=yes
|
|
mkdir -p "$BACKUP_DIR"
|
|
for p in templates/home.tmpl public/assets/img; do
|
|
if [ -e "$CUSTOM_DIR/$p" ]; then
|
|
mkdir -p "$BACKUP_DIR/$(dirname "$p")"
|
|
cp -a "$CUSTOM_DIR/$p" "$BACKUP_DIR/$p"
|
|
echo "==> Backup salvato: $BACKUP_DIR/$p"
|
|
fi
|
|
done
|
|
else
|
|
echo "==> Nessuna personalizzazione precedente, niente da salvare."
|
|
fi
|
|
|
|
# 2) Copia dei nuovi file
|
|
mkdir -p "$CUSTOM_DIR/templates" "$CUSTOM_DIR/public/assets/img"
|
|
cp "$SRC_DIR/templates/home.tmpl" "$CUSTOM_DIR/templates/home.tmpl"
|
|
cp "$SRC_DIR/public/assets/img/"* "$CUSTOM_DIR/public/assets/img/"
|
|
echo "==> File copiati:"
|
|
ls -l "$CUSTOM_DIR/templates/home.tmpl"
|
|
ls -l "$CUSTOM_DIR/public/assets/img/"
|
|
|
|
# 3) Permessi corretti (il processo gitea gira come utente gitea)
|
|
chown -R gitea:gitea "$CUSTOM_DIR"
|
|
echo "==> Permessi impostati (gitea:gitea)."
|
|
|
|
# 3b) Stato per il rollback
|
|
STATE_FILE="$CUSTOM_DIR/.gitea-theme-state"
|
|
{
|
|
echo "installed_at=$STAMP"
|
|
echo "backup_dir=$BACKUP_DIR"
|
|
echo "had_custom=$HAD_PREV"
|
|
} > "$STATE_FILE"
|
|
echo "==> Stato rollback salvato in $STATE_FILE"
|
|
|
|
# 4) Riavvio di Gitea
|
|
systemctl restart gitea
|
|
sleep 6
|
|
|
|
# 5) Verifica
|
|
echo "==> Stato servizio:"
|
|
systemctl is-active gitea
|
|
echo "==> Verifica favicon (HTTP code):"
|
|
curl -sk -o /dev/null -w " /assets/img/favicon.svg -> %{http_code}\n" https://127.0.0.1/assets/img/favicon.svg \
|
|
|| echo " (curl locale non disponibile, verificare via browser)"
|
|
echo "==> Verifica logo:"
|
|
curl -sk -o /dev/null -w " /assets/img/logo.svg -> %{http_code}\n" https://127.0.0.1/assets/img/logo.svg \
|
|
|| true
|
|
|
|
echo ""
|
|
echo "FATTO. Ricarica https://git.zomas.net (con Ctrl+Shift+R per bypassare la cache del browser)."
|
|
echo "Per ripristinare la versione originale:"
|
|
echo " rm -rf $CUSTOM_DIR/templates/home.tmpl $CUSTOM_DIR/public/assets/img"
|
|
echo " systemctl restart gitea"
|
|
echo "Backup delle vecchie file (se esistenti): $BACKUP_DIR"
|