Update 'install.sh'
This commit is contained in:
parent
104211b810
commit
30e5983273
115
install.sh
115
install.sh
@ -1,66 +1,71 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
cd ~
|
install_packages() {
|
||||||
|
command -v git >/dev/null 2>&1 || { echo >&2 "Git n'est pas installé. Installation..."; sudo apt-get install git; }
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install libusb-dev autoconf libpcsclite-dev -y
|
||||||
|
}
|
||||||
|
|
||||||
# Installer git si ce n'est pas déjà fait
|
clone_repos() {
|
||||||
command -v git >/dev/null 2>&1 || { echo >&2 "Git n'est pas installé. Installation..."; sudo apt-get install git; }
|
local repos=(
|
||||||
|
"https://gitea.jarodcajna.fr/jarjar/BadgeCloner.git"
|
||||||
|
"https://gitea.jarodcajna.fr/jarjar/libnfc.git"
|
||||||
|
"https://gitea.jarodcajna.fr/jarjar/mfoc.git"
|
||||||
|
"https://gitea.jarodcajna.fr/jarjar/LCD-show.git"
|
||||||
|
)
|
||||||
|
|
||||||
# Installation des packages requis
|
for repo in "${repos[@]}"
|
||||||
sudo apt-get update
|
do
|
||||||
sudo apt-get install libusb-dev autoconf libpcsclite-dev -y
|
git clone $repo
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Tableau des URL de dépôts à cloner
|
compile_libnfc() {
|
||||||
repos=(
|
cd ~/libnfc
|
||||||
"https://gitea.jarodcajna.fr/jarjar/BadgeCloner.git"
|
autoreconf -is --force
|
||||||
"https://gitea.jarodcajna.fr/jarjar/libnfc.git"
|
./configure
|
||||||
"https://gitea.jarodcajna.fr/jarjar/mfoc.git"
|
make distclean
|
||||||
"https://gitea.jarodcajna.fr/jarjar/LCD-show.git"
|
sudo make install
|
||||||
)
|
cd ~
|
||||||
|
}
|
||||||
|
|
||||||
# Boucle pour cloner chaque dépôt
|
compile_mfoc() {
|
||||||
for repo in "${repos[@]}"
|
cd ~/mfoc
|
||||||
do
|
autoreconf -is
|
||||||
git clone $repo
|
./configure
|
||||||
done
|
make && sudo make install
|
||||||
|
cd ~
|
||||||
|
}
|
||||||
|
|
||||||
echo "Tous les dépôts ont été clonés avec succès."
|
update_autostart() {
|
||||||
|
sudo sed -i '1,3s/^/@#/' /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
|
||||||
|
}
|
||||||
|
|
||||||
# Compilation de libnfc
|
create_launcher() {
|
||||||
cd libnfc
|
echo "cd /home/$USER/BadgeCloner/BadgeCloner" > ~/launcher.sh
|
||||||
autoreconf -is --force
|
echo "python3 server.py" >> ~/launcher.sh
|
||||||
./configure
|
chmod +x ~/launcher.sh
|
||||||
make distclean
|
}
|
||||||
sudo make install
|
|
||||||
|
|
||||||
# Retourner au répertoire d'origine
|
install_lcd_drivers() {
|
||||||
cd ~
|
cd ~/LCD-show
|
||||||
|
sudo chmod +x LCD35-show
|
||||||
|
sudo ./LCD35-show
|
||||||
|
}
|
||||||
|
|
||||||
# Compilation de mfoc
|
main() {
|
||||||
cd mfoc
|
cd ~
|
||||||
autoreconf -is
|
install_packages
|
||||||
./configure
|
clone_repos
|
||||||
make && sudo make install
|
compile_libnfc
|
||||||
|
compile_mfoc
|
||||||
|
sudo ldconfig
|
||||||
|
update_autostart
|
||||||
|
create_launcher
|
||||||
|
install_lcd_drivers
|
||||||
|
}
|
||||||
|
|
||||||
# Retourner au répertoire d'origine
|
main "$@"
|
||||||
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/BadgeCloner" > ~/launcher.sh
|
|
||||||
echo "python3 server.py" >> ~/launcher.sh
|
|
||||||
echo "Le fichier launcher.sh a été créé."
|
|
||||||
|
|
||||||
# Installation des drivers pour l'écran LCD
|
|
||||||
cd LCD-show
|
|
||||||
sudo chmod +x LCD35-show
|
|
||||||
sudo LCD35-show
|
|
||||||
Loading…
x
Reference in New Issue
Block a user