Bug 102600 - [patch] ports/net-mgmt/arpwatch's rcNG script does not handle 'restart'
Summary: [patch] ports/net-mgmt/arpwatch's rcNG script does not handle 'restart'
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: Johan van Selst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-28 12:20 UTC by Eugene Grosbein
Modified: 2006-09-21 10:30 UTC (History)
0 users

See Also:


Attachments
file.diff (488 bytes, patch)
2006-08-28 12:20 UTC, Eugene Grosbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein 2006-08-28 12:20:22 UTC
	ports/net-mgmt/arpwatch installs rc.NG script that does not
	analyze 'arpwatch_interfaces' parameter during restart
	and restartd arpwatch without needed arguments.
	Second, it sets 'pidfile' variable but arpwatch does not create one.

Fix: This should be applied to ports/net-mgmt/arpwatch directory.
How-To-Repeat: 
echo arpwatch_enable=YES >> /etc/rc.conf
echo arpwatch_interfaces=xl0 >> /etc/rc.conf
echo 'arpwatch_xl0_options="-m arpwatch"' >> /etc/rc.conf

/usr/local/etc/rc.d/arpwatch start

	This starts arpwatch OK.

/usr/local/etc/rc.d/arpwatch restart

	This restarts arpwatch without command line arguments.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-08-28 12:20:52 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 2 Eugene Grosbein 2006-08-28 18:29:31 UTC
Hi!

There is another issue with this rcNG script.

Using settings explained in the How-To-Repeat section,
the script starts arpwatch without arguments while /etc/rc performes
initial boot of the OS, that's bad. Being started manually when
$1 is 'start', it starts arpwatch with needed arguments.
But during initial boot $1 is 'faststart'.

This is because 'arpwatch_interfaces=' at the beginning of the script
that erases value set from /etc/rc.conf by rcorder before our script starts.
/etc/rc.conf will not be sourced once more when out script runs
during initial boot sequence so all /etc/rc.conf settings become lost.

Corrected path follows. It does the following:

- 'arpwatch_dir' now may be set in /etc/rc.conf and its value won't be
  redifined by force with %%PREFIX%%/arpwatch/. This makes sense
  for NanoBSD that generally keep /usr/local/arpwatch/ onto flash
  that is mounted read-only, so arpwatch_dir needs to be redifined
  to something like /var/arpwatch;
- arpwatch_interfaces now is not ignored during faststart and restart.


--- files/arpwatch.sh.in.orig	Mon Aug 28 17:38:19 2006
+++ files/arpwatch.sh.in	Tue Aug 29 01:23:02 2006
@@ -11,8 +11,7 @@
 #arpwatch_enable="YES"
 #
 arpwatch_enable=${arpwatch_enable:-"NO"}
-arpwatch_dir="%%PREFIX%%/arpwatch/"
-arpwatch_interfaces=
+arpwatch_dir=${arpwatch_dir:-"%%PREFIX%%/arpwatch/"}
 
 . %%RC_SUBR%%
 
@@ -63,15 +62,17 @@
     ;;
 
     *)
-	 if [ "$1" = "start" ]; then
+	 case "$1" in
+         *start)
  	     for interface in ${arpwatch_interfaces}; do
 		 eval options=\$arpwatch_${interface}_options
 		 command_args="-i ${interface} ${options} -f arp.${interface}.dat"
-		 pidfile="/var/run/arpwatch-${interface}.pid"
 		 run_rc_command "$1"
 	     done
-	 else
+	     ;;
+         *)
              run_rc_command "$1"
-	 fi
+             ;;
+	 esac
     ;;
 esac



http://www.freebsd.org/cgi/query-pr.cgi?pr=102600
Comment 3 Thomas Abthorpe 2006-08-31 02:45:27 UTC
I concur with the amended patch, please commit.

Thanks.


Thomas
Comment 4 Johan van Selst freebsd_committer freebsd_triage 2006-09-21 10:24:52 UTC
State Changed
From-To: feedback->closed

Committed, thanks. 


Comment 5 Johan van Selst freebsd_committer freebsd_triage 2006-09-21 10:24:52 UTC
Responsible Changed
From-To: freebsd-ports-bugs->johans

Committed, thanks.
Comment 6 dfilter service freebsd_committer freebsd_triage 2006-09-21 10:27:20 UTC
johans      2006-09-21 09:27:14 UTC

  FreeBSD ports repository

  Modified files:
    net-mgmt/arpwatch/files arpwatch.sh.in 
  Log:
  - Fix rcNG script (handle restart, allow $arpwatch_dir setting)
  
  PR:             ports/102600
  Submitted by:   Eugene Grosbein
  Approved by:    Thomas Abthorpe (maintainer)
  
  Revision  Changes    Path
  1.6       +8 -6      ports/net-mgmt/arpwatch/files/arpwatch.sh.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"