|
@ -1,5 +1,5 @@ |
|
|
#!/bin/sh - |
|
|
#!/bin/sh - |
|
|
# $OpenBSD: MAKEDEV,v 1.20 1998/09/24 04:26:10 rahnds Exp $ |
|
|
|
|
|
|
|
|
# $OpenBSD: MAKEDEV,v 1.21 1998/09/25 11:51:46 todd Exp $ |
|
|
# |
|
|
# |
|
|
# Copyright (c) 1990 The Regents of the University of California. |
|
|
# Copyright (c) 1990 The Regents of the University of California. |
|
|
# All rights reserved. |
|
|
# All rights reserved. |
|
@ -21,53 +21,70 @@ |
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
|
|
# |
|
|
# |
|
|
# from: @(#)MAKEDEV 5.2 (Berkeley) 6/22/90 |
|
|
# from: @(#)MAKEDEV 5.2 (Berkeley) 6/22/90 |
|
|
# $NetBSD: MAKEDEV,v 1.17 1996/02/03 15:02:42 briggs Exp $ |
|
|
|
|
|
|
|
|
# $NetBSD: MAKEDEV,v 1.17 1996/02/03 15:02:42 briggs Exp $ |
|
|
# |
|
|
# |
|
|
# Device "make" file. Valid arguments: |
|
|
# Device "make" file. Valid arguments: |
|
|
# all a smattering--at least one of each except |
|
|
|
|
|
# fd* (unimp.) and ch* |
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
# all makes all known devices, including local devices. |
|
|
|
|
|
# Tries to make the ``standard'' number of each type. |
|
|
# std standard devices |
|
|
# std standard devices |
|
|
# fd file descriptor device nodes |
|
|
|
|
|
|
|
|
# fd makes fd/* for the fdescfs. |
|
|
# local configuration specific devices |
|
|
# local configuration specific devices |
|
|
# raminst for RAM disk install |
|
|
|
|
|
|
|
|
# ramdisk makes all devices for a ramdisk kernel |
|
|
# |
|
|
# |
|
|
# Tapes: |
|
|
# Tapes: |
|
|
# st* scsi tapes |
|
|
|
|
|
|
|
|
# st* SCSI tapes |
|
|
# |
|
|
# |
|
|
# Disks: |
|
|
# Disks: |
|
|
# fd* floppy disk drives (3 1/2") (unimp.) |
|
|
|
|
|
|
|
|
# fd* Floppy disk drives (3 1/2", 5 1/4") |
|
|
# sd* SCSI disks |
|
|
# sd* SCSI disks |
|
|
# cd* SCSI compact discs |
|
|
|
|
|
# ch* SCSI changers |
|
|
|
|
|
# vnd* vnode pseudo-disks |
|
|
|
|
|
|
|
|
# cd* SCSI cdrom drives |
|
|
|
|
|
# ch* SCSI media changer |
|
|
|
|
|
# vnd* "file" pseudo-disks |
|
|
# rd* "ramdisk" pseudo-disks |
|
|
# rd* "ramdisk" pseudo-disks |
|
|
# ccd* concatenated disk driver |
|
|
|
|
|
|
|
|
# ccd* concatenated disk devices |
|
|
# |
|
|
# |
|
|
# Terminal ports: |
|
|
# Terminal ports: |
|
|
# ttye* ite consoles |
|
|
|
|
|
|
|
|
# ttye* ite bitmapped consoles |
|
|
# tty* standard built-in serial ports (2) |
|
|
# tty* standard built-in serial ports (2) |
|
|
# |
|
|
# |
|
|
# Pseudo terminals: |
|
|
# Pseudo terminals: |
|
|
# pty* set of 16 master and slave pseudo terminals |
|
|
# pty* set of 16 master and slave pseudo terminals |
|
|
# |
|
|
# |
|
|
# Graphics devices: |
|
|
# Graphics devices: |
|
|
# grf* Bitmapped graphics device |
|
|
|
|
|
|
|
|
# grf* custom chip (grf0), Retina Z2/Z3 (grf1/grf2), |
|
|
|
|
|
# Cirrus boards (grf3), A2410 (grf4) video or |
|
|
|
|
|
# CyberVision 64 (grf5) |
|
|
# |
|
|
# |
|
|
# Special purpose devices: |
|
|
# Special purpose devices: |
|
|
# bpf* packet filter |
|
|
|
|
|
|
|
|
# bpf* Berkeley Packet Filter |
|
|
# tun* network tunnel driver |
|
|
# tun* network tunnel driver |
|
|
# lkm Device to for loadable kernel modules |
|
|
|
|
|
# *random inkernel random number generator |
|
|
|
|
|
|
|
|
# lkm loadable kernel modules interface |
|
|
|
|
|
# *random inkernal random data source |
|
|
# |
|
|
# |
|
|
|
|
|
|
|
|
PATH=/sbin:/bin/:/usr/bin:/usr/sbin |
|
|
|
|
|
|
|
|
PATH=/sbin:/bin:/usr/bin:/usr/sbin |
|
|
|
|
|
this=$0 |
|
|
umask 77 |
|
|
umask 77 |
|
|
|
|
|
|
|
|
|
|
|
# default shell support functions |
|
|
|
|
|
add () |
|
|
|
|
|
{ |
|
|
|
|
|
tmp=0 |
|
|
|
|
|
while [ "$1" ] |
|
|
|
|
|
do |
|
|
|
|
|
tmp=$(( $1 + $tmp )) |
|
|
|
|
|
shift |
|
|
|
|
|
done |
|
|
|
|
|
echo $tmp |
|
|
|
|
|
} |
|
|
|
|
|
mult () |
|
|
|
|
|
{ |
|
|
|
|
|
echo "$(( $1 * $2 ))" |
|
|
|
|
|
} |
|
|
hex () |
|
|
hex () |
|
|
{ |
|
|
{ |
|
|
case $1 in |
|
|
case $1 in |
|
|
[0-9]) echo -n $1 ;; |
|
|
|
|
|
|
|
|
[0-9]) echo -n $1;; |
|
|
10) echo -n a;; |
|
|
10) echo -n a;; |
|
|
11) echo -n b;; |
|
|
11) echo -n b;; |
|
|
12) echo -n c;; |
|
|
12) echo -n c;; |
|
@ -76,36 +93,67 @@ hex () |
|
|
15) echo -n f;; |
|
|
15) echo -n f;; |
|
|
esac |
|
|
esac |
|
|
} |
|
|
} |
|
|
|
|
|
trunc () |
|
|
|
|
|
{ |
|
|
|
|
|
# XXX pdksh can't seem to deal with locally scoped variables |
|
|
|
|
|
# in ${foo#$bar} expansions |
|
|
|
|
|
arg1="$1" |
|
|
|
|
|
arg2="$2" |
|
|
|
|
|
echo ${arg1#$arg2} |
|
|
|
|
|
} |
|
|
|
|
|
unt() |
|
|
|
|
|
{ |
|
|
|
|
|
# XXX pdksh can't seem to deal with locally scoped variables |
|
|
|
|
|
# in ${foo#$bar} expansions |
|
|
|
|
|
arg1="$1" |
|
|
|
|
|
tmp="${arg1#[a-z]*}" |
|
|
|
|
|
while [ "$tmp" != "$arg1" ] |
|
|
|
|
|
do |
|
|
|
|
|
arg1=$tmp |
|
|
|
|
|
tmp="${arg1#[a-z]*}" |
|
|
|
|
|
done |
|
|
|
|
|
tmp="${arg1%*[a-z]}" |
|
|
|
|
|
while [ "$tmp" != "$arg1" ] |
|
|
|
|
|
do |
|
|
|
|
|
arg1=$tmp |
|
|
|
|
|
tmp="${arg1%*[a-z]}" |
|
|
|
|
|
done |
|
|
|
|
|
echo $arg1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for i |
|
|
for i |
|
|
do |
|
|
do |
|
|
|
|
|
|
|
|
|
|
|
unit=`unt $1` |
|
|
|
|
|
[ "$unit" ] || unit=0 |
|
|
|
|
|
|
|
|
case $i in |
|
|
case $i in |
|
|
|
|
|
|
|
|
all) |
|
|
all) |
|
|
sh MAKEDEV std fd |
|
|
|
|
|
sh MAKEDEV sd0 sd1 sd2 sd3 st0 st1 cd0 cd1 |
|
|
|
|
|
sh MAKEDEV ofdisk0 ofdisk1 ofdisk2 ofdisk3 ofdisk4 |
|
|
|
|
|
sh MAKEDEV ofdisk5 ofdisk6 ofdisk7 ofdisk8 ofdisk9 |
|
|
|
|
|
sh MAKEDEV vnd0 vnd1 vnd2 vnd3 |
|
|
|
|
|
sh MAKEDEV ccd0 ccd1 ccd2 ccd3 |
|
|
|
|
|
sh MAKEDEV rd0 ipl |
|
|
|
|
|
sh MAKEDEV ttyo0 |
|
|
|
|
|
sh MAKEDEV tty00 tty01 tty02 tty03 pty0 |
|
|
|
|
|
sh MAKEDEV bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 bpf9 |
|
|
|
|
|
sh MAKEDEV tun0 tun1 tun2 tun3 |
|
|
|
|
|
sh MAKEDEV random uk0 uk1 ss0 ss1 |
|
|
|
|
|
sh MAKEDEV lkm |
|
|
|
|
|
sh MAKEDEV local |
|
|
|
|
|
|
|
|
sh $this std fd |
|
|
|
|
|
sh $this sd0 sd1 sd2 sd3 st0 st1 cd0 cd1 |
|
|
|
|
|
sh $this ofdisk0 ofdisk1 ofdisk2 ofdisk3 ofdisk4 |
|
|
|
|
|
sh $this ofdisk5 ofdisk6 ofdisk7 ofdisk8 ofdisk9 |
|
|
|
|
|
sh $this vnd0 vnd1 vnd2 vnd3 |
|
|
|
|
|
sh $this ccd0 ccd1 ccd2 ccd3 |
|
|
|
|
|
sh $this rd0 ipl |
|
|
|
|
|
sh $this ttyo0 |
|
|
|
|
|
sh $this tty00 tty01 tty02 tty03 pty0 |
|
|
|
|
|
sh $this bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 bpf9 |
|
|
|
|
|
sh $this tun0 tun1 tun2 tun3 |
|
|
|
|
|
sh $this random uk0 uk1 ss0 ss1 |
|
|
|
|
|
sh $this lkm |
|
|
|
|
|
sh $this local |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
ramdisk) |
|
|
ramdisk) |
|
|
sh MAKEDEV std |
|
|
|
|
|
sh MAKEDEV sd0 sd1 sd2 sd3 sd4 st0 st1 cd0 cd1 |
|
|
|
|
|
sh MAKEDEV ofdisk0 ofdisk1 ofdisk2 ofdisk3 ofdisk4 |
|
|
|
|
|
sh MAKEDEV rd0 |
|
|
|
|
|
sh MAKEDEV ttyo0 |
|
|
|
|
|
sh MAKEDEV random |
|
|
|
|
|
sh MAKEDEV tty00 tty01 pty0 |
|
|
|
|
|
|
|
|
sh $this std |
|
|
|
|
|
sh $this sd0 sd1 sd2 sd3 sd4 st0 st1 cd0 cd1 |
|
|
|
|
|
sh $this ofdisk0 ofdisk1 ofdisk2 ofdisk3 ofdisk4 |
|
|
|
|
|
sh $this rd0 |
|
|
|
|
|
sh $this ttyo0 |
|
|
|
|
|
sh $this random |
|
|
|
|
|
sh $this tty00 tty01 pty0 |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
std) |
|
|
std) |
|
@ -444,10 +492,16 @@ ss*) |
|
|
rm -f scan$unit |
|
|
rm -f scan$unit |
|
|
ln -s ss$unit scan$unit |
|
|
ln -s ss$unit scan$unit |
|
|
;; |
|
|
;; |
|
|
|
|
|
xfs*) |
|
|
|
|
|
rm -f xfs$unit |
|
|
|
|
|
mknod xfs$unit c 51 $unit |
|
|
|
|
|
chmod 600 xfs$unit |
|
|
|
|
|
chown root.wheel xfs$unit |
|
|
|
|
|
;; |
|
|
|
|
|
|
|
|
local) |
|
|
local) |
|
|
umask 0 |
|
|
umask 0 |
|
|
test -s MAKEDEV.local && sh MAKEDEV.local |
|
|
|
|
|
|
|
|
test -s MAKEDEV.local && sh $this.local |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
*) |
|
|
*) |
|
|