Home | History | Annotate | Line # | Download | only in etc
      1   1.1       cgd #!/bin/sh -
      2  1.14    martin #	$NetBSD: MAKEDEV.local,v 1.14 2008/04/30 13:10:49 martin 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.7       apb #
     16   1.7       apb # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17   1.7       apb # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18   1.7       apb # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19   1.7       apb # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20   1.7       apb # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21   1.7       apb # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22   1.7       apb # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23   1.7       apb # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24   1.7       apb # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25   1.7       apb # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26   1.7       apb # POSSIBILITY OF SUCH DAMAGE.
     27   1.7       apb #
     28   1.7       apb ###########################################################################
     29   1.7       apb #
     30   1.7       apb # MAKEDEV.local can be customised to create site-specific device nodes.
     31   1.7       apb # By default it does nothing, except parse and accept the same command
     32   1.7       apb # line options as MAKEDEV.
     33   1.1       cgd #
     34   1.7       apb # "MAKEDEV all" or "MAKEDEV local" will invoke "MAKEDEV.local all";
     35   1.7       apb # MAKEDEV.local may also be invoked directly with other args.
     36   1.1       cgd 
     37   1.7       apb PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue
     38   1.1       cgd 
     39   1.7       apb # makedev_local special [...]
     40   1.7       apb #	the main loop
     41   1.7       apb #
     42   1.7       apb makedev_local()
     43   1.7       apb {
     44   1.6  jdolecek 
     45   1.1       cgd for i
     46   1.1       cgd do
     47   1.7       apb 
     48   1.1       cgd case $i in
     49   1.1       cgd 
     50   1.5     perry all)
     51   1.7       apb 	# Customise this.  For example:
     52  1.13       apb 	#makedev_local foo
     53   1.5     perry 	;;
     54   1.7       apb 
     55  1.11       apb # Add more cases here.  You can call functions defined in MAKEDEV.
     56   1.7       apb # For example:
     57  1.13       apb #foo)
     58  1.13       apb #	mkdev foo c 0 0 600
     59  1.13       apb #	mkdev foo1 c 0 1 600
     60  1.13       apb #	;;
     61   1.7       apb 
     62   1.1       cgd *)
     63   1.7       apb 	warn "$i: unknown device"
     64   1.1       cgd 	;;
     65   1.7       apb 
     66   1.1       cgd esac
     67   1.1       cgd done
     68   1.7       apb 
     69   1.7       apb }
     70   1.7       apb 
     71   1.7       apb #
     72  1.11       apb # MAIN: Figure out where MAKEDEV is; load MAKEDEV as a function library;
     73  1.12       apb # then call makedev_main to do all the real work.
     74   1.7       apb #
     75  1.10       apb case "$0" in
     76  1.11       apb */*)    MAKEDEV="${0%/*}/MAKEDEV" ;;
     77  1.11       apb *)      MAKEDEV="./MAKEDEV" ;;
     78  1.10       apb esac
     79  1.11       apb [ -f "${MAKEDEV}" ] || MAKEDEV="/dev/MAKEDEV"
     80  1.11       apb 
     81  1.11       apb MAKEDEV_AS_LIBRARY=1 . "${MAKEDEV}" || exit 1
     82  1.11       apb 
     83  1.12       apb makedev_main makedev_local ${1+"$@"}
     84