Files
ezarr/setup.sh
Pavlogal 51fb2ae357 Update setup.sh to match docker-compose.yml (#36)
* Update setup.sh to match docker-compose.yml

setup.sh and docker-compose.yml use mismatched config folders.

docker-compose.yml is set up to use /data/config to configs and persistent volumes for containers while setup.sh creates /data/docker for that purpose. Docker will simply auto-create the missing /config when run or the first time but it will still work*, while the entire /docker folder structure will be left empty and useless.

The caveat is that necessary permissions won't be applied when autocreating the /config folder. setup.sh usually takes care of this but since docker isn't using that folder it's going to run with autocreated permissions, owned by root. This is not a problem on its own but there are use cases when this breaks. 
On NFS filesystems without no_root_squash, the root user is basically useless, so if this script is installed on an NFS share (which is very common in virtualized environments), the containers will fail due to permission issues.

This is easily solvable by modifying either docker-compose.yml to use /docker instead of /config, or modifying setup.sh to use /config instead of /docker, which is the solution I proposed here, for no reason other than /config being a much nicer and more representative name for whats stored inside, plus it's often used in guides.

* Update users_groups_setup.py
2023-09-09 21:58:38 +02:00

51 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Make users and group
sudo useradd sonarr -u 13001
sudo useradd radarr -u 13002
sudo useradd lidarr -u 13003
sudo useradd readarr -u 13004
sudo useradd mylar -u 13005
sudo useradd prowlarr -u 13006
sudo useradd qbittorrent -u 13007
sudo useradd jackett -u 13008
sudo useradd overseerr -u 13009
sudo useradd plex -u 13010
sudo useradd sabnzbd -u 13011
sudo useradd jellyseerr -u 13012
sudo groupadd mediacenter -g 13000
sudo usermod -a -G mediacenter sonarr
sudo usermod -a -G mediacenter radarr
sudo usermod -a -G mediacenter lidarr
sudo usermod -a -G mediacenter readarr
sudo usermod -a -G mediacenter mylar
sudo usermod -a -G mediacenter prowlarr
sudo usermod -a -G mediacenter qbittorrent
sudo usermod -a -G mediacenter jackett
sudo usermod -a -G mediacenter overseerr
sudo usermod -a -G mediacenter plex
sudo usermod -a -G mediacenter sabnzbd
sudo usermod -a -G mediacenter jellyseerr
# Make directories
sudo mkdir -pv config/{sonarr,radarr,lidarr,readarr,mylar,prowlarr,qbittorrent,jackett,audiobookshelf,overseerr,plex,tautulli,sabnzbd,jellyseerr}-config
sudo mkdir -pv data/{torrents,usenet,media}/{tv,movies,music,books,comics,audiobooks,podcasts,audiobookshelf-metadata}
# Set permissions
sudo chmod -R 775 data/
sudo chown -R $(id -u):mediacenter data/
sudo chown -R sonarr:mediacenter config/sonarr-config
sudo chown -R radarr:mediacenter config/radarr-config
sudo chown -R lidarr:mediacenter config/lidarr-config
sudo chown -R readarr:mediacenter config/readarr-config
sudo chown -R mylar:mediacenter config/mylar-config
sudo chown -R prowlarr:mediacenter config/prowlarr-config
sudo chown -R qbittorrent:mediacenter config/qbittorrent-config
sudo chown -R jackett:mediacenter config/jackett-config
sudo chown -R overseerr:mediacenter config/overseerr-config
sudo chown -R plex:mediacenter config/plex-config
sudo chown -R sabnzbd:mediacenter config/sabnzbd-config
sudo chown -R jellyseerr:mediacenter config/jellyseerr-config
echo "UID=$(id -u)" >> .env