Add colors
This commit is contained in:
parent
a23cb3a92c
commit
60e5f9a2c7
|
@ -9,3 +9,4 @@ history.*
|
||||||
TAG/
|
TAG/
|
||||||
.install/errors
|
.install/errors
|
||||||
.install/log
|
.install/log
|
||||||
|
shell/init.sh.old
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
[[ ! -z $(cat ~/.bash_aliases | grep c_red) ]] && echo "Les couleurs sont déjà déclarés dans l'environnement" && exit 1
|
||||||
|
|
||||||
|
echo 'export c_blinkfast="\033[6m"
|
||||||
|
export c_light="\033[1m"
|
||||||
|
export c_white_bg="\033[47m"
|
||||||
|
export c_blue="\033[34m"
|
||||||
|
export c_red_bg="\033[41m"
|
||||||
|
export c_hide="\033[8m"
|
||||||
|
export c_purple_bg="\033[45m"
|
||||||
|
export c_yellow_bg="\033[43m"
|
||||||
|
export c_dark="\033[2m"
|
||||||
|
export c_reverse="003[7m"
|
||||||
|
export c_underline="\033[4m"
|
||||||
|
export c_blinkslow="\033[5m"
|
||||||
|
export c_red="\033[31m"
|
||||||
|
export c_white="\033[37m"
|
||||||
|
export c_cyan_bg="\033[46m"
|
||||||
|
export c_italic="\033[3m"
|
||||||
|
export c_black="\033[30m"
|
||||||
|
export c_cross="\033[9m"
|
||||||
|
export c_green="\033[32m"
|
||||||
|
export c_purple="\033[35m"
|
||||||
|
export c_="\033[0m"
|
||||||
|
export c_cyan="\033[36m"
|
||||||
|
export c_black_bg="\033[40m"
|
||||||
|
export c_yellow="\033[33m"
|
||||||
|
export c_blue_bg="\033[44m"
|
||||||
|
export c_green_bg="\033[42m"' >> ~/.bash_aliases
|
||||||
|
|
||||||
|
|
||||||
|
bash -i
|
44
install.sh
44
install.sh
|
@ -7,46 +7,54 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
init_loc="$MY_PATH/shell/init.sh"
|
init_loc="$MY_PATH/shell/init.sh"
|
||||||
|
now=$(date +%Y-%m-%d)
|
||||||
|
repOption=$1
|
||||||
|
|
||||||
## Update G1sms+ code
|
## Update G1sms+ code
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
now=$(date +%Y-%m-%d)
|
chmod u+x $MY_PATH/.install/*.sh
|
||||||
chmod u+x .install/configure_ipfs_layer.sh .install/install_requirements.sh .install/install_optional.sh
|
|
||||||
|
|
||||||
repOption=$1
|
|
||||||
|
|
||||||
if [ "$EUID" -eq 0 ]
|
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)"
|
then echo -e "${c_red}Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)$c_"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -z $(which 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
|
$MY_PATH/.install/export_colors.sh
|
||||||
|
|
||||||
echo "Ce script va désormais configurer votre noeud G1sms+"
|
## Vérifie si IPFS est installé
|
||||||
|
if [[ -z $(which ipfs) ]];then
|
||||||
|
echo -e "${c_yellow}IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis...$c_"
|
||||||
|
$MY_PATH/.install/install_requirements.sh
|
||||||
|
$MY_PATH/.install/configure_ipfs_layer.sh
|
||||||
|
else
|
||||||
|
echo -e "${c_green}IPFS est déjà installé, configuration du noeud ...$c_"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${c_yellow}Ce script va désormais configurer votre noeud G1sms+$c_"
|
||||||
IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||||
|
|
||||||
if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
|
if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
|
||||||
echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?"
|
echo -e "${c_light}Quel est l'utilisateur du système IPFS (détecté: $IPFS)?$c_"
|
||||||
read YOU
|
read YOU
|
||||||
if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi
|
if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi
|
||||||
|
|
||||||
echo "Votre PSEUDO? (celui de votre Compte membre Duniter)"
|
echo -e "${c_light}Votre PSEUDO? (celui de votre Compte membre Duniter)$c_"
|
||||||
read ADMINPSEUDO
|
read ADMINPSEUDO
|
||||||
if [[ "$ADMINPSEUDO" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi
|
if [[ "$ADMINPSEUDO" == "" ]]; then echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_"; exit; fi
|
||||||
|
|
||||||
echo "Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)"
|
echo -e "${c_light}Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)$c_"
|
||||||
read ADMINPHONE
|
read ADMINPHONE
|
||||||
if [[ "$ADMINPHONE" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi
|
if [[ "$ADMINPHONE" == "" ]]; then echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_"; exit; fi
|
||||||
|
|
||||||
echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)"
|
echo -e "${c_light}Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)$c_"
|
||||||
read MASTERPHONE
|
read MASTERPHONE
|
||||||
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi
|
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi
|
||||||
|
|
||||||
echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)"
|
echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_"
|
||||||
read ADRESSE
|
read ADRESSE
|
||||||
|
|
||||||
echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?"
|
echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?$c_"
|
||||||
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
|
||||||
|
@ -60,9 +68,11 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
|
||||||
|
|
||||||
cat $init_loc
|
cat $init_loc
|
||||||
else
|
else
|
||||||
echo "init.sh introuvable..."
|
echo -e "${c_red}init.sh introuvable...$c_"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -z $repOption || $repOption != "no" ]] && read -p "Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)" repOption
|
## Installation optionnel de copylaradio
|
||||||
|
|
||||||
|
[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)$c_" && read repOption
|
||||||
[[ $repOption =~ ^(o|1|yes|options)$ ]] && .install/install_optional.sh
|
[[ $repOption =~ ^(o|1|yes|options)$ ]] && .install/install_optional.sh
|
||||||
|
|
Loading…
Reference in New Issue