summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Kohler <bkohler@gentoo.org>2020-03-24 11:38:58 -0500
committerBen Kohler <bkohler@gentoo.org>2020-03-24 11:43:43 -0500
commitb6532717a48246c9b467595ee075fc666bdb2b7b (patch)
tree53f679325b694b0d99102ddf9686378a5943cbc3 /app-admin
parentdev-util/debootstrap: Version 1.0.123 (diff)
downloadgentoo-b6532717a48246c9b467595ee075fc666bdb2b7b.tar.gz
gentoo-b6532717a48246c9b467595ee075fc666bdb2b7b.tar.bz2
gentoo-b6532717a48246c9b467595ee075fc666bdb2b7b.zip
app-admin/sysrqd: add systemd unit
Closes: https://bugs.gentoo.org/581688 Package-Manager: Portage-2.3.95, Repoman-2.3.21 Signed-off-by: Ben Kohler <bkohler@gentoo.org>
Diffstat (limited to 'app-admin')
-rw-r--r--app-admin/sysrqd/files/sysrqd.service11
-rw-r--r--app-admin/sysrqd/sysrqd-17-r1.ebuild54
2 files changed, 65 insertions, 0 deletions
diff --git a/app-admin/sysrqd/files/sysrqd.service b/app-admin/sysrqd/files/sysrqd.service
new file mode 100644
index 000000000000..278226b581b9
--- /dev/null
+++ b/app-admin/sysrqd/files/sysrqd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=SysRqd Telnet Daemon
+After=network.target
+
+[Service]
+Type=forking
+Restart=always
+ExecStart=-/usr/sbin/sysrqd
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-admin/sysrqd/sysrqd-17-r1.ebuild b/app-admin/sysrqd/sysrqd-17-r1.ebuild
new file mode 100644
index 000000000000..27c197001dd1
--- /dev/null
+++ b/app-admin/sysrqd/sysrqd-17-r1.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit systemd toolchain-funcs
+
+DESCRIPTION="Daemon providing access to the kernel sysrq functions via network"
+HOMEPAGE="https://github.com/jd/sysrqd"
+SRC_URI="https://github.com/jd/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-config.patch
+ "${FILESDIR}"/${P}-fix-build-system.patch
+)
+
+src_configure() {
+ tc-export CC
+}
+
+src_install() {
+ dosbin sysrqd
+ newinitd "${FILESDIR}/sysrqd.init" sysrqd
+ systemd_dounit "${FILESDIR}"/sysrqd.service
+
+ local bindip='127.0.0.1' secret
+ declare -i secret
+ let secret="${RANDOM}*${RANDOM}*${RANDOM}*${RANDOM}"
+ echo "${bindip}" > sysrqd.bind || die
+ echo "${secret}" > sysrqd.secret || die
+
+ diropts -m 0700 -o root -g root
+ dodir /etc/sysrqd
+ insinto /etc/sysrqd
+ insopts -m 0600 -o root -g root
+ doins sysrqd.bind
+ doins sysrqd.secret
+
+ einstalldocs
+}
+
+pkg_postinst() {
+ elog
+ elog "Be sure to change the initial secret in /etc/sysrqd/sysrqd.secret !"
+ elog "As a security precaution, sysrqd is configured to only listen on"
+ elog "127.0.0.1 by default. Change the content of /etc/sysrqd/sysrqd.bind"
+ elog "to an IPv4 address you want it to listen on or remove the file"
+ elog "to make it listen on any IP address (0.0.0.0)."
+ elog
+}