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