astrXbian/install.sh

108 lines
3.6 KiB
Bash
Raw Normal View History

2020-12-12 01:26:39 +01:00
#!/bin/bash
2021-05-09 19:27:07 +02:00
set -x
. ./include.sh
2021-01-31 22:51:25 +01:00
########################################################################
2021-05-09 19:27:07 +02:00
# Version: 0.4
2021-01-31 22:51:25 +01:00
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
2020-12-12 01:26:39 +01:00
{
2021-05-09 19:27:07 +02:00
i_am_root && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
2021-02-19 15:51:10 +01:00
# MAIN #
2021-05-09 19:27:07 +02:00
if i_should_install;
2021-02-19 15:51:10 +01:00
then
2021-01-31 22:51:25 +01:00
2020-12-12 01:26:39 +01:00
# Check requirements
echo "AstrXbian installateur pour XBIAN (https://xbian.org) et ditributions DEBIAN et dérivées (https://www.linuxmint.com/)"
2021-05-12 17:25:49 +02:00
check_requirements
2021-01-31 22:51:25 +01:00
########################################################################
echo "Clonage git astrXbian depuis https://git.p2p.legal"
2021-05-12 17:41:30 +02:00
import_astrXbian
2021-01-31 22:51:25 +01:00
2020-12-14 00:13:39 +01:00
########################################################################
echo "IMPORT configuration ASTROPORT dans ~/.kodi"
2021-05-12 17:41:30 +02:00
import_kodi
2021-01-31 22:51:25 +01:00
2020-12-14 00:13:39 +01:00
########################################################################
2021-01-31 22:51:25 +01:00
echo "Installation de IPFS https://ipfs.io"
2021-05-12 17:51:18 +02:00
check_ipfs
2021-01-31 22:51:25 +01:00
2020-12-14 00:13:39 +01:00
########################################################################
echo "Configuration jaklis: Centre de communication GCHANGE+"
2021-05-12 17:51:18 +02:00
check_jaklis
2021-01-31 22:51:25 +01:00
########################################################################
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
2021-01-31 22:51:25 +01:00
[[ "$USER" == "xbian" ]] && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf
# NODE activates fail2ban IN zen/ipfs_SWARM_refresh.sh
2021-01-31 22:51:25 +01:00
### MODIFIYING /etc/sudoers ###
[[ "$USER" == "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/
2020-12-13 20:23:50 +01:00
2021-01-31 16:47:27 +01:00
if [[ "$USER" == "xbian" ]]
then
echo "enabling ipfs initV service autostart"
cd /etc/rc2.d && sudo ln -s ../init.d/ipfs S02ipfs
cd /etc/rc3.d && sudo ln -s ../init.d/ipfs S02ipfs
cd /etc/rc4.d && sudo ln -s ../init.d/ipfs S02ipfs
cd /etc/rc5.d && sudo ln -s ../init.d/ipfs S02ipfs
cd /etc/rc0.d && sudo ln -s ../init.d/ipfs K01ipfs
cd /etc/rc1.d && sudo ln -s ../init.d/ipfs K01ipfs
cd /etc/rc6.d && sudo ln -s ../init.d/ipfs K01ipfs
# Disable xbian-config auto launch
echo 0 > ~/.xbian-config-start
2021-03-10 06:47:32 +01:00
2021-01-31 16:47:27 +01:00
fi
2021-01-31 22:51:25 +01:00
########################################################################
# CREATE ~/astroport FILESYSTEM GATE
mkdir -p ~/astroport/film
mkdir -p ~/astroport/serie
mkdir -p ~/astroport/anime
if [[ "$USER" != "xbian" ]]
then
## Desktop install
echo "INITIALISATIOn Astroport/KODI"
echo "Appuyez sur la touche ENTREE pour créer votre nouvelle identité"
echo "sinon interrompez ici l'installation pour copier la restauration d'une sauvegarde"
read
~/.zen/astrXbian/ISOconfig.sh
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
echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI"
echo "Faites une ISO : sudo xbian-config"
exit 0
2021-02-19 15:51:10 +01:00
fi
# MAIN # -f ~/.zen/secret.june (ISOConfig déjà lancé) ##
else
echo "Installation déjà faite !!
========================
Astroport/KODI (Gchange)
========================
Connectez-vous sur https://gchange.fr avec vos identifiants
2020-12-13 20:42:15 +01:00
$(cat ~/.zen/secret.june)
2020-12-13 20:42:15 +01:00
https://astroport.com
2021-01-31 22:51:25 +01:00
"
# MAIN #
fi
2021-01-31 22:51:25 +01:00
}