Home | History | Annotate | Line # | Download | only in etc
MAKEDEV.local revision 1.13
      1   1.1       cgd #!/bin/sh -
      2  1.13       apb #	$NetBSD: MAKEDEV.local,v 1.13 2007/12/20 07:30:25 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.13       apb 	#makedev_local foo
     60   1.5     perry 	;;
     61   1.7       apb 
     62  1.11       apb # Add more cases here.  You can call functions defined in MAKEDEV.
     63   1.7       apb # For example:
     64  1.13       apb #foo)
     65  1.13       apb #	mkdev foo c 0 0 600
     66  1.13       apb #	mkdev foo1 c 0 1 600
     67  1.13       apb #	;;
     68   1.7       apb 
     69   1.1       cgd *)
     70   1.7       apb 	warn "$i: unknown device"
     71   1.1       cgd 	;;
     72   1.7       apb 
     73   1.1       cgd esac
     74   1.1       cgd done
     75   1.7       apb 
     76   1.7       apb }
     77   1.7       apb 
     78   1.7       apb #
     79  1.11       apb # MAIN: Figure out where MAKEDEV is; load MAKEDEV as a function library;
     80  1.12       apb # then call makedev_main to do all the real work.
     81   1.7       apb #
     82  1.10       apb case "$0" in
     83  1.11       apb */*)    MAKEDEV="${0%/*}/MAKEDEV" ;;
     84  1.11       apb *)      MAKEDEV="./MAKEDEV" ;;
     85  1.10       apb esac
     86  1.11       apb [ -f "${MAKEDEV}" ] || MAKEDEV="/dev/MAKEDEV"
     87  1.11       apb 
     88  1.11       apb MAKEDEV_AS_LIBRARY=1 . "${MAKEDEV}" || exit 1
     89  1.11       apb 
     90  1.12       apb makedev_main makedev_local ${1+"$@"}
     91