2023-02-25 02:49:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
################################################################################
|
|
|
|
# Author: Fred (support@qo-op.com)
|
|
|
|
# Version: 0.1
|
|
|
|
# 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##*/}"
|
|
|
|
|
|
|
|
echo "#############################################"
|
|
|
|
echo ">>>>>>>>>>> SYSTEM SETUP "
|
|
|
|
echo "#############################################"
|
|
|
|
#### SETUP JAKLIS ###############################################################
|
|
|
|
echo "=== SETUP jaklis"
|
|
|
|
cd ~/.zen/Astroport.ONE/tools/jaklis
|
|
|
|
sudo ./setup.sh
|
|
|
|
|
|
|
|
## 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
|
|
|
|
|
|
|
|
# PERSONNAL DEFCON LEVEL
|
|
|
|
# cp ~/.zen/Astroport.ONE/DEFCON ~/.zen/
|
2023-03-03 13:44:03 +01:00
|
|
|
mkdir -p ~/.zen/tmp
|
2023-02-25 02:49:24 +01:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# CREATE ~/astroport FILESYSTEM GATE
|
2023-04-26 23:05:35 +02:00
|
|
|
#~ echo '${TYPE};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME' > ~/Astroport/${PLAYER}/ajouter_video.modele.txt
|
2023-02-25 02:49:24 +01:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
|
|
|
|
echo "#############################################"
|
|
|
|
## https://darktrojan.github.io/openwith/webextension.html"
|
|
|
|
~/.zen/Astroport.ONE/open_with_linux.py install
|
|
|
|
|
|
|
|
echo "#############################################
|
|
|
|
# NOURRISSEZ VOTRE BLOB depuis Firefox !!
|
|
|
|
# https://addons.mozilla.org/firefox/addon/open-with
|
|
|
|
#############################################
|
|
|
|
## $HOME/.zen/Astroport.ONE/ajouter_media.sh ##
|
|
|
|
#############################################"
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# SUDO permissions
|
|
|
|
########################################################################
|
|
|
|
## USED FOR RAMDISK (video live streaming)
|
|
|
|
## USED FOR SYSTEM UPGRADE
|
|
|
|
## USED FOR "systemctl restart ipfs"
|
|
|
|
## USED FOR "sudo youtube-dl -U"
|
2023-03-03 13:44:03 +01:00
|
|
|
for bin in fail2ban-client mount umount apt-get apt systemctl youtube-dl; do
|
|
|
|
binpath=$(which $bin)
|
2023-03-03 14:40:03 +01:00
|
|
|
[[ -x $binpath ]] \
|
|
|
|
&& echo "$USER ALL=(ALL) NOPASSWD:$binpath" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/'$bin) \
|
2023-03-03 13:44:03 +01:00
|
|
|
&& echo "SUDOERS RIGHT SET FOR : $binpath" \
|
|
|
|
|| echo "ERROR MISSING $bin"
|
|
|
|
done
|
2023-03-03 13:48:26 +01:00
|
|
|
### MODIFIYING /etc/sudoers ###
|
|
|
|
[[ "$USER" == "xbian" ]] && echo "xbian ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/astroport')
|
2023-02-25 02:49:24 +01:00
|
|
|
|
|
|
|
echo "#############################################"
|
2023-04-23 18:19:01 +02:00
|
|
|
echo "# ADDING <<<Astroport & REC >>> DESKTOP SHORTCUT"
|
2023-02-25 02:49:24 +01:00
|
|
|
[[ -d ~/Bureau ]] && sed "s/_USER_/$USER/g" ~/.zen/Astroport.ONE/astroport.desktop > ~/Bureau/astroport.desktop && chmod +x ~/Bureau/astroport.desktop
|
|
|
|
[[ -d ~/Desktop ]] && sed "s/_USER_/$USER/g" ~/.zen/Astroport.ONE/astroport.desktop > ~/Desktop/astroport.desktop && chmod +x ~/Desktop/astroport.desktop
|
2023-04-23 18:19:01 +02:00
|
|
|
[[ -d ~/Bureau ]] && sed "s/_USER_/$USER/g" ~/.zen/Astroport.ONE/rec.desktop > ~/Bureau/rec.desktop && chmod +x ~/Bureau/rec.desktop
|
|
|
|
[[ -d ~/Desktop ]] && sed "s/_USER_/$USER/g" ~/.zen/Astroport.ONE/rec.desktop > ~/Desktop/rec.desktop && chmod +x ~/Desktop/rec.desktop
|
2023-05-01 21:29:04 +02:00
|
|
|
[[ -d ~/Bureau ]] && sed "s/_USER_/$USER/g" ~/.zen/Astroport.ONE/g1billet.desktop > ~/Bureau/g1billet.desktop && chmod +x ~/Bureau/g1billet.desktop
|
|
|
|
[[ -d ~/Desktop ]] && sed "s/_USER_/$USER/g" ~/.zen/Astroport.ONE/g1billet.desktop > ~/Desktop/g1billet.desktop && chmod +x ~/Desktop/g1billet.desktop
|
2023-02-25 02:49:24 +01:00
|
|
|
|
2023-05-01 21:29:04 +02:00
|
|
|
######### SUPER PRATIQUE :: DOES NOT WORK WITH SPACE IN FILENAME
|
2023-04-23 18:19:01 +02:00
|
|
|
echo "# ADD NEMO 'Add To IPFS' ACTION"
|
|
|
|
~/.zen/Astroport.ONE/tools/install.nemo.add2ipfs.sh
|
2023-02-27 15:49:04 +01:00
|
|
|
|
2023-03-03 13:44:03 +01:00
|
|
|
echo "CREATE SYSTEMD astroport SERVICE >>>>>>>>>>>>>>>>>>"
|
|
|
|
cat > /tmp/astroport.service <<EOF
|
|
|
|
[Unit]
|
|
|
|
Description=ASTROPORT API
|
|
|
|
After=network.target
|
|
|
|
Requires=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=simple
|
|
|
|
User=_USER_
|
|
|
|
RestartSec=1
|
|
|
|
Restart=always
|
|
|
|
ExecStart=/home/_USER_/.zen/Astroport.ONE/12345.sh
|
2023-03-10 00:57:16 +01:00
|
|
|
StandardOutput=file:/home/_USER_/.zen/tmp/12345.log
|
2023-03-03 13:44:03 +01:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF
|
|
|
|
|
|
|
|
sudo cp -f /tmp/astroport.service /etc/systemd/system/
|
|
|
|
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/astroport.service
|
|
|
|
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
sudo systemctl enable astroport
|
2023-03-10 00:57:16 +01:00
|
|
|
sudo systemctl restart astroport
|
2023-02-27 15:49:04 +01:00
|
|
|
|
2023-03-03 13:44:03 +01:00
|
|
|
ACTUAL=$(cat /etc/resolv.conf | grep -w nameserver | head -n 1)
|
|
|
|
|
2023-03-25 15:03:14 +01:00
|
|
|
if [[ $(echo $ACTUAL | grep "1.1.1.1") == "" ]] ; then
|
2023-03-03 13:44:03 +01:00
|
|
|
########################################################################
|
2023-10-26 00:55:47 +02:00
|
|
|
echo "ADDING nameserver 1.1.1.1 TO /etc/resolv.conf TO BYPASS COUNTRY RESTRICTIONS" # Avoid provider restrictions
|
2023-03-03 13:44:03 +01:00
|
|
|
########################################################################
|
2023-02-27 15:49:04 +01:00
|
|
|
sudo chattr -i /etc/resolv.conf
|
2023-03-03 13:44:03 +01:00
|
|
|
|
2023-02-27 15:49:04 +01:00
|
|
|
sudo cat > /tmp/resolv.conf <<EOF
|
|
|
|
domain home
|
|
|
|
search home
|
|
|
|
nameserver 1.1.1.1
|
|
|
|
$ACTUAL
|
|
|
|
# ASTROPORT.ONE
|
|
|
|
EOF
|
|
|
|
|
|
|
|
sudo cp /etc/resolv.conf /etc/resolv.conf.backup
|
2023-04-23 18:21:09 +02:00
|
|
|
|
2023-02-27 15:49:04 +01:00
|
|
|
sudo mv /tmp/resolv.conf /etc/resolv.conf
|
|
|
|
sudo chattr +i /etc/resolv.conf
|
2023-03-03 13:44:03 +01:00
|
|
|
fi
|
2023-02-27 15:49:04 +01:00
|
|
|
|
2023-03-03 14:40:03 +01:00
|
|
|
if [[ ! $(cat /etc/hosts | grep -w "astroport.local" | head -n 1) ]]; then
|
|
|
|
cat /etc/hosts > /tmp/hosts
|
2023-12-06 01:11:34 +01:00
|
|
|
echo "127.0.1.1 $(hostname) $(hostname).local astroport.$(hostname).local ipfs.$(hostname).local astroport.local" >> /tmp/hosts
|
2023-03-03 14:40:03 +01:00
|
|
|
sudo cp /tmp/hosts /etc/hosts && rm /tmp/hosts
|
|
|
|
fi
|
2023-10-26 00:55:47 +02:00
|
|
|
|
2023-03-03 13:44:03 +01:00
|
|
|
### ADD 20h12.sh CRON ###############
|
|
|
|
~/.zen/Astroport.ONE/tools/cron_VRFY.sh ON
|
2023-02-25 02:49:24 +01:00
|
|
|
|
|
|
|
echo "#############################################"
|
|
|
|
## INSTALL yt-dlp & SYMLINK youtube-dl
|
|
|
|
~/.zen/Astroport.ONE/youtube-dl.sh
|
|
|
|
|