Astroport.ONE/install.sh

255 lines
10 KiB
Bash
Raw Permalink Normal View History

2022-08-23 13:38:37 +02:00
#!/bin/bash
########################################################################
# Version: 0.3
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
{
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
########################################################################
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. " && exit 1
[[ ! $(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
2022-08-23 13:38:37 +02:00
########################################################################
[[ ! $(which ipfs) ]] \
2023-06-07 12:11:10 +02:00
&& echo "bash <(wget -qO- https://git.p2p.legal/qo-op/Astroport.ONE/raw/branch/master/kubo_v0.20.0_linux.install.sh)" \
2023-01-08 20:02:49 +01:00
&& architecture=$(uname -m) && [[ $architecture == "x86_64" || $architecture == "aarch64" || "$architecture" == "armv7l" ]] \
2023-06-07 12:11:10 +02:00
&& bash <(wget -qO- https://raw.githubusercontent.com/papiche/Astroport.ONE/master/kubo_v0.20.0_linux.install.sh) \
2024-02-12 21:54:00 +01:00
|| echo "=== IPFS FOUND === OK"
2022-12-14 20:52:57 +01:00
[[ ! $(which ipfs) ]] && echo "INSTALL IPFS PLEASE" && exit 1
#################################################################### TEST
2022-10-27 15:48:35 +02:00
2022-08-23 13:38:37 +02:00
# MAIN # SI AUCUNE CLEF DE STATION...
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 "#############################################"
echo "###### ASTROPORT.ONE STATION ##############"
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 "#############################################"
2023-04-15 15:28:47 +02:00
echo "######### INSTALL BASE & PYTHON3 PACKAGE ####"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2024-02-10 17:43:19 +01:00
for i in git make cmake docker-compose fail2ban npm shellcheck netcat-traditional ncdu chromium miller inotify-tools curl net-tools libsodium* libcurl4-openssl-dev python3-pip python3-setuptools python3-wheel python3-dotenv python3-gpg python3-jwcrypto python3-brotli python3-aiohttp mpack; 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
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
2022-10-29 22:13:27 +02:00
echo "#############################################"
2023-04-15 15:28:47 +02:00
echo "######### INSTALL MULTIMEDIA TOOLS ######"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2022-10-28 20:18:00 +02:00
# removed : sqlite
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
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 "#############################################"
echo "######### FUN INSTALL ASCII ART TOOLS ######"
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
2024-02-08 15:58:36 +01:00
if [[ $(which X 2>/dev/null) ]]; then
echo "#############################################"
2023-04-15 15:28:47 +02:00
echo "######### INSTALL DESKTOP TOOLS ######"
2023-04-19 14:56:19 +02:00
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-12-13 15:52:12 +01:00
#### GIT CLONE ###############################################################
echo "#############################################"
2023-04-15 15:28:47 +02:00
echo "=== CODE CLONING TO '~/.zen/Astroport.ONE'"
echo "#############################################"
2022-12-13 15:52:12 +01:00
mkdir -p ~/.zen
cd ~/.zen
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 "#############################################"
2023-04-15 15:28:47 +02:00
echo "######### INSTALL NODEJS & TIDDLYWIKI ############"
2022-10-29 22:13:27 +02:00
echo "#############################################"
2022-09-12 19:48:20 +02:00
##########################################################
sudo npm install -g tiddlywiki
2024-02-08 15:58:36 +01:00
[[ $? != 0 ]] && echo "INSTALL tiddlywikiFAILED." && 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
echo "#####################################"
echo "## CRYPTO LIB & PYTHON TOOLS"
export PATH=$HOME/.local/bin:$PATH
2024-02-11 14:39:12 +01:00
for i in pip setuptools wheel cryptography Ed25519 base58 google duniterpy silkaj pynacl pgpy pynentry SecureBytes amzqr pdf2docx pyppeteer; do
2022-10-27 15:48:35 +02:00
echo ">>> Installation $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
2024-01-10 21:13:47 +01:00
python -m pip install --break-system-packages -U $i
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
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 "#############################################"
########### QRCODE : ZENCARD / G1BILLET : PRINTER ##############
2023-03-25 19:49:45 +01:00
if [[ $USER != 'xbian' ]]; then
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-01-10 22:43:33 +01:00
python -m pip --break-system-packages 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
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
#####################
#### ~/.bashrc
2024-02-03 12:53:12 +01:00
echo "########################### ♥BOX"
sudo ln -f -s /usr/bin/python3 /usr/bin/python
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
' >> ~/.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
# INSTALL lazydocker GUI
curl https://raw.githubusercontent.com/\
jesseduffield/lazydocker/master/scripts/\
2024-02-03 12:53:12 +01:00
install_update_linux.sh | bash
2022-10-29 22:13:27 +02:00
echo "#############################################"
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-01-31 11:22:17 +01:00
#~ if [[ $(which kodi) && $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]]; then
#~ echo "#############################################"
#~ echo " ### BONUS APP ## IPFS # 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
#~ ) &
#~ fi
end=`date +%s`
echo Installation time was `expr $end - $start` seconds.
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
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"
echo "################XXXX#########################"
echo "RUN TEST : ~/.zen/Astroport.ONE/test.sh"
2024-02-02 18:42:52 +01:00
echo
echo "#############################################"
echo "Astroport.ONE - Web3 Information System over IPFS - "
2023-03-07 03:21:17 +01:00
echo "#############################################"
2024-02-15 18:27:13 +01:00
echo "##GROUND CONTROL #################################"
echo "* WEB : http://127.0.0.1:1234/"
echo "* CLI : ~/.zen/Astroport.ONE/command.sh"
echo "#############################################"
echo "### SUPPORT #############################"
echo "### support@qo-op.com"
2023-03-07 03:21:17 +01:00
echo "#############################################"
2023-03-07 03:21:17 +01:00
##########################################################
## ON BOARDING PLAYER
# ~/.zen/Astroport.ONE/start.sh
2024-02-02 18:42:52 +01:00
espeak "Welcome Space Kitty" 2>/dev/null
2024-02-15 18:27:13 +01:00
echo ">>> Welcome Space Kitty <<<"
echo "Explore Web2.0 / WEb3 frontier"
echo "Join Dragons WOT by continuing keygen procedure..."
echo "#############################################"
# DESACTIVATING ASTROPORT DAEMONS
~/.zen/Astroport.ONE/tools/cron_VRFY.sh OFF
echo "############################## ♥BOX READY ###"
echo ">>> ACTIVATE ASTROPORT DAEMONS <<<
~/.zen/Astroport.ONE/tools/cron_VRFY.sh ON"
2023-10-26 00:55:47 +02:00
2024-02-02 19:32:36 +01:00
2022-08-23 13:38:37 +02:00
else
echo "Installation existante !!
========================
2022-10-27 15:48:35 +02:00
Astroport/TW
2022-08-23 13:38:37 +02:00
========================
Connectez-vous sur https://gchange.fr avec vos identifiants
$(cat ~/.zen/game/players/.current/secret.june)
2022-08-23 13:38:37 +02:00
Powered by https://astroport.com
2022-08-23 13:38:37 +02:00
"
# MAIN #
fi
}