Bug 206287 - net/htpdate: improve startup script
Summary: net/htpdate: improve startup script
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Jason Helfman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-15 11:18 UTC by Nick Hibma
Modified: 2016-01-16 16:41 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (jgh)


Attachments
proposed patch (625 bytes, patch)
2016-01-15 19:21 UTC, Jason Helfman
no flags Details | Diff
updated patch (622 bytes, patch)
2016-01-16 00:12 UTC, Jason Helfman
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Hibma 2016-01-15 11:18:50 UTC
The startup script does not allow changing command line flags as they are overridden by the command_args statement. The new initialisation first sets defaults and then calls load_rc_config instead of updating settings.

My main problem was that I wanted to remove -s. I can now do that with

htpdate_enable='YES'
htpdate_flags="-l"

Hopefully this is of use.


. /etc/rc.subr

htpdate_enable='NO'
htpdate_servers='www.freebsd.org www.linux.com'
htpdate_flags="-l -s"

load_rc_config htpdate

name=htpdate
rcvar=htpdate_enable
servers=${htpdate_servers}
pidfile=/var/run/htpdate.pid

command="/usr/local/bin/htpdate"
command_args="-D $servers"
stop_cmd=htpdate_stop
Comment 1 Jason Helfman freebsd_committer freebsd_triage 2016-01-15 19:21:47 UTC
Created attachment 165642 [details]
proposed patch

If you add htpdate_extra_args="<YOUR ARGUMENTS HERE>" to /etc/rc.conf, after building and installing the software with this patch, I believe this will address your issue.

Please let me know if this works.

Thanks!
-jgh
Comment 2 Nick Hibma 2016-01-15 21:37:33 UTC
The patch is empty and it doesn't work. -s does not have a negating flag.
Comment 3 Jason Helfman freebsd_committer freebsd_triage 2016-01-15 21:56:23 UTC
Perhaps you clicked on the details of the patch. That is empty, and I have done that myself too many times. Please click on the "diff" link, and then unified diff. Here is a link to the patch using these options.

https://bz-attachments.freebsd.org/attachment.cgi?id=165642&action=diff&format=raw&headers=1
Comment 4 Nick Hibma 2016-01-15 22:05:02 UTC
I don't see any ports using that approach. Why not use the approach that is provided by rc.subr?

nick@duaca:/usr/ports % find . -name Makefile -exec grep _extra_flags \{\} +
nick@duaca:/usr/ports %
Comment 5 Jason Helfman freebsd_committer freebsd_triage 2016-01-15 22:50:59 UTC
The reason that has no results is that the change is not in the Makefile. I've shifted this to use htpdate_flags, as I had done to shift all of the postgresql's to profile based instances.

Does the patch work for you?
Comment 6 Jason Helfman freebsd_committer freebsd_triage 2016-01-16 00:12:35 UTC
Created attachment 165645 [details]
updated patch

updated patch
Comment 7 Nick Hibma 2016-01-16 14:21:10 UTC
Looks fine. But haven't tried it.
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-01-16 16:41:03 UTC
A commit references this bug:

Author: jgh
Date: Sat Jan 16 16:40:20 UTC 2016
New revision: 406238
URL: https://svnweb.freebsd.org/changeset/ports/406238

Log:
  - improve startup script and allow flags to be tuneable

  No need to bump portrevision, as this is not changing
  any existing function.

  PR:		206287
  Reported by:	Nick@van-laarhoven.org

Changes:
  head/net/htpdate/files/htpdate.in