Update install_elog.sh
Run CI Tests / test (push) Successful in 1m30s

This commit is contained in:
2025-08-07 01:02:38 +02:00
parent f8d6b51680
commit 80a9cd381a
+32 -31
View File
@@ -2,66 +2,67 @@
echo "📦 Installation de ELOG..."
# Installation des dépendances
sudo apt update
sudo apt install -y make gcc wget tar curl apache2-utils
# Création de l'utilisateur/groupe
sudo groupadd -f elog
sudo useradd -g elog -s /bin/false -d /nonexistent elog 2>/dev/null || true
# Télécharger et compiler ELOG
# Télécharger ELOG
wget https://downloads.sourceforge.net/project/elog/elog/2.7.1/elog-2.7.1-1.tar.gz
tar -xvzf elog-2.7.1-1.tar.gz
cd elog-2.7.1
make
cd ..
# Installation
# Installer dans ~/.local/bin
mkdir -p ~/.local/bin
cp elog-2.7.1/elogd ~/.local/bin
export PATH="$HOME/.local/bin:$PATH"
echo "$HOME/.local/bin" >> $GITHUB_PATH
# Pparation de l'environnement ELOG
mkdir -p elog_instance/logbooks
sudo chown -R elog:elog elog_instance
sudo chmod -R 775 elog_instance
# Cer une instance ELOG
mkdir -p elog_instance/logbooks/demo
# Configuration de l'authentification
# Générer le fichier mot de passe
htpasswd -cb elog_instance/elog.passwd robot testpassword
# Fichier de configuration
# Configuration avec accès restreint
cat > elog_instance/elogd.cfg <<EOF
[global]
port = 8080
logdir = logbooks
allowed methods = GET, POST, PUT, DELETE
allowposting = 1
allowhtml = 1
user = elog
group = elog
[demo]
dir = logbooks/demo
allow = robot
passwdfile = elog.passwd
allowedit = robot
edit password = testpassword
allowedit = 1
EOF
# Création du répertoire demo
sudo -u elog mkdir -p elog_instance/logbooks/demo
# Lancement du serveur
echo "🚀 Démarrage du serveur ELOG avec l'utilisateur 'elog'..."
sudo -u elog ~/.local/bin/elogd -c elog_instance/elogd.cfg -d 1 &
# Lancer le serveur
~/.local/bin/elogd -c elog_instance/elogd.cfg &
sleep 3
# Test
echo "🔄 Test de création d'entrée..."
curl -v -X POST -u robot:testpassword \
-d "subject=Test&message=Ceci+est+un+test&type=General" \
http://localhost:8080/demo/
# Vérification version
echo "✅ elogd version:"
~/.local/bin/elogd -h | head -n 1
echo "✅ Installation terminée"
# Vérification lecture
echo "📬 Accès test au logbook :"
curl http://localhost:8080/demo/ || echo "Pas encore de logbook 'demo'"
# Test d'insertion d'une entrée (PUT)
echo "📝 Test elog.put (via curl)..."
response=$(curl -s -o /dev/null -w "%{http_code}" -u robot:testpassword \
-d "text=Hello ELOG via shell script" \
-d "Subject=Test entry" \
-d "Type=Note" \
-d "Category=General" \
"http://localhost:8080/demo/?cmd=New")
if [ "$response" == "200" ]; then
echo "✅ Insertion réussie dans le logbook demo"
else
echo "❌ Échec de l'insertion (code HTTP: $response)"
fi
echo "✅ ELOG setup terminé"