FirstXRUNconfig.sh

This commit is contained in:
qo-op 2020-12-04 01:22:50 +01:00
parent 634ece1a58
commit 13163b25e0
1 changed files with 21 additions and 22 deletions

View File

@ -11,27 +11,26 @@
# Create ~/.zen/secret(s) and ~/.zen/config
#
#
[[ -f ~/.zen/config ]] && echo "CONFIG ALREADY DONE" && cat ~/.zen/config && exit 1
[[ -f ~/.zen/config ]] && echo "CONFIG ALREADY DONE" && cat ~/.zen/config && exit 0
# Formulaire Login
cfgpass=`zenity --forms \
--title="Configuration ASTROPORT" \
--text="Générer vos clefs de connexion" \
--add-entry="Nom du profil Gchange" \
--add-entry="Identifiants de connexion" \
--add-password="Mots de passe" \
--add-password="Confirmer mots de passe" \
--separator="|"`
#Si on clique sur le bouton Annuler
if [ "$?" -eq 1 ]; then
#On quitte le script
exit
fi
#Sinon on continue
#On peut récupérer les valeurs des différents champs de cette façon :
g1_profil=$(echo "$cfgpass" | cut -d "|" -f1) #Nom du profil Gchange
g1_id=$(echo "$cfgpass" | cut -d "|" -f2) #Identifiants de connexion
g1_pwd1=$(echo "$cfgpass" | cut -d "|" -f3) #Mot de passe | md5sum
g1_pwd2=$(echo "$cfgpass" | cut -d "|" -f4) | md5sum #Confirmation du mot de passe
# LOGIN (=SALT)
salt="$(~/.zen/astroport/zen/tools/diceware.sh 3 | xargs)"
# PASS (=PEPPER)
pepper="$(~/.zen/astroport/zen/tools/diceware.sh 3 | xargs)"
g1_profil=$(zenity --entry --text "Nom de votre profil Gchange" --title "Astroport -- Profil" --entry-text="$(hostname)");
g1_salt=$(zenity --entry --text "Un peu de sel" --title "Astroport - Sel" --entry-text="$salt");
g1_pepper=$(zenity --entry --text "Un peu de poivre" --title "Astroport - Poivre" --entry-text="$pepper");
python3 ~/.zen/astroport/zen/tools/key_create_dunikey.py "$g1_salt" "$g1_pepper"
g1pub=$(cat ~/.zen/secret.dunikey | grep "pub" | cut -d ' ' -f 2)
g1priv=$(cat ~/.zen/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
cd ~/.zen/astroport/zen/tools/
ipfs_ID=$(python3 ./create_ipfsnodeid_from_tmp_secret.dunikey.py)
zenity --info --width 300 --text "$ipfs_ID"
echo $ipfs_ID > ~/.zen/secret.ipfs
source ~/.zen/secret.ipfs