commit:     8fb51d0518a8bdefde5499d41e1b43b638838eb1
Author:     Craig Andrews <candrews <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 10 12:50:47 2022 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Wed Aug 10 12:55:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8fb51d05

www-apps/sonarr: add executable to make running Sonarr easier

Bug: https://bugs.gentoo.org/864581
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 www-apps/sonarr/files/Sonarr                |  3 ++
 www-apps/sonarr/files/sonarr.init-r1        |  7 +++++
 www-apps/sonarr/files/sonarr.service-r1     | 30 ++++++++++++++++++
 www-apps/sonarr/sonarr-3.0.9.1549-r1.ebuild | 47 +++++++++++++++++++++++++++++
 4 files changed, 87 insertions(+)

diff --git a/www-apps/sonarr/files/Sonarr b/www-apps/sonarr/files/Sonarr
new file mode 100644
index 000000000000..773b3504ca3e
--- /dev/null
+++ b/www-apps/sonarr/files/Sonarr
@@ -0,0 +1,3 @@
+#!/bin/sh
+/usr/bin/mono /opt/sonarr/Sonarr.exe "$@"
+

diff --git a/www-apps/sonarr/files/sonarr.init-r1 
b/www-apps/sonarr/files/sonarr.init-r1
new file mode 100644
index 000000000000..dd1b7388738a
--- /dev/null
+++ b/www-apps/sonarr/files/sonarr.init-r1
@@ -0,0 +1,7 @@
+#!/sbin/openrc-run
+
+pidfile="/run/sonarr.pid"
+command="/opt/sonarr/Sonarr"
+command_user="sonarr:sonarr"
+command_background=true
+

diff --git a/www-apps/sonarr/files/sonarr.service-r1 
b/www-apps/sonarr/files/sonarr.service-r1
new file mode 100644
index 000000000000..542f5d7f1031
--- /dev/null
+++ b/www-apps/sonarr/files/sonarr.service-r1
@@ -0,0 +1,30 @@
+[Unit]
+Description=Sonarr is a Smart PVR for newsgroup and bittorrent users.
+After=syslog.target network.target network-online.target
+
+[Service]
+User=sonarr
+Group=sonarr
+
+Type=simple
+ExecStart=/opt/sonarr/Sonarr
+TimeoutStopSec=20
+KillMode=process
+Restart=on-failure
+
+PrivateTmp=yes
+PrivateDevices=yes
+PrivateMounts=yes
+ProtectHome=yes
+ProtectSystem=full
+NoNewPrivileges=yes
+ProtectHostname=yes
+ProtectClock=yes
+ProtectKernelTunables=yes
+ProtectKernelModules=yes
+ProtectKernelLogs=yes
+ProtectControlGroups=yes
+RestrictRealtime=yes
+
+[Install]
+WantedBy=multi-user.target

diff --git a/www-apps/sonarr/sonarr-3.0.9.1549-r1.ebuild 
b/www-apps/sonarr/sonarr-3.0.9.1549-r1.ebuild
new file mode 100644
index 000000000000..a3d2abfcc0bc
--- /dev/null
+++ b/www-apps/sonarr/sonarr-3.0.9.1549-r1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit systemd
+
+SRC_URI="https://download.sonarr.tv/v3/main/${PV}/Sonarr.main.${PV}.linux.tar.gz";
+
+DESCRIPTION="Sonarr is a Smart PVR for newsgroup and bittorrent users"
+HOMEPAGE="https://www.sonarr.tv";
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+RESTRICT="bindist strip test"
+
+RDEPEND="
+       acct-group/sonarr
+       acct-user/sonarr
+       >=dev-lang/mono-6.6.0.161
+       media-video/mediainfo
+       dev-db/sqlite"
+
+QA_PREBUILT="*"
+
+S="${WORKDIR}/Sonarr"
+
+src_install() {
+       newinitd "${FILESDIR}/${PN}.init-r1" ${PN}
+
+       keepdir /var/lib/${PN}
+       fowners -R ${PN}:${PN} /var/lib/${PN}
+
+       insinto /etc/logrotate.d
+       insopts -m0644 -o root -g root
+       newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+       dodir  "/opt/${PN}"
+       cp -R "${S}/." "${D}/opt/${PN}" || die "Install failed!"
+
+       exeinto "/opt/${PN}"
+       doexe "${FILESDIR}/Sonarr"
+
+       systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service"
+       systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}@.service"
+}

Reply via email to