1
0
astroport/FirstXRUNconfig.sh
2020-12-04 02:55:16 +01:00

45 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 2020.12.04
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
#
# This script is run from ~/.config/autostart/Astroport_X_config.desktop
#
########################################################################
# Create ~/.zen/secret(s) and ~/.zen/config
#
#
[[ -f ~/.zen/config ]] && echo "CONFIG ALREADY DONE" && cat ~/.zen/config && exit 0
# 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");
echo "CREATE /tmp/secret.dunikey"
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)
echo
echo "CREATE ~/.ipfs/config.new"
ipfs_ID=$(python3 ~/.zen/astroport/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py)
echo $ipfs_ID > ~/.zen/secret.ipfs
source ~/.zen/secret.ipfs
jq -r --arg PeerID "$PeerID" '.Identity.PeerID=$PeerID' ~/.ipfs/config > /tmp/config.tmp
jq -r --arg PrivKEY "$PrivKEY" '.Identity.PrivKey=$PrivKEY' /tmp/config.tmp > ~/.ipfs/config.new
rm /tmp/config.tmp
echo $PeerID
echo $PrivKEY
echo