2022-06-26 20:47:28 +02:00
#!/bin/bash
[ " ${ DEBUG } " ] && set -x
2021-05-09 19:27:07 +02:00
2021-05-12 17:25:49 +02:00
check_requirements( ) {
2022-06-26 20:47:28 +02:00
[ [ ! $( 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..."
2021-05-12 17:36:31 +02:00
sudo apt-get update
2022-06-26 20:47:28 +02:00
[ [ " $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' "
2021-05-12 17:36:31 +02:00
sudo apt-get install python3-opencv -y
2022-06-26 20:47:28 +02:00
## 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 "
2021-05-12 17:36:31 +02:00
python3 -m pip install -U pip
python3 -m pip install -U setuptools wheel
2022-06-26 20:47:28 +02:00
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
2021-05-12 17:36:31 +02:00
# python3 -m pip install -U silkaj
2022-06-26 20:47:28 +02:00
## python -> python3 link
sudo ln -f -s /usr/bin/python3 /usr/bin/python
2021-05-12 17:36:31 +02:00
}
2021-05-09 19:27:07 +02:00
i_am( ) {
2022-06-26 20:47:28 +02:00
echo 'v0.5.0'
2021-05-09 19:27:07 +02:00
}
i_am_root( ) {
[ $( id -u) -eq 0 ]
}
2021-05-12 18:47:13 +02:00
i_am_xbian( ) {
[ [ " $USER " = = "xbian" ] ]
}
2021-05-09 19:27:07 +02:00
i_should_install( ) {
2022-06-26 20:47:28 +02:00
[ [ ! -f ~/.zen/secret.dunikey ] ]
2021-05-09 19:27:07 +02:00
}
2021-05-12 17:41:30 +02:00
import_astrXbian( ) {
2022-06-26 20:47:28 +02:00
echo "=== Clonage git CODE 'astrXbian' + 'Astroport.ONE' depuis https://git.p2p.legal"
2021-05-12 17:41:30 +02:00
mkdir -p ~/.zen
cd ~/.zen
2022-06-26 20:47:28 +02:00
# TODO INSTALL FROM IPFS / IPNS
2021-05-12 17:41:30 +02:00
git clone https://git.p2p.legal/axiom-team/astrXbian.git
2022-06-26 20:47:28 +02:00
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
2021-05-12 17:41:30 +02:00
}
2021-05-15 18:31:46 +02:00
import_ipfs( ) {
2022-06-26 20:47:28 +02:00
## Scripts pour systemd ou InitV (xbian)
echo "=== Activation SYSTEM IPFS"
2021-05-15 18:31:46 +02:00
~/.zen/astrXbian/.install/ipfs_alone.sh
}
import_jaklis( ) {
2022-06-26 20:47:28 +02:00
echo "=== Configuration jaklis: Centre de communication CESIUM+ GCHANGE+"
2021-05-15 18:31:46 +02:00
cd ~/.zen/astrXbian/zen/jaklis
./setup.sh
}
2021-05-12 17:41:30 +02:00
import_kodi( ) {
2022-06-26 20:47:28 +02:00
echo "=== IMPORT configuration ASTROPORT dans ~/.kodi"
2021-05-12 17:41:30 +02:00
cp -Rf ~/.zen/astrXbian/.install/.kodi ~/
}
2021-05-12 19:00:14 +02:00
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
}