You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
244 lines
6.4 KiB
Bash
244 lines
6.4 KiB
Bash
#!/bin/sh
|
|
|
|
ACTION=${1}
|
|
shift 1
|
|
|
|
get_image() {
|
|
IMAGE_NAME="megamedia"
|
|
}
|
|
|
|
do_install_detail() {
|
|
local config=`uci get megamedia.@megamedia[0].config_path 2>/dev/null`
|
|
local port=`uci get megamedia.@megamedia[0].port 2>/dev/null`
|
|
local IMAGE_NAME=`uci get megamedia.@megamedia[0].image_name 2>/dev/null`
|
|
local username=`uci get megamedia.@megamedia[0].username 2>/dev/null`
|
|
local password=`uci get megamedia.@megamedia[0].password 2>/dev/null`
|
|
|
|
#Generate the generic environment variables for the docker-compose
|
|
|
|
GEN_PASS=$(< /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c14; echo)
|
|
GEN_PASS2=$(< /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c14; echo)
|
|
|
|
# Get our local LAN IP Address
|
|
LAN_IP=$(uci get network.lan.ipaddr)
|
|
# Strip trailing network mask
|
|
LAN_IP="${LAN_IP%/*}"
|
|
|
|
if [ -z "$config" ]; then
|
|
echo "config path is empty!"
|
|
exit 1
|
|
fi
|
|
|
|
[ -z "$port" ] && port=9696
|
|
[ -z "$IMAGE_NAME" ] && IMAGE_NAME=megamedia
|
|
|
|
|
|
# Create Docker Compose file with custom variables
|
|
|
|
# Create Docker Compose file with custom variables
|
|
mkdir /opt/docker2/compose/megamedia
|
|
touch /opt/docker2/compose/megamedia/docker-compose.yml
|
|
cat > /opt/docker2/compose/megamedia/docker-compose.yml <<EOF
|
|
version: '3.8'
|
|
services:
|
|
jellyfin:
|
|
image: lscr.io/linuxserver/jellyfin:latest
|
|
container_name: jellyfin
|
|
environment:
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- TZ=Europe/London
|
|
- JELLYFIN_PublishedServerUrl={$LAN_IP}
|
|
volumes:
|
|
- ./library:/config
|
|
- $config/jellyfin/tvshows:/data/tvshows
|
|
- $config/jellyfin/movies:/data/movies
|
|
- $config/jellyfin/music:/data/music
|
|
- $config/jellyfin/mixedmedia:/data/mixedmedia
|
|
ports:
|
|
- "8096:8096"
|
|
- "8920:8920" #optional
|
|
- "7359:7359/udp" #optional
|
|
#- "1900:1900/udp" #optional
|
|
restart: unless-stopped
|
|
|
|
qbittorrent:
|
|
image: lscr.io/linuxserver/qbittorrent
|
|
container_name: qbittorrent
|
|
environment:
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- TZ=Europe/Riga
|
|
- WEBUI_PORT=8989
|
|
volumes:
|
|
- ./config:/config
|
|
- $config/jellyfin/mixedmedia:/downloads
|
|
ports:
|
|
- "6882:6881"
|
|
- "6882:6881/udp"
|
|
- "8989:8989"
|
|
restart: unless-stopped
|
|
|
|
jackett:
|
|
image: ghcr.io/linuxserver/jackett
|
|
container_name: jackett
|
|
environment:
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- TZ=America/New_York
|
|
- AUTO_UPDATE=true
|
|
- RUN_OPTS=<run options here>
|
|
volumes:
|
|
- $config/jackett/config:/config
|
|
- $config/jellyfin/mixedmedia:/downloads
|
|
ports:
|
|
- "9117:9117"
|
|
restart: unless-stopped
|
|
|
|
radarr:
|
|
image: ghcr.io/linuxserver/radarr
|
|
container_name: radarr
|
|
environment:
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- TZ=America/New_York
|
|
volumes:
|
|
- $config/radarr:/config
|
|
- $config/jellyfin/movies:/movies
|
|
- $config/jellyfin/mixedmedia:/downloads
|
|
ports:
|
|
- "7878:7878"
|
|
restart: unless-stopped
|
|
|
|
sonarr:
|
|
image: lscr.io/linuxserver/sonarr:latest
|
|
container_name: sonarr
|
|
environment:
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- TZ=Etc/UTC
|
|
volumes:
|
|
- $config/sonarr/config/:/config
|
|
- $config/jellyfin/tvshows:/tv #optional
|
|
- $config/jellyfin/mixedmedia:/downloads #optional
|
|
ports:
|
|
- 8999:8989
|
|
restart: unless-stopped
|
|
|
|
lidarr:
|
|
image: lscr.io/linuxserver/lidarr:latest
|
|
container_name: lidarr
|
|
environment:
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- TZ=Etc/UTC
|
|
volumes:
|
|
- $config/lidarr/config/:/config
|
|
- $config/jellyfin/music:/music #optional
|
|
- $config/jellyfin/mixedmedia:/downloads #optional
|
|
ports:
|
|
- 8686:8686
|
|
restart: unless-stopped
|
|
|
|
prowlarr:
|
|
image: lscr.io/linuxserver/prowlarr:develop
|
|
container_name: prowlarr
|
|
environment:
|
|
- PUID=1000
|
|
- PGID=1000
|
|
- TZ=America/New_York
|
|
volumes:
|
|
- $config/prowlarr/config:/config
|
|
ports:
|
|
- "9696:9696"
|
|
restart: unless-stopped
|
|
|
|
EOF
|
|
|
|
docker-compose -f /opt/docker2/compose/megamedia/docker-compose.yml up -d
|
|
|
|
# Add a new list option to the "shortcutmenu" configuration file
|
|
uci add shortcutmenu lists
|
|
uci set shortcutmenu.@lists[-1].webname="jellyfin"
|
|
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:8096"
|
|
uci set shortcutmenu.@lists[-1].webpath="/"
|
|
uci commit shortcutmenu
|
|
|
|
uci add shortcutmenu lists
|
|
uci set shortcutmenu.@lists[-1].webname="qbittorrent"
|
|
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:8989"
|
|
uci set shortcutmenu.@lists[-1].webpath="/"
|
|
uci commit shortcutmenu
|
|
|
|
ci add shortcutmenu lists
|
|
uci set shortcutmenu.@lists[-1].webname="jackett"
|
|
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:9117"
|
|
uci set shortcutmenu.@lists[-1].webpath="/"
|
|
uci commit shortcutmenu
|
|
|
|
uci add shortcutmenu lists
|
|
uci set shortcutmenu.@lists[-1].webname="radarr"
|
|
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:7878"
|
|
uci set shortcutmenu.@lists[-1].webpath="/"
|
|
uci commit shortcutmenu
|
|
|
|
uci add shortcutmenu lists
|
|
uci set shortcutmenu.@lists[-1].webname="sonarr"
|
|
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:8999"
|
|
uci set shortcutmenu.@lists[-1].webpath="/"
|
|
uci commit shortcutmenu
|
|
|
|
uci add shortcutmenu lists
|
|
uci set shortcutmenu.@lists[-1].webname="lidarr"
|
|
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:8686"
|
|
uci set shortcutmenu.@lists[-1].webpath="/"
|
|
uci commit shortcutmenu
|
|
|
|
uci add shortcutmenu lists
|
|
uci set shortcutmenu.@lists[-1].webname="prowlarr"
|
|
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:9696"
|
|
uci set shortcutmenu.@lists[-1].webpath="/"
|
|
uci commit shortcutmenu
|
|
|
|
echo "WebUI\HostHeaderValidation=false" >> $config/qbittorrent/config/qBittorrent/qBittorrent.conf
|
|
|
|
|
|
}
|
|
|
|
usage() {
|
|
echo "usage: $0 sub-command"
|
|
echo "where sub-command is one of:"
|
|
echo " install Install megamedia"
|
|
echo " upgrade Upgrade megamedia"
|
|
echo " rm/start/stop/restart Remove/Start/Stop/Restart megamedia"
|
|
echo " status megamedia status"
|
|
echo " port megamedia port"
|
|
}
|
|
|
|
case ${ACTION} in
|
|
"install")
|
|
get_image
|
|
do_install_detail
|
|
;;
|
|
"upgrade")
|
|
get_image
|
|
do_install_detail
|
|
;;
|
|
"rm")
|
|
docker rm -f megamedia
|
|
;;
|
|
"start" | "stop" | "restart")
|
|
docker ${ACTION} megamedia
|
|
;;
|
|
"status")
|
|
docker ps --all -f 'name=megamedia' --format '{{.State}}'
|
|
;;
|
|
"port")
|
|
docker ps --all -f 'name=megamedia' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
|
|
;;
|
|
*)
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|