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