#!/bin/sh # # MAKEDEV 3.3 - Make special devices. Author: Kees J. Bot # 3.4 - Rewritten to allow mtree line to be printed, Lionel A. Sambuc # also use getopt for argument parsing umask 077 MTREE=false STD=false RAMDISK=false ECHO= EXIT=0 # console => lp tty log # boot => kmem mem null ram zero RAMDISK_DEVICES=" boot console input c0d0 c0d0p0 c0d0p0s0 c0d1 c0d1p0 c0d1p0s0 c0d2 c0d2p0 c0d2p0s0 c0d3 c0d3p0 c0d3p0s0 c0d4 c0d4p0 c0d4p0s0 c0d5 c0d5p0 c0d5p0s0 c0d6 c0d6p0 c0d6p0s0 c0d7 c0d7p0 c0d7p0s0 c1d0 c1d0p0 c1d0p0s0 c1d1 c1d1p0 c1d1p0s0 c1d2 c1d2p0 c1d2p0s0 c1d3 c1d3p0 c1d3p0s0 c1d4 c1d4p0 c1d4p0s0 c1d5 c1d5p0 c1d5p0s0 c1d6 c1d6p0 c1d6p0s0 c1d7 c1d7p0 c1d7p0s0 fd0 fd1 fd0p0 fd1p0 ttyc1 ttyc2 ttyc3 tty00 tty01 tty02 tty03 ttyp0 ttyp1 ttyp2 ttyp3 ttyp4 ttyp5 ttyp6 ttyp7 ttyp8 ttyp9 ttypa ttypb ttypc ttypd ttype ttypf ttyq0 ttyq1 ttyq2 ttyq3 ttyq4 ttyq5 ttyq6 ttyq7 ttyq8 ttyq9 ttyqa ttyqb ttyqc ttyqd ttyqe ttyqf " #eth => ip tcp udp STD_DEVICES=" ${RAMDISK_DEVICES} bmp085b1s77 bmp085b2s77 bmp085b3s77 eepromb1s50 eepromb1s51 eepromb1s52 eepromb1s53 eepromb1s54 eepromb1s55 eepromb1s56 eepromb1s57 eepromb2s50 eepromb2s51 eepromb2s52 eepromb2s53 eepromb2s54 eepromb2s55 eepromb2s56 eepromb2s57 eepromb3s50 eepromb3s51 eepromb3s52 eepromb3s53 eepromb3s54 eepromb3s55 eepromb3s56 eepromb3s57 eth fb0 fbd filter hello i2c-1 i2c-2 i2c-3 klog random sht21b1s40 sht21b2s40 sht21b3s40 tsl2550b1s39 tsl2550b2s39 tsl2550b3s39 uds vnd0 vnd0p0 vnd0p0s0 vnd1 vnd1p0 vnd1p0s0 vnd2 vnd3 vnd4 vnd5 vnd6 vnd7 " #makedev ${dev} $type ${major} ${minor} ${uname} ${gname} ${permissions} [link_target] #When called for a link, major and minor are ignored makedev() { # Check that all the arguments are there, we trust the caller to put # values which make sens. [ $# -eq 7 ] || [ $# -eq 8 ] || return 1; local _dev=$1 local __type=$2 local _major=$3 local _minor=$4 local _uname=$5 local _gname=$6 local _mode=$7 case ${__type} in b)_type=block;; c) _type=char;; l) _type=link; _target=$8;; *) return 2;; esac if [ ${MTREE} = "yes" ] then if [ ${_type} = "link" ] then echo ./dev/${_dev} type=${_type} \ uname=${_uname} gname=${_gname} mode=${_mode} \ link=${_target} else echo ./dev/${_dev} type=${_type} \ uname=${_uname} gname=${_gname} mode=${_mode} \ device=native,${_major},${_minor} fi else if [ ${_type} = "link" ] then ${ECHO} ln -f ${_target} ${_dev} else ${ECHO} mknod ${_dev} ${__type} ${_major} ${_minor} ${ECHO} chmod ${_mode} ${_dev} ${ECHO} chown ${_uname}:${_gname} ${_dev} fi fi } # no_return usage() usage() { cat >&2 <&2 EXIT=1 esac done exit $EXIT