Bug 187924 - [PATCH] sysutils/apcupsd: Use shutdown -p rather than -h
Summary: [PATCH] sysutils/apcupsd: Use shutdown -p rather than -h
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Danilo G. Baio
URL: https://reviews.freebsd.org/D11224
Keywords:
Depends on:
Blocks: 220002
  Show dependency treegraph
 
Reported: 2014-03-25 09:40 UTC by Tim Bishop
Modified: 2017-06-19 22:50 UTC (History)
4 users (show)

See Also:


Attachments
apcupsd-3.14.10.patch (1.06 KB, patch)
2014-03-25 09:40 UTC, Tim Bishop
no flags Details | Diff
Revised patch (1.61 KB, patch)
2014-07-07 09:49 UTC, Tim Bishop
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Bishop freebsd_committer 2014-03-25 09:40:00 UTC
When shutting down the system use -p to make sure it's powered off. On
my system without this change it just sits there waiting to be turned
off, and I'd prefer it turned itself off rather than waiting for the
UPS to kill the power feed.

I can patch this locally if this isn't generally useful, but I'm not
sure what benefit there is to using -h over -p anyway?


Port maintainer (itetcu@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 1.00.2014.03.16 (mode: change, diff: SVN)
Comment 1 Edwin Groothuis freebsd_committer 2014-03-25 09:40:05 UTC
Responsible Changed
From-To: freebsd-ports-bugs->itetcu

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Tim Bishop freebsd_committer 2014-03-25 12:01:02 UTC
Alternatively, maybe the port could treat
${PREFIX}/etc/apcupsd/apccontrol as a user-editable config file and not
add it to the pkg-plist? (ie. treat it like other config files with a
.sample one and testing for changes on package removal). Then it'd make
it possible to make changes like this and preserve them.

Tim.

-- 
Tim Bishop
http://www.bishnet.net/tim/
PGP Key: 0x6C226B37FDF38D55
Comment 3 Tim Bishop freebsd_committer 2014-07-07 09:49:45 UTC
Created attachment 144481 [details]
Revised patch

Here is a revised patch. Rather than making the specific change that I wanted it seems better to make all these configuration files user changeable without getting them overwritten during a package upgrade.
Comment 4 Rene Ladan freebsd_committer 2017-02-27 20:49:47 UTC
Maintainer reset.
Comment 5 Danilo G. Baio freebsd_committer 2017-06-15 14:02:05 UTC
Hi Tim.

The sample files are fine, but in apccontrol I think it's not.

> # WARNING: the apccontrol file will be overwritten every time you update your
> # apcupsd, doing `make install'. Your own customized scripts will _not_ be
> # overwritten. If you wish to make changes to this file (discouraged), you
> # should change apccontrol.sh.in and then rerun the configure process.

What about an option to change this behavior before building?

POWEROFF
The system is halted and the power is turned off (hardware support required) at the specified time.

[./platforms/freebsd/apccontrol.in]
${SHUTDOWN} -h now --> ${SHUTDOWN} -p now

Regards.
Comment 6 Tim Bishop freebsd_committer 2017-06-15 14:34:00 UTC
(In reply to Danilo G. Baio from comment #5)

I no longer have an APC UPS to test, nor do I really remember what I was trying to achieve 4 years ago. Maybe just changing -h to -p at build time is enough, as you say.

Tim.
Comment 7 A.J. Kehoe IV (Nanoman) 2017-06-15 14:46:25 UTC
I also don't understand the benefit of using -h instead of -p.  In apccontrol, it's suggested that you can achieve this by creating a script called "/usr/local/etc/apcupsd/doshutdown", so this is what I've been doing to get the desired effect:

#!/bin/sh
shutdown -p now
exit 99
Comment 8 Danilo G. Baio freebsd_committer 2017-06-15 14:53:40 UTC
(In reply to Tim Bishop from comment #6)

Ok, thank you.

I will take a look on this and open a review with another PR's (patches).

Regards.
Comment 9 commit-hook freebsd_committer 2017-06-19 22:46:42 UTC
A commit references this bug:

Author: dbaio
Date: Mon Jun 19 22:45:58 UTC 2017
New revision: 443914
URL: https://svnweb.freebsd.org/changeset/ports/443914

Log:
  sysutils/apcupsd: Several improvements

  Add support for running multiple instances of apcupsd[1]
  Add an option to use `shutdown -p` rather than `shutdown -h`[2]
  Set as @sample several scripts that can be customized[3]
  Add an option for build with MODBUS USB driver support (Enabled by default)[4]
  Set LICENSE_FILE [5]
  Sort OPTIONS and make a small adjustment in pkg-message
  Take maintainer'ship

  PR:		180336 [1]
  PR:		187924 [2][3]
  PR:		215809 [4]
  PR:		220002 [5]

  Submitted by:	leres@ee.lbl.gov [1]
  Submitted by:	tdb [3]
  Submitted by:	ipluta@wp.pl [4]
  Submitted by:	takefu@airport.fm [5]

  Approved by:	garga (mentor)
  Differential Revision:	https://reviews.freebsd.org/D11224

Changes:
  head/sysutils/apcupsd/Makefile
  head/sysutils/apcupsd/files/apcupsd.in
  head/sysutils/apcupsd/files/patch-platforms_etc_Makefile
  head/sysutils/apcupsd/files/pkg-message.in
  head/sysutils/apcupsd/pkg-plist
Comment 10 Danilo G. Baio freebsd_committer 2017-06-19 22:50:19 UTC
Committed, thanks.