Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 480298 - sys-power/apcupsd-3.14.10-r1 needs updates and systemd files
Summary: sys-power/apcupsd-3.14.10-r1 needs updates and systemd files
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matthew Marlowe (RETIRED)
URL:
Whiteboard:
Keywords: EBUILD, PATCH
Depends on:
Blocks: install-systemd-unit
  Show dependency tree
 
Reported: 2013-08-09 00:07 UTC by Billy DeVincentis
Modified: 2013-08-31 12:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild with new features (apcupsd-3.14.10-r1.ebuild,4.22 KB, text/plain)
2013-08-09 00:07 UTC, Billy DeVincentis
Details
snmp patch (apcupsd-snmp.patch,3.87 KB, patch)
2013-08-09 00:08 UTC, Billy DeVincentis
Details | Diff
apcupsd.service (apcupsd.service,252 bytes, text/plain)
2013-08-09 00:08 UTC, Billy DeVincentis
Details
apcupsd_shutdown (apcupsd_shutdown,187 bytes, text/plain)
2013-08-09 00:09 UTC, Billy DeVincentis
Details
patch for revised ebuild (apcupsd_ebuild_patch.txt,708 bytes, text/plain)
2013-08-11 20:33 UTC, Billy DeVincentis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Billy DeVincentis 2013-08-09 00:07:35 UTC
Created attachment 355446 [details]
ebuild with new features

sys-power/apcupsd-3.14.10-r1 needs updates and systemd files

1- does not compile against new snmp

added patch previously in another bug

here is the addition in the ebuild


src_prepare() {
	epatch "${FILESDIR}/${PN}-3.14.9-aliasing.patch"
        epatch "${FILESDIR}/${PN}-snmp.patch"



2- no system d service files, wasn't sure how to add this , here is what I added
at bottom of src_install section



src_install() {
	emake DESTDIR="${D}" install || die "installed failed"
	rm -f "${D}"/etc/init.d/halt

	insinto /etc/apcupsd
	newins examples/safe.apccontrol safe.apccontrol

	dodoc ChangeLog* ReleaseNotes
	doman doc/*.8 doc/*.5

	dohtml -r doc/manual/*

	rm "${D}"/etc/init.d/apcupsd
	newinitd "${FILESDIR}/${PN}.init.3" "${PN}"
	newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail

	# remove hal settings, we don't really want to have it around still.
	rm -r "${D}"/usr/share/hal

	# replace it with our udev rules if we're in Linux
	if use kernel_linux; then
		udev_newrules "${FILESDIR}"/apcupsd-udev.rules 60-${PN}.rules
	fi

	# Without this it'll crash at startup. When merging in ROOT= this
	# won't be created by default, so we want to make sure we got it!
	keepdir /var/lock
	fowners root:uucp /var/lock
	fperms 0775 /var/lock

        ## Insert systemd files
        insinto /usr/lib/systemd/system
        doins "${FILESDIR}"/apcupsd.service
        insinto /usr/lib/systemd/system-shutdown
        doins "${FILESDIR}"/apcupsd_shutdown
}




Seems to work
am attaching all files and the new ebuild itself
Comment 1 Billy DeVincentis 2013-08-09 00:08:11 UTC
Created attachment 355448 [details, diff]
snmp patch
Comment 2 Billy DeVincentis 2013-08-09 00:08:40 UTC
Created attachment 355450 [details]
apcupsd.service
Comment 3 Billy DeVincentis 2013-08-09 00:09:04 UTC
Created attachment 355452 [details]
apcupsd_shutdown
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2013-08-11 11:35:41 UTC
Comment on attachment 355446 [details]
ebuild with new features

--- apcupsd-3.14.10-r1.ebuild   2013-03-29 16:56:10.124094194 +0100
+++ -   2013-08-11 13:35:33.743807198 +0200
@@ -38,6 +38,7 @@
 
 src_prepare() {
        epatch "${FILESDIR}/${PN}-3.14.9-aliasing.patch"
+        epatch "${FILESDIR}/${PN}-snmp.patch"
 }
 
 src_configure() {
@@ -104,6 +105,12 @@
        keepdir /var/lock
        fowners root:uucp /var/lock
        fperms 0775 /var/lock
+
+        ## Insert systemd files
+        insinto /usr/lib/systemd/system
+        doins "${FILESDIR}"/apcupsd.service
+        insinto /usr/lib/systemd/system-shutdown
+        doins "${FILESDIR}"/apcupsd_shutdown
 }
 
 pkg_postinst() {
Comment 5 Billy DeVincentis 2013-08-11 20:33:51 UTC
Created attachment 355712 [details]
patch for revised ebuild
Comment 6 Doug Goldstein (RETIRED) gentoo-dev 2013-08-12 01:11:21 UTC
(In reply to Billy DeVincentis from comment #5)
> Created attachment 355712 [details]
> patch for revised ebuild

Billy,

Please add "systemd" to the top inherit and use "systemd_dounit" instead of insinto and doins. That will only work for /usr/lib/systemd/system but not for shutdown.

CCing systemd for their input on the most correct way to handle that. Only way I see now is:

insinto $(systemd_get_unitdir)-shutdown
doins "${FILESDIR}"/apcupsd_shutdown
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-12 08:05:40 UTC
The 'powerfail' removal sounds like something to do via tmpfiles.d.

Is the 'shutdown' part supposed to be called at the far end of shutdown procedure?
Comment 8 Billy DeVincentis 2013-08-12 12:53:42 UTC
Folks,
    Please go ahead and make the changes as I am not real good at ebuild stuff. The service files I pulled from Fedora and they seem to work just fine.
Comment 9 Pacho Ramos gentoo-dev 2013-08-20 09:35:27 UTC
(In reply to Billy DeVincentis from comment #8)
> Folks,
>     Please go ahead and make the changes as I am not real good at ebuild
> stuff. The service files I pulled from Fedora and they seem to work just
> fine.

Regarding the shutdown issue, maybe reviewing what other distributions like Mageia or Arch are doing could help :/
Comment 10 Pacho Ramos gentoo-dev 2013-08-31 12:46:26 UTC
+*apcupsd-3.14.10-r2 (31 Aug 2013)
+
+  31 Aug 2013; Pacho Ramos <pacho@gentoo.org> +apcupsd-3.14.10-r2.ebuild,
+  +files/apcupsd-tmpfiles.conf, +files/apcupsd.service:
+  Add unit file (#480298 by Billy DeVincentis)
+