Compare commits

...

20 Commits

Author SHA1 Message Date
Yann Autissier 92c94cd5f1 Merge branch 'master' into make_it
Conflicts:
	install.sh
2022-06-26 20:47:28 +02:00
fred 1f6aa0e23c Refresh experimental Astronaut TW channels 2022-06-22 17:31:35 +02:00
fred 251b5f24af New Bootstrap Station "cancer.copylaradio.com" (CAPTAIN = yan14tricot75 = GmUD53TFfEfb6NiVqYXwxMGbxpP9nKgHPgF4jex6FBvj) 2022-06-22 17:04:22 +02:00
fred b21b7e3426 netcat-traditional 2022-06-22 16:19:03 +02:00
fred b36cb9f7c4 netcat-openbsd 1234 trick 2022-06-22 16:11:58 +02:00
aynic.os bc5c14d2ae rebase master 2021-06-09 00:55:20 +02:00
aynic.os ead1ba7a57 test 2021-06-08 21:25:22 +02:00
aynic.os dac3cfb158 test 2021-06-08 21:25:22 +02:00
aynic.os 5d6a32c1d5 test 2021-06-08 21:25:22 +02:00
aynic.os a1976ed498 test 2021-06-08 21:25:22 +02:00
aynic.os 785f715830 test 2021-06-08 21:25:20 +02:00
aynic.os 2dfa0ee7d2 test 2021-06-08 21:24:13 +02:00
aynic.os 68ccdcb394 test 2021-06-08 21:24:12 +02:00
aynic.os c7b272dfc5 test 2021-06-08 21:24:12 +02:00
aynic.os fba00c3225 test 2021-06-08 21:24:12 +02:00
aynic.os e9e1fd989d test 2021-06-08 21:24:12 +02:00
aynic.os d2b1d94967 test 2021-06-08 21:24:10 +02:00
aynic.os a5ea0292f2 1st test 2021-06-08 21:22:16 +02:00
aynic.os b76111f017 add make 2021-06-08 21:22:15 +02:00
aynic.os aebacbf56f cleanup warning git clone 2021-06-08 21:22:15 +02:00
13 changed files with 383 additions and 121 deletions

View File

@ -1 +0,0 @@
swp_token=1605043494:0cb63ecc71f6d029418e827aed3e7c9f:c8201b8ffdb3703b1d01884bce4f7584

View File

@ -1 +0,0 @@
swp_token=1603922533:31aac141fc8c1f57a856ac4be928d2c0:067e0bd7719ed36e424bd1d672ebecdb

View File

@ -3,3 +3,5 @@
/ip4/51.15.166.54/tcp/4001/p2p/12D3KooWBYme2BsNUrtx4mEdNX6Yioa9AV7opWzQp6nrPs6ZKabN
# aries.copylaradio.com (thuya83pk) = HbBJDXDrN8swxvMohMxmegYRyZ7m99jqgxwwN1gwxck2
/ip4/37.187.127.175/tcp/4001/p2p/12D3KooWSQYTxeoZZ39SNosEKxi7RUdGTtAQAqpKeZJxjzqqrZTx
# cancer.copylaradio.com (yan14tricot75) = GmUD53TFfEfb6NiVqYXwxMGbxpP9nKgHPgF4jex6FBvj
/ip4/185.202.238.69/udp/4001/quic/p2p/12D3KooWRaqNpB2xr8w5WGDvU9HHj9MST9Rnp1kmMGc67e6z98ef

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
MYOS ?= ../myos
-include $(MYOS)/make/include.mk
.PHONY: all default install shellcheck shellcheck-% shellspec shellspec-% tests uninstall
SHELL_FILES ?= $(wildcard .*/*.sh */*.sh */*/*.sh)
$(MYOS):
git clone https://git.p2p.legal/aya/myos $(MYOS)
default: tests
all: install tests
install:
./install.sh
tests: shellcheck shellspec
shellcheck:
shellcheck $(SHELL_FILES) ||:
shellcheck-%:
shellcheck $*/*.sh
shellspec: shellspec-specs
shellspec-%:
shellspec -f tap $*
uninstall:

View File

@ -29,6 +29,16 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
[[ $(which ffmpeg) == "" ]] && echo "ERREUR! Installez ffmpeg" && echo "sudo apt install ffmpeg" && exit 1
[[ $(which xdpyinfo) == "" ]] && echo "ERREUR! Installez x11-utils" && echo "sudo apt install x11-utils" && exit 1
# Check who is .current PLAYER
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
URL="$1"
if [ $URL ]; then
echo "URL: $URL"
@ -38,7 +48,7 @@ if [ $URL ]; then
CHOICE="$IMPORT"
fi
[[ $CHOICE == "Web" ]] && CHOICE=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Cette source Web est à enregistrer comme " --entry-text="Page" WebSite)
[[ $CHOICE == "Web" ]] && CHOICE="Page" #&& CHOICE=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Cette source Web est à enregistrer comme " --entry-text="Page" WebSite)
# REMOVE GtkDialog errors for zenity
shopt -s expand_aliases
@ -102,7 +112,7 @@ YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail
########################################################################
# CHOOSE CATEGORY (remove anime, not working!)
[[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre media" --entry-text="Film" Serie Youtube Video)
[[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre ajout" --entry-text="Film" Serie Youtube Video Astronaute)
[[ $CHOICE == "" ]] && exit 1
# LOWER CARACTERS
@ -117,6 +127,28 @@ PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A
########################################################################
case ${CAT} in
########################################################################
# CASE ## ASTRONAUTE
# _ _
# __ _ ___| |_ _ __ ___ _ __ __ _ _ _| |_ ___
# / _` / __| __| '__/ _ \| '_ \ / _` | | | | __/ _ \
# | (_| \__ \ |_| | | (_) | | | | (_| | |_| | || __/
# \__,_|___/\__|_| \___/|_| |_|\__,_|\__,_|\__\___|
#
#
########################################################################
astronaute)
# INSTASCAN G1PUB CAPTURE
~/.zen/Astroport.ONE/tools/instascan_login.sh "ONE"
if [[ $CAPTAIN == $PLAYER ]]; then
zenity --warning --width 300 --text "Bienvenue $PLAYER"
fi
exit 0
;;
########################################################################
# CASE ## YOUTUBE
# _ _
# _ _ ___ _ _| |_ _ _| |__ ___

132
include.sh Normal file
View File

@ -0,0 +1,132 @@
#!/bin/bash
[ "${DEBUG}" ] && set -x
check_requirements() {
[[ ! $(which ipfs) ]] && echo "=== installez ipfs !!" && echo "https://docs.ipfs.io/install/command-line/#official-distributions" && exit 1
echo "astrxbian installateur pour distributions debian et dérivées : linuxmint (https://www.linuxmint.com/) ou xbian (https://xbian.org) recommandées"
echo "appuyez sur entrer pour commencer."; read test; [[ "$test" != "" ]] && echo "sortie" && exit 0 ## ajouter confirmation à chaque nouvelle étape (+explications)
echo ; echo "mise à jour des dépots de votre distribution..."
sudo apt-get update
[[ "$user" != "xbian" ]] &&\
for i in x11-utils xclip zenity handbrake*; do\
[ $(dpkg-query -w -f='${status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ] &&\
echo ">>> installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";\
sudo apt install -y $i;
done
for i in git fail2ban netcat-traditional inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev; do
if [ $(dpkg-query -w -f='${status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo ">>> installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
sudo apt install -y $i
fi
done
for i in build-essential qrencode jq bc file gawk yt-dlp ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox nmap httrack html2text ssmtp imagemagick ttf-mscorefonts-installer libcurl4-openssl-dev; do
if [ $(dpkg-query -w -f='${status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo ">>> installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
sudo apt install -y $i
fi
done
[[ ! $(which kodi) && "$user" != "xbian" ]] &&\
echo ">>> installation kodi + vstream = votre videotheque ! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";\
sudo apt-get install kodi -y;\
${MY_PATH}/.install/kodi_uqload_downloader.sh
echo "## INSTALLATION AstroGEEK OpenCV = 'Intelligence Amie' "
sudo apt-get install python3-opencv -y
## Correct PDF restrictions for imagemagick
echo "# Correction des droits export PDF imagemagick"
if [[ $(cat /etc/ImageMagick-6/policy.xml | grep PDF) ]]; then
cat /etc/ImageMagick-6/policy.xml | grep -Ev PDF > /tmp/policy.xml
sudo cp /tmp/policy.xml /etc/ImageMagick-6/policy.xml
fi
echo "###########################"
echo "## INSTALL PYTHON CRYPTO LAYER "
echo "###########################"
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc; echo ">>> PATH=$PATH"
python3 -m pip install -U pip
python3 -m pip install -U setuptools wheel
python3 -m pip install -U cryptography Ed25519 base58 google duniterpy pynacl pgpy
python3 -m pip install -U nicotine-plus silkaj
python3 -m pip install -U protobuf==3.19.0
if [[ "$USER" == "pi" ]]; then ## PROPOSE QR_CODE PRINTER SUR RPI
echo "Ambassade? Souhaitez vous ajouter imprimante 'brother_ql'? Saisissez OUI, sinon laissez vide et tapez sur ENTRER"
read saisie
if [[ $saisie != "" ]]; then
sudo apt install printer-driver-all cups -y
sudo pip3 install brother_ql
sudo cupsctl --remote-admin
sudo usermod -aG lpadmin pi
sudo usermod -a -G gammu pi
fi
fi
# python3 -m pip install -U silkaj
## python -> python3 link
sudo ln -f -s /usr/bin/python3 /usr/bin/python
}
i_am() {
echo 'v0.5.0'
}
i_am_root() {
[ $(id -u) -eq 0 ]
}
i_am_xbian() {
[[ "$USER" == "xbian" ]]
}
i_should_install() {
[[ ! -f ~/.zen/secret.dunikey ]]
}
import_astrXbian() {
echo "=== Clonage git CODE 'astrXbian' + 'Astroport.ONE' depuis https://git.p2p.legal"
mkdir -p ~/.zen
cd ~/.zen
# TODO INSTALL FROM IPFS / IPNS
git clone https://git.p2p.legal/axiom-team/astrXbian.git
git clone https://git.p2p.legal/qo-op/Astroport.ONE.git
}
import_astroport() {
echo "INITIALISATIOn Astroport/KODI"
echo "Appuyez sur la touche ENTREE pour démarrer le mode Aventure"
echo "sinon interrompez ici l'installation, et activez votre Ambassade ~/.zen/Astroport.ONE/start.sh"
read
~/.zen/Astroport.ONE/adventure.sh
# ~/.zen/astrXbian/ISOconfig.sh
}
import_ipfs() {
## Scripts pour systemd ou InitV (xbian)
echo "=== Activation SYSTEM IPFS"
~/.zen/astrXbian/.install/ipfs_alone.sh
}
import_jaklis() {
echo "=== Configuration jaklis: Centre de communication CESIUM+ GCHANGE+"
cd ~/.zen/astrXbian/zen/jaklis
./setup.sh
}
import_kodi() {
echo "=== IMPORT configuration ASTROPORT dans ~/.kodi"
cp -Rf ~/.zen/astrXbian/.install/.kodi ~/
}
prepare_next_boot() {
cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0"
# PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK
echo "su - xbian -c '~/.zen/astrXbian/FirstBOOT.sh'" >> /tmp/new.rc.local
echo "exit 0" >> /tmp/new.rc.local
sudo cp -f /tmp/new.rc.local /etc/rc.local
}

View File

@ -1,6 +1,7 @@
#!/bin/bash
. ./include.sh
########################################################################
# Version: 0.3
# Version: 0.5.0
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
{
@ -8,122 +9,41 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
########################################################################
[[ ! $(which ipfs) ]] && echo "=== Installez IPFS !!" && echo "https://docs.ipfs.io/install/command-line/#official-distributions" && exit 1
i_am_root && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
# MAIN # SI AUCUNE CLEF DE STATION...
if [[ ! -f ~/.zen/secret.dunikey ]];
if i_should_install;
then
# Check requirements
echo "AstrXbian installateur pour distributions DEBIAN et dérivées : LinuxMint (https://www.linuxmint.com/) ou XBIAN (https://xbian.org) recommandées"
echo "Appuyez sur ENTRER pour commencer."; read TEST; [[ "$TEST" != "" ]] && echo "SORTIE" && exit 0 ## Ajouter confirmation à chaque nouvelle étape (+explications)
echo ; echo "Mise à jour des dépots de votre distribution..."
sudo apt-get update
# Install requirements
check_requirements
[[ "$USER" != "xbian" ]] &&\
for i in x11-utils xclip zenity handbrake*; do\
[ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ] &&\
echo ">>> Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";\
sudo apt install -y $i;
done
# Clone astrXbian and Astroport.One
import_astrXbian
for i in git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev; do
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo ">>> Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
sudo apt install -y $i
fi
done
# Init ipfs
import_ipfs
for i in build-essential qrencode jq bc file gawk yt-dlp ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox nmap httrack html2text ssmtp imagemagick ttf-mscorefonts-installer libcurl4-openssl-dev; do
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo ">>> Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
sudo apt install -y $i
fi
done
# Copy astroport config in kodi
import_kodi
[[ ! $(which kodi) && "$USER" != "xbian" ]] &&\
echo ">>> Installation Kodi + Vstream = VOTRE VIDEOTHEQUE ! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";\
sudo apt-get install kodi -y;\
${MY_PATH}/.install/kodi_uqload_downloader.sh
echo "## INSTALLATION AstroGEEK OpenCV = 'Intelligence Amie' "
sudo apt-get install python3-opencv -y
## Correct PDF restrictions for imagemagick
echo "# Correction des droits export PDF imagemagick"
if [[ $(cat /etc/ImageMagick-6/policy.xml | grep PDF) ]]; then
cat /etc/ImageMagick-6/policy.xml | grep -Ev PDF > /tmp/policy.xml
sudo cp /tmp/policy.xml /etc/ImageMagick-6/policy.xml
fi
echo "###########################"
echo "## INSTALL PYTHON CRYPTO LAYER "
echo "###########################"
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc; echo ">>> PATH=$PATH"
python3 -m pip install -U pip
python3 -m pip install -U setuptools wheel
python3 -m pip install -U cryptography Ed25519 base58 google duniterpy pynacl pgpy
python3 -m pip install -U nicotine-plus silkaj
python3 -m pip install -U protobuf==3.19.0
if [[ "$USER" == "pi" ]]; then ## PROPOSE QR_CODE PRINTER SUR RPI
echo "Ambassade? Souhaitez vous ajouter imprimante 'brother_ql'? Saisissez OUI, sinon laissez vide et tapez sur ENTRER"
read saisie
if [[ $saisie != "" ]]; then
sudo apt install printer-driver-all cups -y
sudo pip3 install brother_ql
sudo cupsctl --remote-admin
sudo usermod -aG lpadmin pi
sudo usermod -a -G gammu pi
fi
fi
# python3 -m pip install -U silkaj
## python -> python3 link
sudo ln -f -s /usr/bin/python3 /usr/bin/python
########################################################################
echo "=== Clonage git CODE 'astrXbian' + 'Astroport.ONE' depuis https://git.p2p.legal"
mkdir -p ~/.zen
cd ~/.zen
git clone https://git.p2p.legal/axiom-team/astrXbian.git
git clone https://git.p2p.legal/qo-op/Astroport.ONE.git
# TODO INSTALL FROM IPFS / IPNS
## Scripts pour systemd ou InitV (xbian)
echo "=== Activation SYSTEM IPFS"
~/.zen/astrXbian/.install/ipfs_alone.sh
########################################################################
echo "=== IMPORT configuration ASTROPORT dans ~/.kodi"
cp -Rf ~/.zen/astrXbian/.install/.kodi ~/
########################################################################
echo "=== Configuration jaklis: Centre de communication CESIUM+ GCHANGE+"
cd ~/.zen/astrXbian/zen/jaklis
./setup.sh
# Jaklis setup
import_jaklis
########################################################################
echo "=== Sécurisation DEFCON SUDOERS FAIL2BAN"
## XBIAN fail2ban ERROR correction ##
#[....] Starting authentication failure monitor: fail2ban No file(s) found for glob /var/log/auth.log
[[ "$USER" == "xbian" ]] && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf
i_am_xbian && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf
# NODE activates fail2ban IN zen/ipfs_SWARM_refresh.sh
### MODIFIYING /etc/sudoers ###
[[ "$USER" == "xbian" ]] && echo "xbian ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/astroport')
i_am_xbian && echo "xbian ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/astroport')
# PERSONNAL DEFCON LEVEL
# cp ~/.zen/astrXbian/DEFCON ~/.zen/
if [[ "$USER" == "xbian" ]]
if i_am_xbian
then
echo "enabling ipfs initV service autostart"
cd /etc/rc2.d && sudo ln -s ../init.d/ipfs S02ipfs
@ -158,26 +78,17 @@ echo ">>> INFO : Ajoutez l'extension 'OpenWith' à votre navigateur !!
# https://addons.mozilla.org/firefox/addon/open-with/
# https://chrome.google.com/webstore/detail/open-with/cogjlncmljjnjpbgppagklanlcbchlno"
if [[ "$USER" != "xbian" ]]
if ! i_am_xbian
then
## Desktop install
echo "INITIALISATIOn Astroport/KODI"
echo "Appuyez sur la touche ENTREE pour démarrer le mode Aventure"
echo "sinon interrompez ici l'installation, et activez votre Ambassade ~/.zen/Astroport.ONE/start.sh"
read
~/.zen/Astroport.ONE/adventure.sh
# ~/.zen/astrXbian/ISOconfig.sh
## Desktop install
import_astroport
else
## Rpi Xbian install.
cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0"
# PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK
echo "su - xbian -c '~/.zen/astrXbian/FirstBOOT.sh'" >> /tmp/new.rc.local
echo "exit 0" >> /tmp/new.rc.local
sudo cp -f /tmp/new.rc.local /etc/rc.local
## Rpi Xbian install.
prepare_next_boot
echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI"
echo "Faites une ISO : sudo xbian-config"
exit 0
echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI"
echo "Faites une ISO : sudo xbian-config"
exit 0
fi
# MAIN # -f ~/.zen/secret.june (ISOConfig déjà lancé) ##

54
specs/astrXbian_spec.sh Normal file
View File

@ -0,0 +1,54 @@
#shellcheck shell=sh
Describe 'AstrXbian'
Describe 'install.sh'
Include ./include.sh
It 'should check it applies to me'
When call i_am
The output should eq 'v0.5.0'
End
It 'should check I am not superuser'
When call i_am_root
The status should not be success
End
It 'should check I need to install'
When call i_should_install
The status should be success
End
It 'should check requirements, but not tested'
Skip "You should implement check_requirements tests"
When run check_requirements
The status should be success
End
It 'should import astrXbian, but not tested'
Skip "You should implement import_astrXbian tests"
When run import_astrXbian
The status should be success
End
It 'should import astroport, but not tested'
Skip "You should implement import_astroport tests"
When run import_astroport
The status should be success
End
It 'should import IPFS, but not tested'
Skip "You should implement import_ipfs tests"
When run import_ipfs
The status should be success
End
It 'should import Jaklis, but not tested'
Skip "You should implement import_jaklis tests"
When run import_jaklis
The status should be success
End
It 'should import Kodi, but not tested'
Skip "You should implement import_kodi tests"
When run import_kodi
The status should be success
End
It 'should prepare astrXbian for first boot, but not tested'
Skip "You should implement prepare_next_boot tests"
When run prepare_next_boot
The status should be success
End
End
End

33
zen/ipns_MOA_publish.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
########################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
ipfs --timeout=3s ls /ipns/$MOANS
if [ $? != 0 ]; then
#echo "## PUBLISHING moa_${PLAYER} /ipns/$MOANS"
ls ~/.zen/game/players/$PLAYER/moa/*
IPUSH=$(ipfs add -rwHq ~/.zen/game/players/$PLAYER/moa/* | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.ts
echo 1 > ~/.zen/game/players/$PLAYER/moa/$PLAYER.moa.n
ipfs name publish --key=moa_${PLAYER} /ipfs/$IPUSH 2>/dev/null
else
## MISE A JOUR CACHE
ipfs get -o ~/.zen/game/players/$PLAYER/moa/ /ipns/$MOANS
fi
echo "PUBLISHED ~/.zen/ipfs TO http://127.0.0.1:8080/ipns/$QOOPNS"

31
zen/ipns_PLAYER_publish.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
########################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
ipfs --timeout=3s ls /ipns/$PLAYERNS
if [ $? != 0 ]; then
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/$PLAYER.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/$PLAYER.ts
echo 1 > ~/.zen/game/players/$PLAYER/$PLAYER.n
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
else
## MISE A JOUR CACHE (TODO : ADD CHAIN TO BE ABLE TO REVERSE TIME) - "Activate archive.org"
ipfs get -o ~/.zen/game/players/$PLAYER/index.html /ipns/$PLAYERNS
fi
echo "PUBLISHED ~/.zen/ipfs TO http://127.0.0.1:8080/ipns/$PLAYERNS"

32
zen/ipns_TW5_publish.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
########################################################################
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
ipfs --timeout=3s ls /ipns/$QOOPNS
if [ $? != 0 ]; then
IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/index.html | tail -n 1)
echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.ts
echo 1 > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/$PLAYER.qo-op.n
ipfs name publish --key=qo-op_${PLAYER} /ipfs/$IPUSH 2>/dev/null
else
## MISE A JOUR CACHE
ipfs get -o ~/.zen/game/players/$PLAYER/ipfs/.$IPFSNODEID/index.html /ipns/$QOOPNS
fi
echo "PUBLISHED ~/.zen/ipfs TO http://127.0.0.1:8080/ipns/$QOOPNS"

View File

@ -6,13 +6,20 @@ ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
########################################################################
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID)
[[ $IPFSNODEID == "" ]] && echo "ipfs TIMEOUT" && exit 1
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
PLAYERNS=$(cat ~/.zen/game/players/.current/.playerns 2>/dev/null) || ( echo "noplayerns" && exit 1 )
MOANS=$(cat ~/.zen/game/players/.current/.moans 2>/dev/null) || ( echo "noplayermoans" && exit 1 )
QOOPNS=$(cat ~/.zen/game/players/.current/.qoopns 2>/dev/null) || ( echo "noplayerqoopns" && exit 1 )
########################################################################
## TESSERACT DOUBLE ACTION
########################################################################
echo "Adding ~/.zen/ipfs to IPFS"
echo "Adding ~/.zen/ipfs/ to IPFS"
# MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
# OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/.chain)
# echo "OLD: $OLDCHAIN != NEW:$MIPFS ?"