From 5ed45a3ed76028b50026f65c8bbb62c2ede93504 Mon Sep 17 00:00:00 2001 From: Djan GICQUEL <> Date: Sun, 1 Aug 2021 12:48:52 +0200 Subject: [PATCH] initial version desktop Syncthing v1.11.1 --- syncthing-install-auto.sh | 167 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 syncthing-install-auto.sh diff --git a/syncthing-install-auto.sh b/syncthing-install-auto.sh new file mode 100644 index 0000000..9d0a5e4 --- /dev/null +++ b/syncthing-install-auto.sh @@ -0,0 +1,167 @@ +#! /bin/bash + +######################################################### +# Inclusions +######################################################### + +# Variables partagées +# releases url : https://github.com/syncthing/syncthing/releases/ +archive_url="https://github.com/syncthing/syncthing/releases/download/v1.11.1/syncthing-linux-amd64-v1.11.1.tar.gz" +archivename="syncthing-linux-amd64-v1.11.1.tar.gz" +iconurl="https://raw.githubusercontent.com/syncthing/syncthing/main/assets/logo-128.png" + +# Fonctions partagées +fonct_VerifConnexionInternet () { +ping -c 1 github.com > /dev/null +if [ "$?" != "0" ]; then +echo "Erreur la connexion internet semble défaillante" +echo "Fin du script." +exit +else +echo "La connexion internet est fonctionnelle" +echo "" +fi +} + +fonct_CreationDossier () { +if [ ! -d "$1" ]; then +mkdir -p "$1" +echo "Le dossier $1 a été créé." +fi +} + +fonct_PaquetInstalle () { +which $1 +if [ "$?" != "0" ]; then +echo "$1 ne semble pas installé." +echo "Fin du script." +exit +else +echo "Le paquet $1 est bien installé." +fi +} + +fonct_TouchePourContinuer (){ +read -p "Presser une touche pour continuer ou Ctrl-C pour annuler" CONT +} + +fonct_ArretSurErreur(){ +if [ "$?" != "0" ]; then +echo "Le script a rencontré une erreur." +exit +fi +} + +######################################################### +# Début du script +######################################################### + +# Vérifications +fonct_VerifConnexionInternet +fonct_PaquetInstalle firefox + +# Introduction +clear +cat << "EOF" + + ..~~+~~~.. + .++++~~.~~~++++. + .++~. .~++.. + ~o+ ~ooo+. + ~o~ +oooo + +o .+++.~o+ + .o+. ..~+ooo~. +o + +ooo+++++++++oooo~ .++ + +ooo~.. ~~oo. ~o~ + ~o+ +o+~+o~ + .++~. .oooo~ + .~+++~~~~~~++o+o+. + ..~~~~~~.. + +EOF +echo "" +echo "Syncthing remplace les logiciels de synchronisation\n\ +privateurs et les services de cloud par un\n\ +logiciel ouvert, de confiance et décentralisé.\n\ +\n +https://syncthing.net" +echo "" + +fonct_TouchePourContinuer +clear +echo "Ce que fait ce script :\n\ +-Télécharger et installer Syncthing de façon automatique\n\ +-Créer un dossier bin dans votre home\n\ +-Ajouter une entrée de démmarrage automatique pour Syncthing\n\ +-Ajouter l'icone de Syncthing dans votre dossier icons\n\ +-Ajouter une entrée Interface Syncthing dans votre menu principal" +echo "" +echo "Notes : Après l'installation l'interface web de Syncthing\n\ +démmarra automatiquement à chaque session. Vous pouvez \n\ +empecher cela en décochant la case "Lancer le navigateur web"\n\ +dans la configuration de Syncthing." +echo "" + +fonct_TouchePourContinuer +clear +fonct_CreationDossier $HOME/bin/ +fonct_CreationDossier $HOME/.icons/ +fonct_CreationDossier $HOME/.config/autostart/ + +# Téléchargement syncthing +wget --quiet $archive_url +tar -xzf $archivename -C $HOME/bin/ +mv $HOME/bin/syncthing* $HOME/bin/syncthing +rm $archivename +echo "" +echo "Syncthing a bien été installé." +sleep 5 + +# Ajout alias au .bashrc +#echo export PATH='$PATH':~/bin/syncthing >> $HOME/.bashrc +sed -i '1iexport PATH='$PATH':~/bin/syncthing' $HOME/.bashrc +fonct_ArretSurErreur +echo "Ajout des alias au bashrc réussi." +sleep 5 + +# Installation des fichiers desktop +echo "[Desktop Entry]\n\ +Encoding=UTF-8\n\ +Name=Syncthing\n\ +Icon=syncthing\n\ +Comment="Outil de synchronisation sécurisé sans serveur central"\n\ +Exec=bin/syncthing/syncthing\n\ +Terminal=false\n\ +Type=Application\n\ +" >> $HOME/.config/autostart/syncthing-autostart.desktop +fonct_ArretSurErreur +echo "Ajout du lien de démmarrage automatique réussi." +sleep 5 + +echo "[Desktop Entry]\n\ +Encoding=UTF-8\n\ +Name=Syncthing (Interface Web)\n\ +Icon=syncthing\n\ +Comment=\"Ouvrir l'interface web de Syncthing\"\n\ +Exec=firefox --new-tab 127.0.0.1:8384\n\ +Terminal=false\n\ +Type=Application\n\ +Categories=Network;\n\ +" >> $HOME/.local/share/applications/syncthing-wui.desktop +fonct_ArretSurErreur +echo "Ajout du raccourcis vers l'interface web réussi." +echo "Vous le trouverez dans le menu principal" +echo "de votre distribution Rubrique Internet/Syncthing (Interface web)" +sleep 5 + +# Installation de l'icone +wget --quiet -O $HOME/.icons/syncthing.png $iconurl +fonct_ArretSurErreur +echo "Ajout de l'icone réussi." +sleep 5 +echo "" && echo "" && echo "" +echo "Installation terminée." +echo "Merci de relancer votre session pour terminer l'installation" +echo "" && echo "" +echo "Vous pouvez également installer Syncthing-GTK pour avoir les notifications de bureau et d'autres options" +echo "https://github.com/syncthing/syncthing-gtk"