sys-power/fake-battery-nut - 1.2.1 (vowstar)

Search

Install

Install this version:

emerge -a =sys-power/fake-battery-nut-1.2.1

If this version is masked, you can unmask it using the autounmask tool or standard emerge options:

autounmask =sys-power/fake-battery-nut-1.2.1

Or alternatively:

emerge --autounmask-write -a =sys-power/fake-battery-nut-1.2.1

Package Information

Description:
Bridge a NUT-monitored UPS into a virtual battery for UPower
Homepage:
https://github.com/aaronsb/fake-battery-nut
License:
GPL-2+

Ebuild Details

Version EAPI Keywords Slot
1.2.1 8 ~amd64 0
View Raw Ebuild
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit linux-mod-r1 systemd

DESCRIPTION="Bridge a NUT-monitored UPS into a virtual battery for UPower"
HOMEPAGE="https://github.com/aaronsb/fake-battery-nut"
SRC_URI="https://github.com/aaronsb/fake-battery-nut/archive/refs/tags/v${PV}.tar.gz
	-> ${P}.tar.gz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	app-alternatives/bc
	sys-power/nut
"

CONFIG_CHECK="POWER_SUPPLY"

src_compile() {
	# Build via kbuild directly against the eclass-selected kernel rather
	# than the recursive upstream Makefile, which hardcodes the running
	# kernel and would break dist-kernel and cross builds.
	emake "${MODULES_MAKEARGS[@]}" -C "${KV_OUT_DIR}" M="${S}" modules
}

src_install() {
	linux_moduleinto extra
	linux_domodule fake_battery_nut.ko
	modules_post_process

	newbin nut-to-fakebattery.sh nut-to-fakebattery

	newinitd "${FILESDIR}"/${PN}.initd ${PN}
	newconfd "${FILESDIR}"/${PN}.confd ${PN}
	systemd_dounit "${FILESDIR}"/${PN}.service

	insinto /usr/lib/modules-load.d
	newins "${FILESDIR}"/${PN}.modules-load ${PN}.conf

	einstalldocs
}

pkg_postinst() {
	linux-mod-r1_pkg_postinst

	elog "Set your UPS name (upsname@host) before starting. The default is"
	elog "cyberpower@localhost."
	elog
	elog "OpenRC:  set NUT_UPS in /etc/conf.d/${PN}, then"
	elog "         rc-service ${PN} start"
	elog "systemd: systemctl edit ${PN}.service and set"
	elog "         Environment=NUT_UPS=upsname@host, then"
	elog "         systemctl start ${PN}.service"
}

Inherited Eclasses

Dependencies

RDEPEND

	app-alternatives/bc
	sys-power/nut

Manifest for 1.2.1

Type File Size Source URLs
DIST fake-battery-nut-1.2.1.tar.gz 5900733 bytes https://github.com/aaronsb/fake-battery-nut/archive/refs/tags/v1.2.1.tar.gz