Home | History | Annotate | Line # | Download | only in etc
MAKEDEV.local revision 1.7
      1  1.1       cgd #!/bin/sh -
      2  1.7       apb #	$NetBSD: MAKEDEV.local,v 1.7 2007/02/26 20:44:03 apb Exp $
      3  1.1       cgd #
      4  1.7       apb # Copyright (c) 2007 The NetBSD Foundation, Inc.
      5  1.1       cgd # All rights reserved.
      6  1.1       cgd #
      7  1.1       cgd # Redistribution and use in source and binary forms, with or without
      8  1.1       cgd # modification, are permitted provided that the following conditions
      9  1.1       cgd # are met:
     10  1.1       cgd # 1. Redistributions of source code must retain the above copyright
     11  1.1       cgd #    notice, this list of conditions and the following disclaimer.
     12  1.1       cgd # 2. Redistributions in binary form must reproduce the above copyright
     13  1.1       cgd #    notice, this list of conditions and the following disclaimer in the
     14  1.1       cgd #    documentation and/or other materials provided with the distribution.
     15  1.1       cgd # 3. All advertising materials mentioning features or use of this software
     16  1.1       cgd #    must display the following acknowledgement:
     17  1.7       apb #        This product includes software developed by the NetBSD
     18  1.7       apb #        Foundation, Inc. and its contributors.
     19  1.7       apb # 4. Neither the name of The NetBSD Foundation nor the names of its
     20  1.7       apb #    contributors may be used to endorse or promote products derived
     21  1.7       apb #    from this software without specific prior written permission.
     22  1.7       apb #
     23  1.7       apb # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24  1.7       apb # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25  1.7       apb # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26  1.7       apb # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27  1.7       apb # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  1.7       apb # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  1.7       apb # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30  1.7       apb # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31  1.7       apb # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32  1.7       apb # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33  1.7       apb # POSSIBILITY OF SUCH DAMAGE.
     34  1.7       apb #
     35  1.7       apb ###########################################################################
     36  1.7       apb #
     37  1.7       apb # MAKEDEV.local can be customised to create site-specific device nodes.
     38  1.7       apb # By default it does nothing, except parse and accept the same command
     39  1.7       apb # line options as MAKEDEV.
     40  1.1       cgd #
     41  1.7       apb # "MAKEDEV all" or "MAKEDEV local" will invoke "MAKEDEV.local all";
     42  1.7       apb # MAKEDEV.local may also be invoked directly with other args.
     43  1.1       cgd 
     44  1.7       apb PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue
     45  1.1       cgd 
     46  1.7       apb # makedev_local special [...]
     47  1.7       apb #	the main loop
     48  1.7       apb #
     49  1.7       apb makedev_local()
     50  1.7       apb {
     51  1.6  jdolecek 
     52  1.1       cgd for i
     53  1.1       cgd do
     54  1.7       apb 
     55  1.1       cgd case $i in
     56  1.1       cgd 
     57  1.5     perry all)
     58  1.7       apb 	# Customise this.  For example:
     59  1.7       apb 	#makedev_local foo
     60  1.5     perry 	;;
     61  1.7       apb 
     62  1.7       apb # Add more cases here.  You can call functions defined in MAKEDEV.tmpl.
     63  1.7       apb # For example:
     64  1.7       apb #foo)
     65  1.7       apb #	mkdev foo c 0 0 600
     66  1.7       apb #	;;
     67  1.7       apb 
     68  1.1       cgd *)
     69  1.7       apb 	warn "$i: unknown device"
     70  1.1       cgd 	;;
     71  1.7       apb 
     72  1.1       cgd esac
     73  1.1       cgd done
     74  1.7       apb 
     75  1.7       apb }
     76  1.7       apb 
     77  1.7       apb #
     78  1.7       apb # MAIN: Load function definitions from MAKEDEV.subr; call setup function
     79  1.7       apb # to parse command line args and set some other variables; then call
     80  1.7       apb # makedev_local function to create requested devices.
     81  1.7       apb #
     82  1.7       apb . "$(dirname "$0")/MAKEDEV.subr"
     83  1.7       apb setup ${1+"$@"}
     84  1.7       apb shift $((${OPTIND}-1))
     85  1.7       apb makedev_local ${1+"$@"}
     86