diff options
-rw-r--r-- | isatty.c | 6 | ||||
-rwxr-xr-x | makedevs | 137 | ||||
-rwxr-xr-x | rc.sysinit | 6 |
3 files changed, 29 insertions, 120 deletions
diff --git a/isatty.c b/isatty.c new file mode 100644 index 0000000..bf815c5 --- /dev/null +++ b/isatty.c @@ -0,0 +1,6 @@ +#include <unistd.h> + +int main(int argc, char** argv) +{ + return !isatty(1); +} @@ -1,123 +1,26 @@ -#!/bin/bash +#!/bin/sh -# $1 = base name -# $2 = type (b/c) -# $3 = start -# $4 = finish -# $5 = device major -# $6 = device minor of first index -mksubdevs() { - minor=$6 - for i in `seq $3 $4`; do - devname="$1$i" - mknod $devname $2 $5 $minor - minor=$(($minor+1)) - done -} +# a cheeky way of dynamically creating a /dev tree +devdir="/dev" +[ "$1" ] && devdir=$1 -usage() { - echo "usage: makedevs <device root> [class] [class] ..." - echo - echo "available classes: base,ide,scsi,fd,tty,pty,rd,md,loop,dm" - echo " (use 'all' to select all)" - echo - echo "example: makedevs /dev base ide scsi" - echo - exit 0 -} +cd $devdir -DEV_ROOT=$1 -[ "$1" == "" ] && usage -shift - -cd $DEV_ROOT || exit 1 - -CLASSES= -while [ "$1" ]; do - if [ "$1" == "all" ]; then - CLASSES="base ide scsi fd tty pty rd md loop dm" - else - CLASSES="$CLASSES $1" - fi - shift +for i in `find /sys/block -name dev`; do + # get the second-to-last field + name=`echo $i | rev | cut -d/ -f2 | rev` + maj=`cat $i | cut -d: -f1` + min=`cat $i | cut -d: -f2` + [ ! -e $name ] && mknod $name b $maj $min done -for CLASS in $CLASSES; do - case $CLASS in - base) - mknod console c 5 1 - mknod full c 1 7 - mknod mem c 1 1 - mknod null c 1 3 - mknod psaux c 10 1 - mknod random c 1 8 - mknod tty c 5 0 - mknod urandom c 1 9 - mknod zero c 1 5 - ;; - ide) - mknod hda b 3 0 - mknod hdb b 3 64 - mknod hdc b 22 0 - mknod hdd b 22 64 - mknod hde b 33 0 - mknod hdf b 33 64 - mknod hdg b 34 0 - mknod hdh b 34 64 - mksubdevs hda b 1 12 3 1 - mksubdevs hdb b 1 12 3 65 - mksubdevs hdc b 1 12 22 1 - mksubdevs hdd b 1 12 22 65 - mksubdevs hde b 1 12 33 1 - mksubdevs hdf b 1 12 33 65 - mksubdevs hdg b 1 12 34 1 - mksubdevs hdh b 1 12 34 65 - ;; - scsi) - mknod sda b 8 0 - mknod sdb b 8 16 - mknod sdc b 8 32 - mknod sdd b 8 48 - mknod sde b 8 64 - mknod sdf b 8 80 - mknod sdg b 8 96 - mknod sdh b 8 112 - mksubdevs sda b 1 12 8 1 - mksubdevs sdb b 1 12 8 17 - mksubdevs sdc b 1 12 8 33 - mksubdevs sdd b 1 12 8 49 - mksubdevs sde b 1 12 8 65 - mksubdevs sdf b 1 12 8 81 - mksubdevs sdg b 1 12 8 97 - mksubdevs sdh b 1 12 8 113 - # SCSI CD-ROMs - mksubdevs scd b 0 3 11 0 - mksubdevs sr b 0 3 11 0 - ;; - fd) - mksubdevs fd b 0 3 2 0 - ;; - tty) - mksubdevs tty c 0 63 4 0 - ;; - pty) - mknod ptmx c 5 2 - ;; - rd) - mksubdevs ram b 0 15 1 0 - ;; - md) - mksubdevs md b 0 15 9 0 - ;; - loop) - mksubdevs loop b 0 7 7 0 - ;; - dm) - mkdir mapper >/dev/null 2>&1 - mknod mapper/control c 10 63 - ;; - *) - echo "Unknown class: $CLASS" >&2 - ;; - esac +for i in `find /sys/class -name dev`; do + # get the second-to-last field + name=`echo $i | rev | cut -d/ -f2 | rev` + # skip all the tty?? nodes + #[ "${name%%??}" = "tty" ] && continue + #[ "${name%%??}" = "pty" ] && continue + maj=`cat $i | cut -d: -f1` + min=`cat $i | cut -d: -f2` + [ ! -e $name ] && mknod $name c $maj $min done @@ -7,7 +7,7 @@ . /etc/rc.d/functions echo " " -printhl "Arch Linux v0.7.1 $C_OTHER(${C_H2}Noodle$C_OTHER)\n" +printhl "Arch Linux v0.7.2 $C_OTHER(${C_H2}Gimmick$C_OTHER)\n" printhl "${C_H2}http://www.archlinux.org" printhl "Copyright 2002-2006 Judd Vinet" printhl "Distributed under the GNU General Public License (GPL)" @@ -243,7 +243,7 @@ if [ "$LOCALE" != "" ]; then stat_busy "Setting Consoles to UTF-8" /usr/bin/kbd_mode -u /usr/bin/dumpkeys | /bin/loadkeys --unicode - echo 'if [ "$TERM" = "linux" ]; then echo -ne "\e%G"; fi' >>/etc/profile.d/locale.sh + echo 'if [ "$TERM" = "linux" -a isatty ]; then echo -ne "\e%G"; fi' >>/etc/profile.d/locale.sh stat_done fi fi @@ -256,7 +256,7 @@ if [ "$CONSOLEFONT" != "" ]; then /usr/bin/setfont $CONSOLEFONT -C /dev/vc/${i} fi done - echo 'if [ "$TERM" = "linux" ]; then echo -ne "\e(K"; fi' >>/etc/profile.d/locale.sh + echo 'if [ "$TERM" = "linux" -a isatty ]; then echo -ne "\e(K"; fi' >>/etc/profile.d/locale.sh stat_done fi |