G1sms/config.sh

44 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
now=$(date +%Y-%m-%d)
echo "Ce script configure votre noeud G1sms+ (effacez ./shell/init.sh avant de le lancer)"
IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1);
if [[ -f ./shell/init.sh.template && ! -f ./shell/init.sh ]]; then
echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?"
read YOU
if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi
echo "Votre PSEUDO? (celui de votre Compte membre Duniter)"
read ADMINPSEUDO
if [[ "$ADMINPSEUDO" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi
echo "Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)"
read ADMINPHONE
if [[ "$ADMINPHONE" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi
echo "Le numéro de la carte SIM, du module SMS? (ex +33611223344)"
read MASTERPHONE
echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)"
read ADRESSE
sed -i s/pi/$YOU/g ./shell/init.sh.template
sed -i s/+33660780131/$MASTERPHONE/g ./shell/init.sh.template
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh.template
sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh.template
sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh.template
cat ./shell/init.sh.template
echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?"
read
cp ./shell/init.sh.template ./shell/init.sh
fi