-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathradarr4kinstall.sh
126 lines (110 loc) · 3.58 KB
/
radarr4kinstall.sh
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
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
. /etc/swizzin/sources/globals.sh
. /etc/swizzin/sources/functions/utils
# Script by @ComputerByte
# For Radarr 4K Installs
#shellcheck=SC1017
# Log to Swizzin.log
export log=/root/logs/swizzin.log
touch $log
# Set variables
user=$(_get_master_username)
echo_progress_start "Making data directory and owning it to ${user}"
mkdir -p "/home/$user/.config/radarr4k"
chown -R "$user":"$user" /home/$user/.config/radarr4k
echo_progress_done "Data Directory created and owned."
echo_progress_start "Installing systemd service file"
cat >/etc/systemd/system/radarr4k.service <<-SERV
[Unit]
Description=Radarr 4K
After=syslog.target network.target
[Service]
# Change the user and group variables here.
User=${user}
Group=${user}
Type=simple
# Change the path to Radarr or mono here if it is in a different location for you.
ExecStart=/opt/Radarr/Radarr -nobrowser --data=/home/${user}/.config/radarr4k
TimeoutStopSec=20
KillMode=process
Restart=on-failure
# These lines optionally isolate (sandbox) Radarr from the rest of the system.
# Make sure to add any paths it might use to the list below (space-separated).
#ReadWritePaths=/opt/Radarr /path/to/movies/folder
#ProtectSystem=strict
#PrivateDevices=true
#ProtectHome=true
[Install]
WantedBy=multi-user.target
SERV
echo_progress_done "Radarr 4K service installed"
# This checks if nginx is installed, if it is, then it will install nginx config for radarr4k
if [[ -f /install/.nginx.lock ]]; then
echo_progress_start "Installing nginx config"
cat >/etc/nginx/apps/radarr4k.conf <<-NGX
location ^~ /radarr4k {
proxy_pass http://127.0.0.1:7888/radarr4k;
proxy_set_header Host \$host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection \$http_connection;
auth_basic "What's the password?";
auth_basic_user_file /etc/htpasswd.d/htpasswd.${user};
}
# Allow the API External Access via NGINX
location ^~ /radarr4k/api {
auth_basic off;
proxy_pass http://127.0.0.1:7888;
}
NGX
# Reload nginx
systemctl reload nginx
echo_progress_done "Nginx config applied"
fi
echo_progress_start "Generating configuration"
# Start radarr to config
systemctl stop radarr.service >>$log 2>&1
cat > /home/${user}/.config/radarr4k/config.xml << EOSC
<Config>
<LogLevel>info</LogLevel>
<UpdateMechanism>BuiltIn</UpdateMechanism>
<Branch>master</Branch>
<BindAddress>127.0.0.1</BindAddress>
<Port>7888</Port>
<SslPort>6969</SslPort>
<EnableSsl>False</EnableSsl>
<LaunchBrowser>False</LaunchBrowser>
<AuthenticationMethod>None</AuthenticationMethod>
<UrlBase>radarr4k</UrlBase>
<UpdateAutomatically>False</UpdateAutomatically>
</Config>
EOSC
chown -R ${user}:${user} /home/${user}/.config/radarr4k/config.xml
systemctl enable --now radarr.service >>$log 2>&1
sleep 10
systemctl enable --now radarr4k.service >>$log 2>&1
echo_progress_start "Patching panel."
systemctl start radarr4k.service >>$log 2>&1
#Install Swizzin Panel Profiles
if [[ -f /install/.panel.lock ]]; then
cat <<EOF >>/opt/swizzin/core/custom/profiles.py
class radarr4k_meta:
name = "radarr4k"
pretty_name = "Radarr 4K"
baseurl = "/radarr4k"
systemd = "radarr4k"
check_theD = False
img = "radarr"
class radarr_meta(radarr_meta):
systemd = "radarr"
check_theD = False
EOF
fi
touch /install/.radarr4k.lock >>$log 2>&1
echo_progress_done "Panel patched."
systemctl restart panel >>$log 2>&1
echo_progress_done "Done."