improve /install.sh
This commit is contained in:
parent
d0b057d5e3
commit
4705cc49d1
|
@ -4,12 +4,24 @@
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
init_loc="$MY_PATH/shell/init.sh"
|
||||||
|
|
||||||
now=$(date +%Y-%m-%d)
|
now=$(date +%Y-%m-%d)
|
||||||
|
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
|
||||||
|
|
||||||
echo "Ce script configure votre noeud G1sms+"
|
echo "Ce script configure votre noeud G1sms+"
|
||||||
IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1);
|
IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v "color=auto" | tail -n 1 | cut -d " " -f 1);
|
||||||
|
|
||||||
if [[ -f .install/init.sh.template ]]; then
|
[[ -z $IPFS ]] && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh
|
||||||
|
|
||||||
|
if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
|
||||||
echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?"
|
echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?"
|
||||||
read YOU
|
read YOU
|
||||||
if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi
|
if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi
|
||||||
|
@ -33,15 +45,15 @@ if [[ -f .install/init.sh.template ]]; then
|
||||||
read
|
read
|
||||||
|
|
||||||
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
|
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
|
||||||
cp .install/init.sh.template shell/init.sh
|
cp $MY_PATH/.install/templates/init.sh shell/init.sh
|
||||||
|
|
||||||
sed -i s/pi/$YOU/g ./shell/init.sh
|
sed -i s/pi/$YOU/g $init_loc
|
||||||
sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh
|
sed -i s/+33600000000/$MASTERPHONE/g $init_loc
|
||||||
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh
|
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g $init_loc
|
||||||
sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh
|
sed -i s/+33647683646/$ADMINPHONE/g $init_loc
|
||||||
sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh
|
sed -i s/Fred/$ADMINPSEUDO/g $init_loc
|
||||||
|
|
||||||
cat ./shell/init.sh
|
cat $init_loc
|
||||||
else
|
else
|
||||||
echo "init.sh.template introuvable..."
|
echo "init.sh introuvable..."
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue