161f28255Scgd#!/bin/sh - 2*11a6dbe7Smartin# $NetBSD: MAKEDEV.local,v 1.14 2008/04/30 13:10:49 martin Exp $ 361f28255Scgd# 414260611Sapb# Copyright (c) 2007 The NetBSD Foundation, Inc. 561f28255Scgd# All rights reserved. 661f28255Scgd# 761f28255Scgd# Redistribution and use in source and binary forms, with or without 861f28255Scgd# modification, are permitted provided that the following conditions 961f28255Scgd# are met: 1061f28255Scgd# 1. Redistributions of source code must retain the above copyright 1161f28255Scgd# notice, this list of conditions and the following disclaimer. 1261f28255Scgd# 2. Redistributions in binary form must reproduce the above copyright 1361f28255Scgd# notice, this list of conditions and the following disclaimer in the 1461f28255Scgd# documentation and/or other materials provided with the distribution. 1561f28255Scgd# 1614260611Sapb# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1714260611Sapb# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1814260611Sapb# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1914260611Sapb# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2014260611Sapb# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2114260611Sapb# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2214260611Sapb# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2314260611Sapb# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2414260611Sapb# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2514260611Sapb# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2614260611Sapb# POSSIBILITY OF SUCH DAMAGE. 2761f28255Scgd# 2814260611Sapb########################################################################### 2961f28255Scgd# 3014260611Sapb# MAKEDEV.local can be customised to create site-specific device nodes. 3114260611Sapb# By default it does nothing, except parse and accept the same command 3214260611Sapb# line options as MAKEDEV. 3314260611Sapb# 3414260611Sapb# "MAKEDEV all" or "MAKEDEV local" will invoke "MAKEDEV.local all"; 3514260611Sapb# MAKEDEV.local may also be invoked directly with other args. 3661f28255Scgd 3714260611SapbPATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue 3861f28255Scgd 3914260611Sapb# makedev_local special [...] 4014260611Sapb# the main loop 4114260611Sapb# 4214260611Sapbmakedev_local() 4314260611Sapb{ 442d5a801bSjdolecek 4561f28255Scgdfor i 4661f28255Scgddo 4714260611Sapb 4861f28255Scgdcase $i in 4961f28255Scgd 5007a71fdfSperryall) 5114260611Sapb # Customise this. For example: 522912d6fbSapb #makedev_local foo 5307a71fdfSperry ;; 5414260611Sapb 5568723a5bSapb# Add more cases here. You can call functions defined in MAKEDEV. 5614260611Sapb# For example: 572912d6fbSapb#foo) 582912d6fbSapb# mkdev foo c 0 0 600 592912d6fbSapb# mkdev foo1 c 0 1 600 602912d6fbSapb# ;; 6114260611Sapb 6261f28255Scgd*) 6314260611Sapb warn "$i: unknown device" 6461f28255Scgd ;; 6514260611Sapb 6661f28255Scgdesac 6761f28255Scgddone 6814260611Sapb 6914260611Sapb} 7014260611Sapb 7114260611Sapb# 7268723a5bSapb# MAIN: Figure out where MAKEDEV is; load MAKEDEV as a function library; 73beae89cdSapb# then call makedev_main to do all the real work. 7414260611Sapb# 75f21f1a9eSapbcase "$0" in 7668723a5bSapb*/*) MAKEDEV="${0%/*}/MAKEDEV" ;; 7768723a5bSapb*) MAKEDEV="./MAKEDEV" ;; 78f21f1a9eSapbesac 7968723a5bSapb[ -f "${MAKEDEV}" ] || MAKEDEV="/dev/MAKEDEV" 8068723a5bSapb 8168723a5bSapbMAKEDEV_AS_LIBRARY=1 . "${MAKEDEV}" || exit 1 8268723a5bSapb 83beae89cdSapbmakedev_main makedev_local ${1+"$@"} 84