#!/bin/sh # Create devices # Author: Igor Pechtchanski # Version: 1.0 # # Number of devices of a certain type to be created - change if more needed CREATEDEV=32 # Parameters end here -- you shouldn't have to change anything below this line # Actual /dev directory DEVDIR="$(cygpath -au "C:/$(cygpath -aw /dev)" | sed 's,/c/\(.\):/,/\1/,')" # Sequence of services to generate ALL="$(seq -s " " 0 $(expr $CREATEDEV - 1))" error() { echo "$@" && exit 1; } [ -e "$DEVDIR" -a ! -d "$DEVDIR" ] && \ error "$DEVDIR exists and is not a directory" [ ! -e "$DEVDIR" ] && \ (mkdir "$DEVDIR" || error "Unable to create $DEVDIR") [ -w "$DEVDIR" ] || error "$DEVDIR exists, but isn't writeable" cd "$DEVDIR" || error "Unable to cd to $DEVDIR" # - console (1,*) for i in conin conout tty; do touch ./"$i"; done # - tty master (4,*) for i in ttym; do touch ./"$i"; done # - tty (5,*) for i in $ALL; do touch ./"tty$i"; done # - pty master (6,*) for i in ptmx; do touch ./"$i"; done # - serial (7,*) for i in $ALL; do touch ./"ttyS$i"; done # TODO: should we do com* as well? # - windows (12,*) for i in windows; do touch ./"$i"; done # - floppy (17,0..15) for i in 0 1 2; do touch ./"fd$i"; done # - cdrom (17,16..31) for i in 0 1 2; do touch ./"scd$i"; done # - hard disks (17,32..223) for j in a b c; do for i in "" 1 2; do touch ./"sd$j$i"; done; done # - tape [rewind] (18,0..127) for i in 0 1 2; do touch ./"st$i"; done # - tape [norewind] (18,128..255) for i in 0 1 2; do touch ./"nst$i"; done # - null (19,*) for i in null; do touch ./"$i"; done # - zero (20,*) for i in zero; do touch ./"$i"; done # - random (21,*) for i in random urandom; do touch ./"$i"; done # - mem (22,*) for i in mem port; do touch ./"$i"; done # - clipboard (23,*) for i in clipboard; do touch ./"$i"; done # - dsp (24,*) for i in dsp; do touch ./"$i"; done # Create pipes for i in pipe piper pipew; do touch ./"$i"; done # Create sockets for i in tcp udp streamsocket dgsocket; do touch ./"$i"; done # Create symbolic links [ ! -e console ] && ln -s tty ./console [ ! -e floppy ] && ln -s fd0 ./floppy [ ! -e cdrom ] && ln -s scd0 ./cdrom [ ! -e tape ] && ln -s st0 ./tape [ ! -e audio ] && ln -s dsp ./audio