forked from axiom-team/astroport
63 lines
2.3 KiB
Bash
Executable File
63 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
{
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
|
|
[[ $USER == "root" ]] && echo "DO NOT RUN AS root!! Use regular USER with sudo AUTHORISATION" && exit 1
|
|
|
|
MACHINE_TYPE=`uname -m`
|
|
[ ${MACHINE_TYPE:0:3} == 'arm' ] && isARM="YES"
|
|
|
|
##################################
|
|
## INSTALL TOOLS
|
|
######## YOUTUBE-DL ##########
|
|
if [[ ! $(which youtube-dl) ]]; then
|
|
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl || exit 1
|
|
sudo chmod a+rx /usr/local/bin/youtube-dl
|
|
sudo chown $USER /usr/local/bin/youtube-dl
|
|
fi
|
|
|
|
sudo apt install libid3-tools mpd mpc lame -y || err=1
|
|
sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet imagemagick curl -y #libav-tools || err=1
|
|
sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc espeak mpg321 fuse atomicparsley -y || err=1
|
|
|
|
## CONFIG MPD
|
|
sudo cp -f $MY_PATH/templates/copylaradio/mpd.conf /etc/mpd.conf
|
|
sudo sed -i "s/_USER/$USER/g" /etc/mpd.conf || err=1
|
|
mkdir -p ~/.zen/music
|
|
mkdir -p ~/.zen/playlists
|
|
|
|
sudo chown -R $USER /var/lib/mpd/ /var/run/mpd /run/mpd /var/log/mpd
|
|
sudo service mpd restart || err=1
|
|
|
|
### NGINX
|
|
sudo apt-get install fail2ban nginx ssl-cert openssl-blacklist php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y || err=1
|
|
|
|
# CONFIG NGINX - LOVE LAND
|
|
sudo cp -f $MY_PATH/../www/loveland.conf /etc/nginx/conf.d/
|
|
$PHPVERSION=$(ps auxf | grep php-fpm | grep -v -E 'color=auto|grep' | head -n 1 | grep -oP '(?<=\().*(?=\))' | awk -F '/' '{print $4}')
|
|
sudo sed -i "s/_PHPVERSION_/$PHPVERSION/g" /etc/nginx/conf.d/loveland.conf
|
|
nodename=$(cat /etc/hostname)
|
|
extension=$(echo $nodename | cut -d '.' -f 2)
|
|
if [[ $extension == $nodename ]]; then
|
|
nodename=$nodename.local
|
|
fi
|
|
sudo sed -i "s/_SERVERNAME_/$nodename/g" /etc/nginx/conf.d/loveland.conf
|
|
|
|
sudo systemctl restart nginx || err=1
|
|
|
|
# INSTALL LOVELand WebSite LINKs
|
|
sudo ln -s $MY_PATH/../www/LOVELand /var/www/loveland
|
|
sudo chmod 777 $MY_PATH/../www/LOVELand/jukebox/albumart
|
|
sudo chmod 777 $MY_PATH/../www/LOVELand/jukebox/prefs
|
|
|
|
if [[ $err ]]; then
|
|
echo -e "${c_red}Installation de LOVELand incomplète$c_"
|
|
exit 1
|
|
else
|
|
echo -e "${c_green}LOVELand a été installé avec succès$c_"
|
|
exit 0
|
|
fi
|
|
|
|
}
|