2022-08-23 13:38:37 +02:00
#!/bin/bash
########################################################################
# Version: 0.3
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
{
2024-04-24 00:54:41 +02:00
## Détection emplacement script et initialisation "MY_PATH"
2022-08-23 13:38:37 +02:00
MY_PATH = " `dirname \" $0 \"` " # relative
MY_PATH = " `( cd \" $MY_PATH \" && pwd )` " # absolutized and normalized
ME = " ${ 0 ##*/ } "
2022-10-29 22:13:27 +02:00
start = ` date +%s`
2022-08-23 13:38:37 +02:00
2022-12-14 20:52:57 +01:00
################################################################## SUDO
2024-04-24 00:54:41 +02:00
## Lancement "root" interdit...
2022-12-14 20:52:57 +01:00
########################################################################
[ $( id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. " && exit 1
2023-04-22 00:25:31 +02:00
[ [ ! $( groups | grep -w sudo) ] ] \
&& echo " AUCUN GROUPE \"sudo\" : su -; usermod -aG sudo $USER " \
&& su - && apt-get install sudo -y \
&& echo "Run Install Again..." && exit 0
2022-12-14 20:52:57 +01:00
################################################################### IPFS
2024-04-24 00:54:41 +02:00
## installation de ipfs
2022-08-23 13:38:37 +02:00
########################################################################
2022-11-25 15:32:19 +01:00
[ [ ! $( which ipfs) ] ] \
2024-02-26 00:16:19 +01:00
&& echo "bash <(wget -qO- https://git.p2p.legal/qo-op/Astroport.ONE/raw/branch/master/install.kubo_v0.20.0_linux.sh)" \
2023-01-08 20:02:49 +01:00
&& architecture = $( uname -m) && [ [ $architecture = = "x86_64" || $architecture = = "aarch64" || " $architecture " = = "armv7l" ] ] \
2024-02-26 00:16:19 +01:00
&& bash <( wget -qO- https://raw.githubusercontent.com/papiche/Astroport.ONE/master/install.kubo_v0.20.0_linux.sh) \
2024-02-12 21:54:00 +01:00
|| echo "=== IPFS FOUND === OK"
2023-01-06 14:59:26 +01:00
2022-12-14 20:52:57 +01:00
[ [ ! $( which ipfs) ] ] && echo "INSTALL IPFS PLEASE" && exit 1
2022-10-27 15:48:35 +02:00
2024-04-24 00:54:41 +02:00
####################################################################
# MAIN # AUCUNE CLEF PLAYER...
2022-10-27 15:48:35 +02:00
if [ [ ! -d ~/.zen/game/players/ ] ] ;
2022-08-23 13:38:37 +02:00
then
2022-10-29 22:13:27 +02:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
echo "###### ASTROPORT.ONE ZEN STATION ##############"
2024-02-15 18:46:06 +01:00
echo "############# TW HOSTING & Ŋ1 SERVICES #############"
2022-11-17 13:29:54 +01:00
echo "##################################################"
2023-04-15 15:28:47 +02:00
echo ; echo "UPDATING SYSTEM REPOSITORY"
2024-01-11 16:59:16 +01:00
#~ [[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] && sudo add-apt-repository ppa:obsproject/obs-studio
2022-08-23 13:38:37 +02:00
sudo apt-get update
2022-10-29 22:13:27 +02:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
echo "######### INSTALL PRECIOUS FREE SOFTWARE ####"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2024-08-18 14:26:34 +02:00
for i in git tldr ssss make cmake docker.io docker-compose-v2 fail2ban npm shellcheck multitail netcat-traditional ncdu chromium miller inotify-tools curl net-tools mosquitto libsodium* libcurl4-openssl-dev; do
2024-04-24 00:54:41 +02:00
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
[ [ $? != 0 ] ] && echo " INSTALL $i FAILED. " && echo " INSTALL $i FAILED. " >> /tmp/install.errors.log && continue
fi
done
2022-10-29 22:13:27 +02:00
2024-04-24 00:54:41 +02:00
echo "#############################################"
echo "######### INSTALL PYTHON3 SYSTEM LIBRARIES ####"
echo "#############################################"
2024-08-08 17:01:42 +02:00
for i in pipx python3-pip python3-setuptools python3-wheel python3-dotenv python3-gpg python3-jwcrypto python3-brotli python3-aiohttp; do
2022-08-23 13:38:37 +02:00
if [ $( dpkg-query -W -f= '${Status}' $i 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ; then
2023-02-20 23:54:18 +01:00
echo " >>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "
2022-08-23 13:38:37 +02:00
sudo apt install -y $i
2022-11-25 14:02:58 +01:00
[ [ $? != 0 ] ] && echo " INSTALL $i FAILED. " && echo " INSTALL $i FAILED. " >> /tmp/install.errors.log && continue
2022-09-12 19:48:20 +02:00
2022-08-23 13:38:37 +02:00
fi
done
2024-04-24 00:54:41 +02:00
2022-10-29 22:13:27 +02:00
echo "#############################################"
2024-04-24 01:00:31 +02:00
echo "######### INSTALL MULTIMEDIA & DATA TOOLS ######"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2024-01-16 15:02:26 +01:00
for i in qrencode pv gnupg gpa pandoc ca-certificates basez jq bc file gawk ffmpeg dnsutils ntpdate v4l-utils espeak vlc mp3info musl-dev openssl* detox nmap httrack html2text ssmtp imagemagick; do
2022-08-23 13:38:37 +02:00
if [ $( dpkg-query -W -f= '${Status}' $i 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ; then
2023-02-20 23:54:18 +01:00
echo " >>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "
2022-08-23 13:38:37 +02:00
sudo apt install -y $i
2022-11-25 14:02:58 +01:00
[ [ $? != 0 ] ] && echo " INSTALL $i FAILED. " && echo " INSTALL $i FAILED. " >> /tmp/install.errors.log && continue
2022-09-12 19:48:20 +02:00
2022-08-23 13:38:37 +02:00
fi
done
2024-01-02 00:16:48 +01:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
echo "######### INSTALL ASCII ART TOOLS ######"
2024-01-02 00:16:48 +01:00
echo "#############################################"
2024-02-22 15:22:48 +01:00
for i in cmatrix cowsay fonts-hack-ttf; do
2024-01-02 00:16:48 +01:00
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
[ [ $? != 0 ] ] && echo " INSTALL $i FAILED. " && echo " INSTALL $i FAILED. " >> /tmp/install.errors.log && continue
fi
done
2022-12-13 15:52:12 +01:00
#### GIT CLONE ###############################################################
2023-04-15 15:19:32 +02:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
echo "=== CODE CLONING TO '~/.zen/Astroport.ONE' ==="
2023-04-15 15:19:32 +02:00
echo "#############################################"
2022-12-13 15:52:12 +01:00
mkdir -p ~/.zen
cd ~/.zen
2023-01-10 04:04:16 +01:00
git clone --depth 1 https://github.com/papiche/Astroport.ONE.git
2022-12-13 15:52:12 +01:00
# TODO INSTALL FROM IPFS / IPNS
2022-10-29 22:13:27 +02:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
echo "######### INSTALL TIDDLYWIKI ############"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2022-09-12 19:48:20 +02:00
##########################################################
2022-12-13 17:33:53 +01:00
sudo npm install -g tiddlywiki
2024-04-24 00:54:41 +02:00
[ [ $? != 0 ] ] \
&& echo "INSTALL tiddlywiki FAILED." \
&& echo "INSTALL tiddlywiki FAILED." >> /tmp/install.errors.log
2022-08-23 14:24:18 +02:00
2022-08-23 13:38:37 +02:00
## Correct PDF restrictions for imagemagick
2023-04-15 15:28:47 +02:00
echo "######### IMAGEMAGICK PDF ############"
2022-08-23 13:38:37 +02:00
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
2024-02-15 18:46:06 +01:00
echo "#####################################"
2024-04-24 00:54:41 +02:00
echo "## PYTHON TOOLS & CRYPTO LIB ##"
echo "#####################################"
2024-02-15 18:46:06 +01:00
export PATH = $HOME /.local/bin:$PATH
2024-08-09 15:48:32 +02:00
for i in pip setuptools wheel amzqr pdf2docx pyppeteer cryptography Ed25519 base58 google duniterpy silkaj pynacl pgpy pynentry paho-mqtt ipfshttpclient; do
2022-10-27 15:48:35 +02:00
echo " >>> Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "
2024-08-09 15:48:32 +02:00
pip install --break-system-packages $i 2>> /tmp/install.errors.log
# [[ $? != 0 ]] && pipx install $i 2>> /tmp/install.errors.log
2023-12-19 11:51:44 +01:00
[ [ $? != 0 ] ] && echo " INSTALL $i FAILED. " && echo " python -m pip install -U $i FAILED. " >> /tmp/install.errors.log && continue
2022-10-27 15:48:35 +02:00
done
2024-08-24 23:36:38 +02:00
if [ [ $( which X 2>/dev/null) ] ] ; then
echo "#############################################"
echo "######### INSTALL DESKTOP TOOLS ######"
echo "#############################################"
for i in x11-utils xclip zenity kodi; 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 ;
[ [ $? != 0 ] ] && echo " INSTALL $i FAILED. " && echo " INSTALL $i FAILED. " >> /tmp/install.errors.log && continue
fi
done
fi
2022-10-29 22:13:27 +02:00
echo "#############################################"
2023-04-15 15:28:47 +02:00
echo "######### IMPRIMANTE & G1BILLET ##############"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2023-11-16 18:07:55 +01:00
########### QRCODE : ZENCARD / G1BILLET : PRINTER ##############
2023-03-25 19:49:45 +01:00
if [ [ $USER != 'xbian' ] ] ; then
2024-02-15 18:46:06 +01:00
echo "INSTALL PRINTER FOR G1BILLET + AstroID & Zencard ..."
2023-10-26 00:55:47 +02:00
saisie = "OK"
2022-08-23 13:38:37 +02:00
if [ [ $saisie != "" ] ] ; then
2023-05-01 21:42:18 +02:00
## PRINT & FONTS
2022-10-28 20:18:00 +02:00
sudo apt install ttf-mscorefonts-installer printer-driver-all cups -y
2024-08-09 15:48:32 +02:00
pip --break-system-packages install brother_ql
# pipx install brother_ql
2022-08-23 13:38:37 +02:00
sudo cupsctl --remote-admin
2023-01-01 20:13:39 +01:00
sudo usermod -aG lpadmin $USER
sudo usermod -a -G tty $USER
sudo usermod -a -G lp $USER
2023-01-01 20:37:09 +01:00
## brother_ql_print
echo " $USER ALL=(ALL) NOPASSWD:/usr/local/bin/brother_ql_print " | ( sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/brother_ql_print' )
2023-03-25 19:49:45 +01:00
## G1BILLET
2024-02-15 18:46:06 +01:00
echo "INSTALL G1BILLET SERVICE : http://g1billet.localhost:33101"
2023-05-01 21:42:18 +02:00
cd ~/.zen
git clone https://git.p2p.legal/qo-op/G1BILLET.git
cd G1BILLET && ./setup_systemd.sh
cd -
fi
fi
2024-04-14 16:31:55 +02:00
################################################### NODE MONITORING LAYER
[ [ ! $isLAN ] ] && plus = "GRAFANA"
2024-04-17 01:42:47 +02:00
echo
echo " ## MONITORING LAYER #### $plus ## PROMETHEUS ### PROBE : node_exporter "
2024-04-14 16:31:55 +02:00
${ MY_PATH } /install.prometheus_node_exporter_linux.sh $plus
2024-04-17 01:42:47 +02:00
echo
2024-04-14 16:31:55 +02:00
2024-02-15 18:46:06 +01:00
#####################
#### ~/.bashrc
2024-04-24 00:54:41 +02:00
echo "########################### ♥BOX ~/.bashrc"
sudo ln -f -s /usr/bin/python3 /usr/bin/python
2024-02-03 12:53:12 +01:00
while IFS = read -r line
do
echo " $line " >> ~/.bashrc
done < ~/.zen/Astroport.ONE/ASCI_ASTROPORT.txt
2024-02-10 20:58:40 +01:00
## EXTEND PATH
2024-02-11 20:05:23 +01:00
echo ' export PATH = $HOME /.local/bin:$PATH
2024-02-10 17:47:31 +01:00
' >> ~/.bashrc && source ~/.bashrc
2024-02-03 12:53:12 +01:00
echo " <<< UPDATED>>> PATH= $PATH "
echo "## ADDING lazydocker ================"
### ADD TO DOCKER GROUP
sudo usermod -aG docker $USER
2024-04-23 17:25:17 +02:00
2024-02-03 12:53:12 +01:00
# INSTALL lazydocker GUI
2024-04-23 17:25:17 +02:00
${ MY_PATH } /install.lazydocker.sh
2024-04-24 00:54:41 +02:00
###############################################################
## USING lazydocker + nginxproxymanager
#~ echo "## CAN USE seedbox "
#~ cd ~/.zen
#~ git clone https://github.com/papiche/seedbox.git
###############################################################
2024-04-23 17:25:17 +02:00
2024-04-17 01:42:47 +02:00
echo
2022-10-29 22:13:27 +02:00
echo "#############################################"
2023-04-15 15:19:32 +02:00
echo "######### SYSTEM SETUP #########################"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2022-08-23 13:38:37 +02:00
2023-10-26 00:55:47 +02:00
echo "=== SETUP IPFS"
2022-09-09 20:57:59 +02:00
~/.zen/Astroport.ONE/tools/ipfs_setup.sh
2023-01-04 14:35:48 +01:00
echo "/ip4/127.0.0.1/tcp/5001" > ~/.ipfs/api
2023-10-26 00:55:47 +02:00
echo "=== SETUP ASTROPORT"
2023-02-25 02:49:24 +01:00
~/.zen/Astroport.ONE/setup.sh
2022-12-13 18:22:46 +01:00
2024-08-24 23:36:38 +02:00
if [ [ $( which X 2>/dev/null) ] ] ; then
if [ [ $( which kodi) && $XDG_SESSION_TYPE = = 'x11' || $XDG_SESSION_TYPE = = 'wayland' ] ] ; then
echo "#############################################"
echo " ### CONFIGURATION KODI FR PLUGIN ## "
echo "#############################################"
(
mkdir -p ~/.zen/tmp/kodi
echo "PATIENTEZ..."
ipfs get -o ~/.zen/tmp/kodi/ /ipfs/Qmc2jg96KvQrLs5R29jn3hjUb1ViMWzeygtPR59fTP6AVT
echo '## INSTALL FRANCETV + VSTREAM + FILMSFORACTION'
mv ~/.kodi ~/.kodi.back 2>/dev/null
mv ~/.zen/tmp/kodi ~/.kodi
echo "Now run kodi and update plugins"
) &
fi
fi
2024-02-15 18:46:06 +01:00
end = ` date +%s`
echo Installation time was ` expr $end - $start ` seconds.
2024-01-10 18:14:59 +01:00
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
2024-02-15 18:46:06 +01:00
echo "xXX LOG ERRORS XXx"
2023-10-26 00:55:47 +02:00
cat /tmp/install.errors.log
2024-02-02 18:42:52 +01:00
echo "xXX please report any errors encountered during install XXx"
2024-01-10 18:14:59 +01:00
echo "################XXXX#########################"
2024-02-15 18:46:06 +01:00
echo "RUN TEST : ~/.zen/Astroport.ONE/test.sh"
2024-02-02 18:42:52 +01:00
echo
2024-04-24 00:54:41 +02:00
echo "#########################################################"
2024-02-02 18:42:52 +01:00
echo "Astroport.ONE - Web3 Information System over IPFS - "
2023-03-07 03:21:17 +01:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
echo "### ASK FOR SUPPORT #########################"
2024-02-15 18:27:13 +01:00
echo "### support@qo-op.com"
2023-03-07 03:21:17 +01:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
echo "## TAKE CONTROL #################################"
echo "* WEB : http://astroport.localhost:1234/"
echo "* CLI : ~/.zen/Astroport.ONE/command.sh"
echo "#############################################"
2022-12-13 22:00:39 +01:00
2023-03-07 03:21:17 +01:00
##########################################################
2024-04-24 00:54:41 +02:00
## ON BOARDING PLAYER
2024-02-15 18:27:13 +01:00
echo "#############################################"
2024-04-24 00:54:41 +02:00
# ACTIVATING ASTROPORT DAEMONS
echo " >>> ASTROPORT ON/OFF <<<
~/.zen/Astroport.ONE/tools/cron_VRFY.sh ON"
2024-04-17 01:42:47 +02:00
~/.zen/Astroport.ONE/tools/cron_VRFY.sh ON
2024-04-24 01:00:31 +02:00
2024-04-17 02:13:08 +02:00
echo "############################## ♥BOX READY ###"
2024-04-24 01:00:31 +02:00
espeak "Welcome Web 3 Astronaut" 2>/dev/null
echo ">>> Welcome Web3 Astronaut <<<"
echo " CREATE PLAYER
"
2024-04-24 00:54:41 +02:00
2024-04-17 02:13:08 +02:00
~/.zen/Astroport.ONE/command.sh
2024-02-02 19:32:36 +01:00
2022-08-23 13:38:37 +02:00
else
2024-04-24 00:54:41 +02:00
echo " ABORTING INSTALL
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
PLAYER already onboard...
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
2022-08-24 15:33:41 +02:00
$( cat ~/.zen/game/players/.current/secret.june)
2024-04-24 00:54:41 +02:00
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "
2022-08-23 13:38:37 +02:00
# MAIN #
2024-04-24 00:54:41 +02:00
2022-08-23 13:38:37 +02:00
fi
}