351 lines
11 KiB
Bash
Executable File
351 lines
11 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
## User config
|
|
|
|
# Username for all paramettrable services
|
|
# You will use this username to connect to sonarr/radarr/etc
|
|
GLOBAL_USER="A_user_name"
|
|
|
|
# If you want a different username for each services
|
|
SONARR_USER=$GLOBAL_USER
|
|
RADARR_USER=$GLOBAL_USER
|
|
PROWLARR_USER=$GLOBAL_USER
|
|
TRANSMISSION_USER=$GLOBAL_USER
|
|
|
|
#Passwords
|
|
SONARR_PASSWORD="a very secure password"
|
|
RADARR_PASSWORD="so secure any hacker would"
|
|
PROWLARR_PASSWORD="have to social engineer it"
|
|
TRANSMISSION_PASSWORD="in order to get it"
|
|
|
|
# ! MAKE SURE THE USER RUNNING THIS SCRIPT CAN READ
|
|
# **AND** WRITE TO THE FOLDERS YOU WRITE
|
|
|
|
# Main Folder
|
|
SERIES_PATH="path/to/series"
|
|
FILM_PATH="path/to/films"
|
|
|
|
# Config Folder
|
|
DOWNLOAD_FOLDER="path/to/downloads"
|
|
SONARR_CONFIG="path/to/config/sonarr"
|
|
RADARR_CONFIG="path/to/config/radarr"
|
|
PROWLARR_CONFIG="path/to/config/prowlarr"
|
|
TRANSMISSION_CONFIG="path/to/config/transmission"
|
|
JELLYSEERR_CONFIG="path/to/config/jellyseerr"
|
|
JELLYFIN_CONFIG="path/to/config/jellyfin"
|
|
|
|
|
|
######################
|
|
#
|
|
# End of parameters
|
|
#
|
|
######################
|
|
|
|
|
|
## Creations des dossiers
|
|
|
|
echo "Creating folder : $SERIES_PATH"
|
|
mkdir -p "$SERIES_PATH"
|
|
|
|
echo "Creating folder : $FILM_PATH"
|
|
mkdir -p "$FILM_PATH"
|
|
|
|
echo "Creating folder : $DOWNLOAD_FOLDER"
|
|
mkdir -p "$DOWNLOAD_FOLDER"
|
|
|
|
echo "Creating folder : $SONARR_CONFIG"
|
|
mkdir -p "$SONARR_CONFIG"
|
|
|
|
echo "Creating folder : $RADARR_CONFIG"
|
|
mkdir -p "$RADARR_CONFIG"
|
|
|
|
echo "Creating folder : $PROWLARR_CONFIG"
|
|
mkdir -p "$PROWLARR_CONFIG"
|
|
|
|
echo "Creating folder : $TRANSMISSION_CONFIG"
|
|
mkdir -p "$TRANSMISSION_CONFIG"
|
|
|
|
echo "Creating folder : $JELLYSEERR_CONFIG"
|
|
mkdir -p "$JELLYSEERR_CONFIG"
|
|
|
|
echo "Creating folder : $JELLYFIN_CONFIG"
|
|
mkdir -p "$JELLYFIN_CONFIG"
|
|
|
|
## patching docker-compose
|
|
|
|
echo patching docker-compose
|
|
|
|
cp base.yml compose.yml
|
|
|
|
USER_ID=$(id -u)
|
|
GROUP_ID=$(id -g)
|
|
|
|
sed -i "s#GLOBAL_USER#$GLOBAL_USER#g" compose.yml
|
|
|
|
sed -i "s#USER_ID#$USER_ID#g" compose.yml
|
|
sed -i "s#GROUP_ID#$GROUP_ID#g" compose.yml
|
|
|
|
sed -i "s#SERIES_PATH#$SERIES_PATH#g" compose.yml
|
|
sed -i "s#FILM_PATH#$FILM_PATH#g" compose.yml
|
|
|
|
sed -i "s#DOWNLOAD_FOLDER#$DOWNLOAD_FOLDER#g" compose.yml
|
|
sed -i "s#SONARR_CONFIG#$SONARR_CONFIG#g" compose.yml
|
|
sed -i "s#RADARR_CONFIG#$RADARR_CONFIG#g" compose.yml
|
|
sed -i "s#PROWLARR_CONFIG#$PROWLARR_CONFIG#g" compose.yml
|
|
sed -i "s#JELLYSEERR_CONFIG#$JELLYSEERR_CONFIG#g" compose.yml
|
|
sed -i "s#JELLYFIN_CONFIG#$JELLYFIN_CONFIG#g" compose.yml
|
|
sed -i "s#TRANSMISSION_CONFIG#$TRANSMISSION_CONFIG#g" compose.yml
|
|
sed -i "s#TRANSMISSION_PASSWORD#$TRANSMISSION_PASSWORD#g" compose.yml
|
|
sed -i "s#TRANSMISSION_USER#$TRANSMISSION_USER#g" compose.yml
|
|
|
|
## Installation de basiquement tout
|
|
echo docker-compose time .w.
|
|
docker-compose --file compose.yml up -d
|
|
|
|
echo sleep 30 sec to wait for everyone to wake up
|
|
sleep 30
|
|
|
|
# Config de transmission
|
|
cp ./transmission.json ./temp_transmission.json
|
|
|
|
sed -i "s#TRANSMISSION_USER#$TRANSMISSION_USER#g" temp_transmission.json
|
|
sed -i "s#TRANSMISSION_PASSWORD#$TRANSMISSION_PASSWORD#g" temp_transmission.json
|
|
|
|
TEMP_TRANSMISSION_CONFIG=$(cat temp_transmission.json)
|
|
|
|
## Config Sonarr
|
|
|
|
SONARR_API_KEY=$(docker exec -it sonarr cat /config/config.xml | grep ApiKey | cut -d'>' -f2 | cut -d '<' -f1)
|
|
|
|
TEMP_SONARR_CONFIG=$(curl "http://localhost:8989/api/v3/config/host/1?apikey=$SONARR_API_KEY")
|
|
TEMP_SONARR_CONFIG="$(echo "$TEMP_SONARR_CONFIG" | sed 's/"authenticationMethod.*"/"authenticationMethod": "forms"/g')"
|
|
TEMP_SONARR_CONFIG="$(echo "$TEMP_SONARR_CONFIG" | sed 's/"username.*"/"username": "'"$SONARR_USER"'"/g')"
|
|
TEMP_SONARR_CONFIG="$(echo "$TEMP_SONARR_CONFIG" | sed 's/"password":.*"/"password": "'"$SONARR_PASSWORD"'"/g')"
|
|
TEMP_SONARR_CONFIG="$(echo "$TEMP_SONARR_CONFIG" | sed 's/"passwordConfirmation.*"/"passwordConfirmation": "'"$SONARR_PASSWORD"'"/g')"
|
|
|
|
curl --request PUT \
|
|
--url "http://localhost:8989/api/v3/config/host/1?apikey=$SONARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$TEMP_SONARR_CONFIG"
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:8989/api/v3/rootfolder?apikey=$SONARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data '{
|
|
"id": 0,
|
|
"path": "/tv",
|
|
"accessible": true
|
|
}'
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:8989/api/v3/downloadclient?apikey=$SONARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$TEMP_TRANSMISSION_CONFIG"
|
|
|
|
## Config Radarr
|
|
TEMP_RADARR_CONFIG=$(docker exec -it radarr cat /config/config.xml)
|
|
RADARR_API_KEY=$(docker exec -it radarr cat /config/config.xml | grep ApiKey | cut -d'>' -f2 | cut -d '<' -f1)
|
|
|
|
TEMP_RADARR_CONFIG=$(curl "http://localhost:7878/api/v3/config/host/1?apikey=$RADARR_API_KEY")
|
|
TEMP_RADARR_CONFIG="$(echo "$TEMP_RADARR_CONFIG" | sed 's/"authenticationMethod.*"/"authenticationMethod": "forms"/g')"
|
|
TEMP_RADARR_CONFIG="$(echo "$TEMP_RADARR_CONFIG" | sed 's/"username.*"/"username": "'"$RADARR_USER"'"/g')"
|
|
TEMP_RADARR_CONFIG="$(echo "$TEMP_RADARR_CONFIG" | sed 's/"password":.*"/"password": "'"$RADARR_PASSWORD"'"/g')"
|
|
TEMP_RADARR_CONFIG="$(echo "$TEMP_RADARR_CONFIG" | sed 's/"passwordConfirmation.*"/"passwordConfirmation": "'"$RADARR_PASSWORD"'"/g')"
|
|
|
|
curl --request PUT \
|
|
--url "http://localhost:7878/api/v3/config/host/1?apikey=$RADARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$TEMP_RADARR_CONFIG"
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:7878/api/v3/rootfolder?apikey=$RADARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data '{
|
|
"id": 0,
|
|
"path": "/movies",
|
|
"accessible": true
|
|
}'
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:7878/api/v3/downloadclient?apikey=$RADARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$TEMP_TRANSMISSION_CONFIG"
|
|
|
|
## Config Prowlarr
|
|
TEMP_PROWLARR_CONFIG=$(docker exec -it prowlarr cat /config/config.xml)
|
|
PROWLARR_API_KEY=$(docker exec -it prowlarr cat /config/config.xml | grep ApiKey | cut -d'>' -f2 | cut -d '<' -f1)
|
|
|
|
TEMP_PROWLARR_CONFIG=$(curl "http://localhost:9696/api/v1/config/host/1?apikey=$PROWLARR_API_KEY")
|
|
TEMP_PROWLARR_CONFIG="$(echo "$TEMP_PROWLARR_CONFIG" | sed 's/"authenticationMethod.*"/"authenticationMethod": "forms"/g')"
|
|
TEMP_PROWLARR_CONFIG="$(echo "$TEMP_PROWLARR_CONFIG" | sed 's/"username.*"/"username": "'"$PROWLARR_USER"'"/g')"
|
|
TEMP_PROWLARR_CONFIG="$(echo "$TEMP_PROWLARR_CONFIG" | sed 's/"password":.*"/"password": "'"$PROWLARR_PASSWORD"'"/g')"
|
|
TEMP_PROWLARR_CONFIG="$(echo "$TEMP_PROWLARR_CONFIG" | sed 's/"passwordConfirmation.*"/"passwordConfirmation": "'"$PROWLARR_PASSWORD"'"/g')"
|
|
|
|
curl --request PUT \
|
|
--url "http://localhost:9696/api/v1/config/host/1?apikey=$PROWLARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$TEMP_PROWLARR_CONFIG"
|
|
|
|
cp prowlarr_radarr_app.json temp_prowlarr_radarr_app.json
|
|
cp prowlarr_sonarr_app.json temp_prowlarr_sonarr_app.json
|
|
|
|
sed -i "s/RADARR_API_KEY/$RADARR_API_KEY/g" temp_prowlarr_radarr_app.json
|
|
sed -i "s/SONARR_API_KEY/$SONARR_API_KEY/g" temp_prowlarr_sonarr_app.json
|
|
|
|
RADARR_APP_CONFIG=$(cat temp_prowlarr_radarr_app.json)
|
|
SONARR_APP_CONFIG=$(cat temp_prowlarr_sonarr_app.json)
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:9696/api/v1/applications?apikey=$PROWLARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$SONARR_APP_CONFIG"
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:9696/api/v1/applications?apikey=$PROWLARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$RADARR_APP_CONFIG"
|
|
|
|
## Ajouter flaresolverr
|
|
|
|
FLARESOLVERR_PROXY_CONFIG=$(cat prowlarr_flaresolverr.json)
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:9696/api/v1/tag?apikey=$PROWLARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data '{"id": 0,"label": "flaresolverr"}'
|
|
|
|
curl --request POST \
|
|
--url "http://localhost:9696/api/v1/indexerproxy?apikey=$PROWLARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$FLARESOLVERR_PROXY_CONFIG"
|
|
|
|
|
|
## Ajouter des indexers
|
|
INDEXER_LENGHT=$(cat prowlarr_indexers.json | jq length)
|
|
INDEXER_LENGHT=$(($INDEXER_LENGHT - 1))
|
|
echo $INDEXER_LENGHT
|
|
|
|
for index in $(eval echo "{0..$INDEXER_LENGHT}");do
|
|
echo "########################"
|
|
indexer=$(cat prowlarr_indexers.json | jq ".[$index]")
|
|
indexer=$(echo $indexer | jq 'del(.id)')
|
|
echo $indexer | jq '.name'
|
|
curl --request POST \
|
|
-s -S \
|
|
--url "http://localhost:9696/api/v1/indexer?apikey=$PROWLARR_API_KEY" \
|
|
--header 'Content-Type: application/json' \
|
|
--data "$indexer"
|
|
done
|
|
|
|
# post install
|
|
clear
|
|
echo Done !
|
|
|
|
echo '
|
|
# Jellyfin Config :
|
|
|
|
head over to http://localhost:8096/ then
|
|
- Create an account
|
|
- Create two libraries
|
|
- One for movies : select type "movies", folder /data/movies
|
|
- One for tv show : select type "tv shows", folder /data/tvshows
|
|
|
|
And there is your media center !
|
|
|
|
# Jellyseerr Config :
|
|
|
|
head over to http://localhost:5055/ then
|
|
- Login with your previously created jellyfin account
|
|
- jellyfin url "http://jellyfin:8096"
|
|
- you must put a email address but it does not need to be valid
|
|
- enter Jellyfin username and password
|
|
- Sync the libraries with jellyfin and select the previously libraries
|
|
- Add Radarr and Sonarr :'
|
|
|
|
echo "
|
|
|
|
## Radarr
|
|
|
|
Default server : True
|
|
name : Radarr
|
|
hostname : http://radarr
|
|
api key : $RADARR_API_KEY
|
|
root folder : /movies (click 'test' button below if not changeable )
|
|
|
|
## Sonarr
|
|
|
|
Default server : True
|
|
name : Sonarr
|
|
hostname : http://sonarr
|
|
api key : $SONARR_API_KEY
|
|
root folder : /tv (click 'test' button below if not changeable )
|
|
"
|
|
|
|
echo "this has also been written to POST_INSTALL.md"
|
|
rm temp*
|
|
rm compose.yml
|
|
|
|
###############################
|
|
|
|
echo '
|
|
# Jellyfin Config :
|
|
|
|
head over to http://localhost:8096/ then
|
|
- Create an account
|
|
- Create two libraries
|
|
- One for movies : select type "movies", folder /data/movies
|
|
- One for tv show : select type "tv shows", folder /data/tvshows
|
|
|
|
And there is your media center !
|
|
|
|
# Jellyseerr Config :
|
|
|
|
head over to http://localhost:5055/ then
|
|
- Login with your previously created jellyfin account
|
|
- jellyfin url "http://jellyfin:8096"
|
|
- you must put a email address but it does not need to be valid
|
|
- enter Jellyfin username and password
|
|
- Sync the libraries with jellyfin and select the previously libraries
|
|
- Add Radarr and Sonarr :' >> POST_INSTALL.md
|
|
|
|
echo "
|
|
|
|
## Radarr
|
|
|
|
Default server : True
|
|
name : Radarr
|
|
hostname : http://radarr
|
|
api key : $RADARR_API_KEY
|
|
root folder : /movies (click 'test' button below if not changeable )
|
|
|
|
## Sonarr
|
|
|
|
Default server : True
|
|
name : Sonarr
|
|
hostname : http://sonarr
|
|
api key : $SONARR_API_KEY
|
|
root folder : /tv (click 'test' button below if not changeable )
|
|
" >> POST_INSTALL.md
|
|
|
|
echo "
|
|
# Services
|
|
|
|
Streaming des videos
|
|
-> Jellyfin : http://localhost:8096
|
|
|
|
Rerchercher et Ajouter
|
|
-> Jellyseerr : http://localhost:5055
|
|
|
|
Gerer les films
|
|
-> Radarr http://localhost:7878
|
|
|
|
Gerer les series
|
|
-> Sonarr : http://localhost:8989
|
|
|
|
Rerchercher sur les sites de torrents
|
|
-> Prowlarr : http://localhost:9696
|
|
|
|
Telecharger
|
|
-> Transmission : http://localhost:9091
|
|
" >> POST_INSTALL.md
|