G1sms/install.sh

60 lines
2.4 KiB
Bash
Raw Normal View History

2019-12-03 12:25:11 +01:00
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
2019-12-06 16:14:08 +01:00
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
init_loc="$MY_PATH/shell/init.sh"
2019-12-06 15:51:51 +01:00
now=$(date +%Y-%m-%d)
2019-12-06 16:14:08 +01:00
chmod u+x .install/configure_ipfs_layer.sh .install/install_requirements.sh
if [ "$EUID" -eq 0 ]
then echo "Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)"
exit 1
fi
2019-12-03 12:25:11 +01:00
2019-12-06 15:51:51 +01:00
echo "Ce script configure votre noeud G1sms+"
2019-12-06 16:22:11 +01:00
IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
2019-12-06 16:14:08 +01:00
2019-12-06 16:25:03 +01:00
[[ -z $IPFS ]] && echo "IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis..." && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh
2019-12-03 12:25:11 +01:00
2019-12-06 16:14:08 +01:00
if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
2019-12-06 15:51:51 +01:00
echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?"
read YOU
if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi
2019-12-03 12:25:11 +01:00
2019-12-06 15:51:51 +01:00
echo "Votre PSEUDO? (celui de votre Compte membre Duniter)"
2019-12-03 12:25:11 +01:00
read ADMINPSEUDO
2019-12-06 15:51:51 +01:00
if [[ "$ADMINPSEUDO" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi
2019-12-03 12:25:11 +01:00
2019-12-06 15:51:51 +01:00
echo "Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)"
2019-12-03 12:25:11 +01:00
read ADMINPHONE
2019-12-06 15:51:51 +01:00
if [[ "$ADMINPHONE" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi
2019-12-03 12:25:11 +01:00
echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)"
read MASTERPHONE
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi
2019-12-06 15:51:51 +01:00
echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)"
2019-12-03 12:25:11 +01:00
read ADRESSE
2019-12-06 15:51:51 +01:00
echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?"
read
2019-12-03 12:25:11 +01:00
2019-12-06 15:51:51 +01:00
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
2019-12-06 16:14:08 +01:00
cp $MY_PATH/.install/templates/init.sh shell/init.sh
2019-12-03 12:25:11 +01:00
2019-12-06 16:14:08 +01:00
sed -i s/pi/$YOU/g $init_loc
sed -i s/+33600000000/$MASTERPHONE/g $init_loc
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g $init_loc
sed -i s/+33647683646/$ADMINPHONE/g $init_loc
sed -i s/Fred/$ADMINPSEUDO/g $init_loc
2019-12-03 12:25:11 +01:00
2019-12-06 16:14:08 +01:00
cat $init_loc
2019-12-06 15:51:51 +01:00
else
2019-12-06 16:14:08 +01:00
echo "init.sh introuvable..."
2019-12-03 12:25:11 +01:00
fi