forked from Luctia/ezarr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users_groups_setup.py
113 lines (96 loc) · 4.81 KB
/
users_groups_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import os
class UserGroupSetup:
def __init__(self, root_dir='/'):
self.root_dir = root_dir
os.system('sudo groupadd mediacenter -g 13000')
os.system('sudo usermod -a -G mediacenter $USER')
os.system(
'/bin/bash -c "sudo mkdir -pv ' + self.root_dir + '/data/{media,usenet,torrents} -m 775'
' ; sudo chown $(id -u):mediacenter ' + self.root_dir + '/data'
' ; sudo chown $(id -u):mediacenter ' + self.root_dir + '/data/{media,usenet,torrents}"'
)
def create_config_dir(self, service_name):
os.system(
f'sudo mkdir -p {self.root_dir}/config/{service_name}-config -m 775' # -m 775 gives read/write access to the whole mediacenter group, change to 755 for only read
f' ; sudo chown -R {service_name}:mediacenter {self.root_dir}/config/{service_name}-config'
f' ; sudo chown $(id -u):mediacenter {self.root_dir}/config'
)
def sonarr(self):
os.system(
'/bin/bash -c "sudo useradd sonarr -u 13001'
' ; sudo mkdir -pv ' + self.root_dir + '/data/{media,usenet,torrents}/tv -m 775'
' ; sudo chown -R sonarr:mediacenter ' + self.root_dir + '/data/{media,usenet,torrents}/tv"'
)
self.create_config_dir('sonarr')
os.system('sudo usermod -a -G mediacenter sonarr')
def radarr(self):
os.system(
'/bin/bash -c "sudo useradd radarr -u 13002'
' ; sudo mkdir -pv ' + self.root_dir + '/data/{media,usenet,torrents}/movies -m 775'
' ; sudo chown -R radarr:mediacenter ' + self.root_dir + '/data/{media,usenet,torrents}/movies"'
)
self.create_config_dir('radarr')
os.system('sudo usermod -a -G mediacenter radarr')
def bazarr(self):
os.system('/bin/bash -c "sudo useradd bazarr -u 13013"')
self.create_config_dir('bazarr')
os.system('sudo usermod -a -G mediacenter bazarr')
def lidarr(self):
os.system(
'/bin/bash -c "sudo useradd lidarr -u 13003'
' ; sudo mkdir -pv ' + self.root_dir + '/data/{media,usenet,torrents}/music -m 775'
' ; sudo chown -R lidarr:mediacenter ' + self.root_dir + '/data/{media,usenet,torrents}/music"'
)
self.create_config_dir('lidarr')
os.system('sudo usermod -a -G mediacenter lidarr')
def readarr(self):
os.system(
'/bin/bash -c "sudo useradd readarr -u 13004'
' ; sudo mkdir -pv ' + self.root_dir + '/data/{media,usenet,torrents}/books -m 775'
' ; sudo chown -R readarr:mediacenter ' + self.root_dir + '/data/{media,usenet,torrents}/books"'
)
self.create_config_dir('readarr')
os.system('sudo usermod -a -G mediacenter readarr')
def mylar3(self):
os.system(
'/bin/bash -c "sudo useradd mylar -u 13005'
' ; sudo mkdir -pv ' + self.root_dir + '/data/{media,usenet,torrents}/comics -m 775'
' ; sudo chown -R mylar:mediacenter ' + self.root_dir + '/data/{media,usenet,torrents}/comics"'
)
self.create_config_dir('mylar')
os.system('sudo usermod -a -G mediacenter mylar')
def audiobookshelf(self):
os.system(
'/bin/bash -c "sudo useradd audiobookshelf -u 13014'
' ; sudo mkdir -pv ' + self.root_dir + '/data/media/{audiobooks,podcasts,audiobookshelf-metadata} -m 775'
' ; sudo chown -R audiobookshelf:mediacenter ' + self.root_dir + '/data/media/{audiobooks,podcasts,audiobookshelf-metadata}"'
)
self.create_config_dir('audiobookshelf')
os.system('sudo usermod -a -G mediacenter audiobookshelf')
def prowlarr(self):
os.system('sudo useradd prowlarr -u 13006')
self.create_config_dir('prowlarr')
os.system('sudo usermod -a -G mediacenter prowlarr')
def qbittorrent(self):
os.system('sudo useradd qbittorrent -u 13007')
os.system('sudo usermod -a -G mediacenter qbittorrent')
def overseerr(self):
os.system('sudo useradd overseerr -u 13009')
self.create_config_dir('overseerr')
os.system('sudo usermod -a -G mediacenter overseerr')
def plex(self):
os.system('sudo useradd plex -u 13010')
self.create_config_dir('plex')
os.system('sudo usermod -a -G mediacenter plex')
def sabnzbd(self):
os.system('sudo useradd sabnzbd -u 13011')
self.create_config_dir('sabnzbd')
os.system('sudo usermod -a -G mediacenter sabnzbd')
def jellyseerr(self):
os.system('sudo useradd jellyseerr -u 13012')
self.create_config_dir('jellyseerr')
os.system('sudo usermod -a -G mediacenter jellyseerr')
def jackett(self):
os.system('sudo useradd jackett -u 13008')
self.create_config_dir('jackett')
os.system('sudo usermod -a -G mediacenter jackett')