|
Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2019 Gentoo Authors |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
| 4 |
EAPI=7 |
| 5 |
|
| 6 |
inherit toolchain-funcs |
| 7 |
|
| 8 |
DESCRIPTION="Daemon providing access to the kernel sysrq functions via network" |
| 9 |
HOMEPAGE="https://github.com/jd/sysrqd" |
| 10 |
SRC_URI="https://github.com/jd/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
| 11 |
|
| 12 |
LICENSE="GPL-2" |
| 13 |
SLOT="0" |
| 14 |
KEYWORDS="~amd64 ~x86" |
| 15 |
|
| 16 |
PATCHES=( |
| 17 |
"${FILESDIR}"/${PN}-config.patch |
| 18 |
"${FILESDIR}"/${P}-fix-build-system.patch |
| 19 |
) |
| 20 |
|
| 21 |
src_configure() { |
| 22 |
tc-export CC |
| 23 |
} |
| 24 |
|
| 25 |
src_install() { |
| 26 |
dosbin sysrqd |
| 27 |
newinitd "${FILESDIR}/sysrqd.init" sysrqd |
| 28 |
|
| 29 |
local bindip='127.0.0.1' secret |
| 30 |
declare -i secret |
| 31 |
let secret="${RANDOM}*${RANDOM}*${RANDOM}*${RANDOM}" |
| 32 |
echo "${bindip}" > sysrqd.bind || die |
| 33 |
echo "${secret}" > sysrqd.secret || die |
| 34 |
|
| 35 |
diropts -m 0700 -o root -g root |
| 36 |
dodir /etc/sysrqd |
| 37 |
insinto /etc/sysrqd |
| 38 |
insopts -m 0600 -o root -g root |
| 39 |
doins sysrqd.bind |
| 40 |
doins sysrqd.secret |
| 41 |
|
| 42 |
einstalldocs |
| 43 |
} |
| 44 |
|
| 45 |
pkg_postinst() { |
| 46 |
elog |
| 47 |
elog "Be sure to change the initial secret in /etc/sysrqd/sysrqd.secret !" |
| 48 |
elog "As a security precaution, sysrqd is configured to only listen on" |
| 49 |
elog "127.0.0.1 by default. Change the content of /etc/sysrqd/sysrqd.bind" |
| 50 |
elog "to an IPv4 address you want it to listen on or remove the file" |
| 51 |
elog "to make it listen on any IP address (0.0.0.0)." |
| 52 |
elog |
| 53 |
} |