summaryrefslogtreecommitdiffstats
path: root/mkosi.postinst
blob: a296e1ea35b20a3bcff976a8896ab3cfe3fdb607 (plain) (blame)
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
#!/bin/sh

# vars
githubrepo="Radarr/Radarr"
version=$(curl -s "https://api.github.com/repos/${githubrepo}/releases/latest" | grep 'tag_name' | sed -E 's/.*"([^"]+)".*/\1/')
filename="Radarr.master.$(echo ${version} | cut -c2-).linux-core-x64.tar.gz"
dlurl="https://github.com/${githubrepo}/releases/download/${version}/${filename}"

user="warez"
home="/opt/Radarr"


# GO
set -ex
export DEBIAN_FRONTEND=noninteractive

# motd
chmod 644 /etc/update-motd.d/*
systemctl mask motd-news.service
systemctl mask motd-news.timer

# Add update- and security-repositories, and perform upgrade
echo "deb http://no.archive.ubuntu.com/ubuntu $(lsb_release --short --codename)-security main universe" >> /etc/apt/sources.list
echo "deb http://no.archive.ubuntu.com/ubuntu $(lsb_release --short --codename)-updates main universe" >> /etc/apt/sources.list
apt-get update && apt-get --yes full-upgrade && apt-get --yes autoremove

# radarr

groupadd --system --gid 997 "${user}"
useradd --system --gid "${user}" --uid 997 --home-dir "${home}" --create-home "${user}"

curl --location --silent --output "/tmp/${filename}" "${dlurl}"
tar -xvz -C /opt -f "/tmp/${filename}" && rm "/tmp/${filename}"

chown -R "${user}": "${home}"

# system service
systemctl enable radarr.service