From 37b6f2e7d0429ea5679f73faed168d24a2aeff13 Mon Sep 17 00:00:00 2001 From: qo-op Date: Thu, 14 May 2020 13:55:43 +0200 Subject: [PATCH] little better LAN / WAN install difference --- .install/loveland.sh | 18 ++++++++++++++---- g1sms/init_keys.sh | 14 +------------- g1sms/sms_ASTROPORT.sh | 15 ++++++++------- www/LOVELand/index.html | 2 +- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/.install/loveland.sh b/.install/loveland.sh index 096a1b7..e3b54a7 100755 --- a/.install/loveland.sh +++ b/.install/loveland.sh @@ -37,7 +37,7 @@ sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc espea ## CONFIG MPD sudo cp -f /home/$YOU/.zen/astroport/.install/templates/copylaradio/mpd.conf /etc/mpd.conf sudo sed -i "s/_USER_/$USER/g" /etc/mpd.conf || err=1 -mkdir ~/.config/mpd && sudo cp -f /etc/mpd.conf ~/.config/mpd/mpd.conf && chown $USER ~/.config/mpd/mpd.conf +mkdir ~/.config/mpd && sudo cp -f /etc/mpd.conf ~/.config/mpd/mpd.conf && sudo chown $USER ~/.config/mpd/mpd.conf ## MUSIC & PLAYLISTS mkdir -p ~/.zen/music @@ -60,7 +60,7 @@ sudo sed -i "s/_PHPVERSION_/$PHPVERSION/g" /etc/nginx/conf.d/loveland.conf nodename=$(cat /etc/hostname) echo "ENTER Station accessible Network name !!! Suggestion : $nodename" read nodename -[[ $nodename == "" ]] && echo "ENTER your Node Name? (or Hit ENTER)" && read nodename +[[ $nodename == "" ]] && echo "Are you sure? Hit ENTER to keep $nodename)" && read nodename [[ $nodename == "" ]] && nodename=$(cat /etc/hostname) sudo sed -i "s/_SERVERNAME_/$nodename/g" /etc/nginx/conf.d/loveland.conf @@ -77,9 +77,19 @@ sudo rm -f /etc/nginx/sites-enabled/default sudo systemctl restart nginx || err=1 -echo "Trying to REstarting OASIS" +echo "Trying to REstarting OASIS and find good 'host' options" kill -9 $(ps auxf --sort=+utime | grep -w oasis | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}') -oasis --allow-host $nodename --host $nodename 2>&1>/dev/null & +extension=$(echo $nodename | cut -d '.' -f 2) +myip=$(hostname -I | awk '{print $1}') +isLAN=$(echo $myip | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") + +if [[ ! $isLAN ]]; then + oasis --allow-host $nodename 2>&1>/dev/null & + echo "BE CAREFULL your SSB identity could be publicly controled..." + echo "BE CAREFULL your SSB identity could be publicly controled..." +else + oasis --allow-host $nodename --host $nodename 2>&1>/dev/null & +fi sleep 5 diff --git a/g1sms/init_keys.sh b/g1sms/init_keys.sh index e0c3ad6..fb4bc62 100755 --- a/g1sms/init_keys.sh +++ b/g1sms/init_keys.sh @@ -40,18 +40,6 @@ I am $(whoami) on $IPFSNODEID " ################################################################## -# G1sms+ Node KEYS (G1wallet, gpg, IPNS) -echo ' - - ________ ___________ ____ _ __ __ - / _/ __ \/ ____/ ___// __ \_____(_) __/ //_/__ __ __ - / // /_/ / /_ \__ \/ /_/ / ___/ / | / / ,< / _ \/ / / / - _/ // ____/ __/ ___/ / ____/ / / /| |/ / /| / __/ /_/ / -/___/_/ /_/ /____/_/ /_/ /_/ |___/_/ |_\___/\__, / - /____/ -Formed with 24 first char IPFS .Identity.PrivKey -Used as gpg symetric key (soon deprecated?) -' ################################################################## IPFSPrivKey=$(cat /home/$YOU/.ipfs/config | jq -r '.Identity.PrivKey') #" export IPFSPrivKey="${IPFSPrivKey:0:24}" # @@ -62,11 +50,11 @@ if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSP ################################################################## # G1sms Service - G1Wallet # +[[ ! -d /home/$YOU/.zen/ipfs/.$IPFSNODEID/TASK/loveland_entrance ]] && mkdir -p /home/$YOU/.zen/ipfs/.$IPFSNODEID/TASK/loveland_entrance # ONE TIME GIVE NODE_UIDNA if [[ ! -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then # CREATE NODE G1 KEYS AND FILES - mkdir -p /home/$YOU/.zen/ipfs/.$IPFSNODEID/TASK #################################################################### # GIVE NAME TO NODE G1 WALLET: "6789diceware" diff --git a/g1sms/sms_ASTROPORT.sh b/g1sms/sms_ASTROPORT.sh index f1e21fc..b1ce8de 100755 --- a/g1sms/sms_ASTROPORT.sh +++ b/g1sms/sms_ASTROPORT.sh @@ -33,7 +33,7 @@ echo ' / ___ |(__ ) /_/ / / /_/ / /_/ / /_/ / / / /_ /_/ |_/____/\__/_/ \____/ .___/\____/_/ \__/ /_/ -Love Land ENTRANCE CHECKING +Love Land ENTRANCE CHECKING ' [[ ! $G1SMS == "yes" ]] && echo "I am NOT a G1SMS Node... Can't do nothing... EXIT" && exit 1 @@ -41,10 +41,11 @@ Love Land ENTRANCE CHECKING $MY_PATH/ipfs_SWARM_refresh.sh for hashfile in $(ls /home/$YOU/.zen/ipfs_swarm/.Qm*/TASK/loveland_entrance); do -# PHONE=$(cat $hashfile) -# HPHONE=$(basename -- "$hashfile") -# echo "We have received Ajax Astroport request from $PHONE" -#done + PHONE=$(cat $hashfile) + HPHONE=$(basename -- "$hashfile") + echo "We have received Ajax Astroport request from $PHONE" +done +# CHECK if PHONE is ALREADY registered in SWARM # if [[ ! -f /home/$YOU/.zen/ipfs_swarm/.Qm*/CHANNEL/$PHONEHASH@*/_pub ]]; then # fi # TODO SSB task relay MODE ?? @@ -67,7 +68,7 @@ for hashfile in $(ls /tmp/loveland_entrance/); do [[ $PARRAIN ]] && MEMRIB=$(sms_uid2key "$PARRAIN" "$PHONE" "$PIN") && echo "RIB PARRAIN: $MEMRIB" # CREATE G1 WALLET - $MY_PATH/sms_NEW.sh "$PHONE" "$PARRAIN" + echo " RUN $MY_PATH/sms_NEW.sh "$PHONE" "$PARRAIN" " else # ACCOUNT ALREADY EXISTING @@ -78,7 +79,7 @@ for hashfile in $(ls /tmp/loveland_entrance/); do AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR") # DOUBLE AUTH SMS !! - $MY_PATH/sms_AUTH.sh "$PHONE" "$PARRAIN" + echo "RUN $MY_PATH/sms_AUTH.sh "$PHONE" "$PARRAIN" " mess="Bonjour! Astroport Station" diff --git a/www/LOVELand/index.html b/www/LOVELand/index.html index e49ec57..3693837 100644 --- a/www/LOVELand/index.html +++ b/www/LOVELand/index.html @@ -88,7 +88,7 @@
-

Soyons LIBRE
dirigeons nous vers un Futur plus Humain

+

Soyons LIBRE !!
ensemble vers un Futur plus Humain.