From afb9e3aaf927c2b19c4442fe91c5dd5660c4f953 Mon Sep 17 00:00:00 2001 From: qo-op Date: Mon, 8 Mar 2021 19:23:44 +0100 Subject: [PATCH] corrections & optimisations --- .install/update_bashrc.sh | 10 +++++----- ISOconfig.sh | 34 +++++++++++++++------------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/.install/update_bashrc.sh b/.install/update_bashrc.sh index c530760..c8d903d 100755 --- a/.install/update_bashrc.sh +++ b/.install/update_bashrc.sh @@ -21,11 +21,11 @@ if [[ $YOU != "" && $IPFSNODEID != "" && $G1PUB != "" ]]; then sed -i "s/$G1PUB/$newG1PUB/g" ~/.bashrc sed -i "s/$IPFSNODEID/$newIPFSNODEID/g" ~/.bashrc - if [[ $IPNSKEY == "_IPNSKEY_" ]]; then - ipfs key rm xbian - IPNSKEY=$(ipfs key gen xbian) - sed -i "s/_IPNSKEY_/$IPNSKEY/g" ~/.bashrc.sh - fi + if [[ $IPNSKEY == "_IPNSKEY_" ]]; then + ipfs key rm xbian + IPNSKEY=$(ipfs key gen xbian) + sed -i "s/_IPNSKEY_/$IPNSKEY/g" ~/.bashrc + fi else # CREATE echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc diff --git a/ISOconfig.sh b/ISOconfig.sh index 166af28..1b07eca 100755 --- a/ISOconfig.sh +++ b/ISOconfig.sh @@ -1,12 +1,12 @@ #!/bin/bash ######################################################################## # Author: Fred (support@qo-op.com) -# Version: 0.2 +# Version: 0.3 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ######################################################################## -# AUTOMATIC version of interactive 1stRUNconfig.sh -# This script can run from ~/.config/autostart/Astroport_X_config.desktop # IMPORTANT!!! ipfs MUST BE ALREADY RUNNING +IPFSNODEID=$(ipfs id -f='\n') +[[ ! ${IPFSNODEID} ]] && echo "IPFS MUST BE RUNNING" && exit 1 ######################################################################## # Create secret key files # ~/.zen/secret.june @@ -18,24 +18,21 @@ [ $(id -u) -eq 0 ] && echo "RUN as root FORBIDDEN. Please run with user: $YOU" && exit 1 rm -f /tmp/A_booting_log.txt -ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` 2> /dev/null && echo "OK" || (echo "NO GATEWAY CONNEXION" && exit 1) +ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` 2>&1>/dev/null && echo "CONNEXION OK" || exit 1 -# UPDATE astrXbian code -[[ -d ~/.zen/astrXbian ]] && cd ~/.zen/astrXbian && git pull || exit 1 +# GIT PULL astrXbian code +mkdir -p ~/.zen/astrXbian && cd ~/.zen/astrXbian && git pull || exit 1 # CHECK IF CONFIG ALREADY DONE !! # ~/.zen/ipfs ~/.zen/secret ~/.zen/ipfs.sync if [[ -f ~/.zen/ipfs.sync ]]; then echo "CONFIG ALREADY DONE.... logging init in /tmp/A_booting_log.txt" source ~/.zen/ipfs.sync - - # Wait for ipfs to connect to its swarm + # Wait for IPFS to connect SWARM sleep 20 ~/.zen/astrXbian/zen/gchange_INIT.sh >> /tmp/A_booting_log.txt sleep 10 ~/.zen/astrXbian/zen/gchange_IPFS_swarm.sh >> /tmp/A_booting_log.txt - sleep 10 - ~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh >> /tmp/A_booting_log.txt exit 0 fi @@ -54,7 +51,7 @@ pepper="$(~/.zen/astrXbian/zen/tools/diceware.sh 3 | xargs)" g1_salt="$salt" g1_pepper="$pepper" -echo "FILLING /tmp/secret.june with ($g1_salt) ($g1_pepper)" +echo "Creation secret.june avec ($g1_salt) ($g1_pepper)" echo "$g1_salt" > /tmp/secret.june echo "$g1_pepper" >> /tmp/secret.june @@ -72,7 +69,7 @@ echo "CREATING /tmp/config.ipfs" ######################################################################## ipfs_ID=$(python3 ~/.zen/astrXbian/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py) echo $ipfs_ID > /tmp/secret.ipfs && source /tmp/secret.ipfs -[[ $PrivKEY == "" ]] && echo "ERROR" && exit 1 +[[ $PrivKEY == "" ]] && echo "ERROR CREATING IPFS IDENTITY" && exit 1 jq -r --arg PeerID "$PeerID" '.Identity.PeerID=$PeerID' ~/.ipfs/config > /tmp/config.tmp jq -r --arg PrivKEY "$PrivKEY" '.Identity.PrivKey=$PrivKEY' /tmp/config.tmp > /tmp/config.ipfs rm /tmp/config.tmp @@ -124,7 +121,7 @@ echo "CREATING GCHANGE+/CESIUM+ PROFILE" ######################################################################## ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://data.gchange.fr" set --name "$XZUID" --avatar "/home/$USER/.zen/astrXbian/logo.png" #GCHANGE+ ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://g1.data.e-is.pro" set --name "$XZUID" --avatar "/home/$USER/.zen/astrXbian/logo.png" #CESIUM+ -### REVERT +### DELETE # ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://g1.data.e-is.pro" erase # ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://data.gchange.fr" erase @@ -135,12 +132,12 @@ echo "BECOME FRIEND with A_boostrap_nodes.txt" for g1node in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#") # remove comments do if [[ "$g1node" != "" ]]; then - echo "LINKING TO BOOTSTRAP NODE : $g1node" + echo "SENDING STAR TO BOOTSTRAP NODE : $g1node" ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://g1.data.e-is.pro" stars -p $g1node -n 1 ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://data.gchange.fr" stars -p $g1node -n 1 - ### REVERT - # ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://g1.data.e-is.pro" unstars -p 2jQUH4HfHxdTesjCjvMCx1VJgA5AnpuvrWRq1swfRdsS - # ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://data.gchange.fr" unstars -p 2jQUH4HfHxdTesjCjvMCx1VJgA5AnpuvrWRq1swfRdsS + ### DELETE + # ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://g1.data.e-is.pro" unstars -p $g1node + # ~/.zen/astrXbian/zen/jaklis/jaklis.py -n "https://data.gchange.fr" unstars -p $g1node fi done @@ -165,8 +162,6 @@ echo 'UPDATING ~/.bashrc' echo "UPGRADING ~/.kodi" cp -Rf ~/.zen/astrXbian/.install/.kodi ~/ -# cp -f ~/.zen/astrXbian/.install/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py \ -# ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py echo "Configure .kodi/addons/plugin.video.vstream/resources/sites/astroport.py" # CREATE xbian IPNSKEY used to publish ~/.zen/ipfs_swarm/xbian (contains all XZUID pastebin files) @@ -238,6 +233,7 @@ nameserver 94.247.43.254 nameserver 2001:67c:13e4:1::37 # FFDN.org opennic.org = ns8.he.de + ns5.ru EOF +sudo cp /etc/resolv.conf /etc/resolv.conf.backup sudo mv /tmp/resolv.conf /etc/resolv.conf sudo chattr +i /etc/resolv.conf