diff options
| author | ertopogo <erwin.t.pombett@gmail.com> | 2025-11-26 04:02:41 +0100 |
|---|---|---|
| committer | ertopogo <erwin.t.pombett@gmail.com> | 2025-11-26 04:02:41 +0100 |
| commit | fb7b2389c33bef903f236f4dd0c0b98dfc0bbbe8 (patch) | |
| tree | aa61a9026da508e865ab19b38677be523c961891 /setup-git-web-interface/installation-steps.sh | |
| parent | 0f1ba5af1684cfc64b3ff5374ef95c70df1caac0 (diff) | |
Feat: Ajout de la configuration Tridactyl (Native Messenger + .tridactylrc) et scripts de maintenance
Diffstat (limited to 'setup-git-web-interface/installation-steps.sh')
| -rw-r--r-- | setup-git-web-interface/installation-steps.sh | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/setup-git-web-interface/installation-steps.sh b/setup-git-web-interface/installation-steps.sh new file mode 100644 index 0000000..e037ac7 --- /dev/null +++ b/setup-git-web-interface/installation-steps.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# Script d'installation de Gitea sur chillka +# À exécuter sur chillka en tant que toshiro avec sudo + +set -e + +echo "=== Installation de Gitea sur chillka ===" + +# Variables +GITEA_VERSION="1.21.0" +GITEA_USER="git" +GITEA_HOME="/home/git" +GITEA_WORK_DIR="/var/lib/gitea" +GITEA_CONFIG="/etc/gitea" + +# Vérifier que nous sommes sur chillka +echo "Vérification de l'environnement..." +if [ ! -d "/var/data/git/repositories" ]; then + echo "Erreur: Le répertoire /var/data/git/repositories n'existe pas" + exit 1 +fi + +# Étape 1: Télécharger Gitea +echo "Étape 1: Téléchargement de Gitea..." +cd /tmp +wget -O gitea "https://dl.gitea.io/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64" +chmod +x gitea +sudo mv gitea /usr/local/bin/ +gitea --version + +# Étape 2: Créer l'utilisateur système +echo "Étape 2: Création de l'utilisateur git..." +if ! id "$GITEA_USER" &>/dev/null; then + sudo adduser --system --group --disabled-password --shell /bin/bash \ + --home "$GITEA_HOME" --gecos 'Git Version Control' "$GITEA_USER" + echo "Utilisateur $GITEA_USER créé" +else + echo "Utilisateur $GITEA_USER existe déjà" +fi + +# Étape 3: Créer la structure de répertoires +echo "Étape 3: Création de la structure de répertoires..." +sudo mkdir -p "$GITEA_WORK_DIR"/{custom,data,log} +sudo mkdir -p "$GITEA_CONFIG" +sudo chown -R "$GITEA_USER:$GITEA_USER" "$GITEA_WORK_DIR" +sudo chmod 750 "$GITEA_WORK_DIR" +sudo chmod 770 "$GITEA_CONFIG" + +# Étape 4: Créer le service systemd +echo "Étape 4: Création du service systemd..." +sudo tee /etc/systemd/system/gitea.service > /dev/null <<EOF +[Unit] +Description=Gitea (Git with a cup of tea) +After=syslog.target +After=network.target + +[Service] +RestartSec=2s +Type=simple +User=$GITEA_USER +Group=$GITEA_USER +WorkingDirectory=$GITEA_WORK_DIR +ExecStart=/usr/local/bin/gitea web --config $GITEA_CONFIG/app.ini +Restart=always +Environment=USER=$GITEA_USER HOME=$GITEA_HOME GITEA_WORK_DIR=$GITEA_WORK_DIR + +[Install] +WantedBy=multi-user.target +EOF + +# Étape 5: Recharger systemd et démarrer Gitea +echo "Étape 5: Démarrage de Gitea..." +sudo systemctl daemon-reload +sudo systemctl enable gitea +sudo systemctl start gitea + +# Vérifier le statut +sleep 2 +if sudo systemctl is-active --quiet gitea; then + echo "✓ Gitea est démarré avec succès" + echo "✓ Accédez à http://$(hostname -I | awk '{print $1}'):3000 pour la configuration initiale" +else + echo "✗ Erreur: Gitea n'a pas démarré correctement" + echo "Vérifiez les logs: sudo journalctl -u gitea -n 50" + exit 1 +fi + +echo "" +echo "=== Installation terminée ===" +echo "Prochaines étapes:" +echo "1. Ouvrir http://$(hostname -I | awk '{print $1}'):3000 dans un navigateur" +echo "2. Suivre l'assistant de configuration" +echo "3. Configurer le chemin des dépôts: /var/data/git/repositories" +echo "4. Créer un compte administrateur" + |
