install.sh

This commit is contained in:
CAJNA Jarod 2023-06-02 10:21:53 +02:00
parent 215187874c
commit b6a5199fdc

59
install.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/sh
# Installer git si ce n'est pas déjà fait
command -v git >/dev/null 2>&1 || { echo >&2 "Git n'est pas installé. Installation..."; sudo apt-get install git; }
# Installation des packages requis
sudo apt-get update
sudo apt-get install libusb-dev autoconf libpcsclite-dev -y
# Tableau des URL de dépôts à cloner
repos=(
"https://gitea.jarodcajna.fr/jarjar/BadgeCloner.git"
"https://gitea.jarodcajna.fr/jarjar/libnfc.git"
"https://github.com/nfc-tools/mfoc.git"
"https://github.com/goodtft/LCD-show.git"
)
# Boucle pour cloner chaque dépôt
for repo in "${repos[@]}"
do
git clone $repo
done
echo "Tous les dépôts ont été clonés avec succès."
# Compilation de libnfc
cd libnfc
autoreconf -is --force
./configure
make distclean
sudo make install
# Retourner au répertoire d'origine
cd .
# Compilation de mfoc
cd mfoc
autoreconf -is
./configure
make && sudo make install
# Retourner au répertoire d'origine
cd .
sudo ldconfig
# Commenter les trois premières lignes de /etc/xdg/lxsession/LXDE-pi/autostart
sudo sed -i '1,3s/^/@#/' /etc/xdg/lxsession/LXDE-pi/autostart
# Ajout des lignes nécessaires à /etc/xdg/lxsession/LXDE-pi/autostart
echo "@sh /home/$USER/launcher.sh &" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart
echo "@chromium-browser --incognito --kiosk http://localhost:5000" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart
echo "Les lignes ont été ajoutées à /etc/xdg/lxsession/LXDE-pi/autostart."
# Créer le fichier launcher.sh
echo "cd /home/$USER/BadgeCloner" > ~/launcher.sh
echo "python3 server.py" >> ~/launcher.sh
echo "Le fichier launcher.sh a été créé."