Re: hotplugd attach into /etc/examples?

2014-12-24 Thread Ingo Schwarze
Hi,

frantisek holop wrote on Wed, Dec 24, 2014 at 11:10:31AM +0100:

 now that there is a dedicated place for examples,

You misunderstand.  The point of creating /etc/examples was not
to create a new place for documentation.  The point was to be
able to delete lots of junk from /etc/ without being held back
by the substantial work of properly integrating the information
into manual pages.

 i think it would be easier to get started
 with hotplugd/attach with a file instead of
 copy pasting from the manual page...

I don't see the point at all.

I strongly object to deleting useful examples from manual pages,
except when they are excessive, which doesn't seem to be the case
here.

Besides, the filename /etc/examples/attach is wrong, but that's
hardly relevant given that the whole direction seems questionable.

 i think it would be useful to somehow advertise these examples

In general, i don't think so, i'd rather like the idea of getting
rid of as many of them as possible.  In those few cases where they
are useful (/etc/examples/pf.conf being the canonical example of
one that might be useful; right now, it is not), mentioning them
in the manual might be useful, but i'd consider that the exception
rather than the rule.  Yes, i should put my money where my mouth
is and all that, but i'm not going to work on it right now.

Yours,
  Ingo


 Index: etc/examples/attach
 ===
 RCS file: etc/examples/attach
 diff -N etc/examples/attach
 --- /dev/null 1 Jan 1970 00:00:00 -
 +++ etc/examples/attach   24 Dec 2014 09:58:07 -
 @@ -0,0 +1,24 @@
 +#!/bin/sh
 +
 +DEVCLASS=$1
 +DEVNAME=$2
 +
 +logger -i -t attach DEVCLASS=$DEVCLASS, DEVNAME=$DEVNAME
 +
 +case $DEVCLASS in
 +2)
 + # disk devices
 + disklabel=`/sbin/disklabel $DEVNAME 21 | \
 + sed -n '/^label: /s/^label: //p'`
 + logger -i -t attach disklabel='$disklabel'
 +#case $disklabel in
 +#Sony*DSC*)
 +#mount -o nodev,nosuid /dev/$DEVNAMEi /mnt/camera
 +#;;
 +#esac
 + ;;
 +3)
 + # network devices; requires hostname.$DEVNAME
 + sh /etc/netstart $DEVNAME
 + ;;
 +esac
 Index: usr.sbin/hotplugd/hotplugd.8
 ===
 RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.8,v
 retrieving revision 1.12
 diff -u -p -r1.12 hotplugd.8
 --- usr.sbin/hotplugd/hotplugd.8  21 Jan 2014 03:15:46 -  1.12
 +++ usr.sbin/hotplugd/hotplugd.8  24 Dec 2014 09:58:10 -
 @@ -85,34 +85,6 @@ Script to execute on device attachment.
  .It /etc/hotplug/detach
  Script to execute on device detachment.
  .El
 -.Sh EXAMPLES
 -Sample
 -.Pa attach
 -script:
 -.Bd -literal -offset indent
 -#!/bin/sh
 -
 -DEVCLASS=$1
 -DEVNAME=$2
 -
 -case $DEVCLASS in
 -2)
 - # disk devices
 - disklabel=`/sbin/disklabel $DEVNAME 2\*(Gt1 | \e
 - sed -n '/^label: /s/^label: //p'`
 - case $disklabel in
 - Sony*DSC*)
 - # Sony DSC camera
 - mount -o nodev,nosuid /dev/$DEVNAMEi /mnt/camera
 - ;;
 - esac
 - ;;
 -3)
 - # network devices; requires hostname.$DEVNAME
 - sh /etc/netstart $DEVNAME
 - ;;
 -esac
 -.Ed
  .Sh SEE ALSO
  .Xr hotplug 4
  .Sh HISTORY



Re: hotplugd attach into /etc/examples?

2014-12-24 Thread frantisek holop
Ingo Schwarze, 24 Dec 2014 11:34:
  now that there is a dedicated place for examples,
 
 You misunderstand.  The point of creating /etc/examples was not
 to create a new place for documentation.  The point was to be
 able to delete lots of junk from /etc/ without being held back
 by the substantial work of properly integrating the information
 into manual pages.

i understand but disagree.

for me /etc/examples is the same concept as /usr/local/share/examples

the latter is a great way to not clutter up /etc/ at package
install time, but at the same time it does not throw out the
baby with the bathwater, and it gives me a file i can quickly
start working on (together with the man page) instead of
copy-pasting everything ab ovo from documentation, especially
when many config files need minimal changes for common operation.

example config files can be quite helpful and can save
a lot of headache, googling and questions to mailing
lists.

i think hotplugd is special case, because without at
least a skeleton attach script it is utterly useless,
and i think there should have been a commented out
script file from the beginning under /etc/hotplugd
(and not /etc/hotplug).

the patch i sent is just an idea, i was fairly sure
it would never get it in its current form, but i wanted
to start a discussion about it. copying the whole
/etc/ structure inside /etc/examples seemed excessive
for this, after all they are just examples.

last but not least, a whole shell script inside
a man page seems totally out of place for me,
excessive or not.

-f
-- 
2 wrongs don't make a right - but 3 lefts do!