[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: udev: Directory for custom device nodes.



ok, this is what I came up with for FC4:

xargs_simple () {
        if [ "$1" = "-n" ]; then
                shift
                MAXNR="$1"
                shift
        else
                MAXNR=100
        fi
        NR=$MAXNR
        ARGS=""
        [ -z "$1" ] && set echo

        while read line; do
                if [ $NR -gt 0 ]; then
                        ARGS="$ARGS $line"
                        NR=$[$NR - 1]
                else
                        "$@" $ARGS
                        NR=$MAXNR
                        ARGS="$line"
                fi
        done
        if [ -n "$ARGS" ]; then
                "$@" $ARGS
        fi
}

make_extra_nodes () {
        ln -snf /proc/self/fd $udev_root/fd
        ln -snf /proc/self/fd/0 $udev_root/stdin
        ln -snf /proc/self/fd/1 $udev_root/stdout
        ln -snf /proc/self/fd/2 $udev_root/stderr
        ln -snf /proc/kcore $udev_root/core

        [ -d $udev_root/pts ] || mkdir -m 0755 $udev_root/pts
        [ -d $udev_root/shm ] || mkdir -m 0755 $udev_root/shm

        if [ -x $MAKEDEV ]; then
                for i in /etc/sysconfig/makedev.d/*.nodes; do
                        cat "$i" | sed -e 's,#.*,,g' | \
                                xargs_simple -n 100 $MAKEDEV -x
                done
        fi
        for i in /etc/sysconfig/makedev.d/*.symlinks; do
                cat "$i" | sed -e 's,#.*,,g' | xargs_simple -n 1 ln -snv
        fi
}


This should MAKEDEV the nodes from /etc/sysconfig/makedev.d/*.nodes
# cat /etc/sysconfig/makedev.d/50-udev.nodes | \
> sed -e 's,#.*,,g' | xargs_simple echo
tty1 tty2 tty3 tty4 tty5 tty6 loop0 loop1 loop2 loop3 loop4 loop5 loop6 loop7 lp0 lp1 lp2 lp3 parport0 parport1 parport2 parport3 net/tun ppp console null zero


The file can contain comments with "#". Also symlinks described in /etc/sysconfig/makedev.d/*.symlinks are created.

Packages can drop their own files in /etc/sysconfig/makedev.d and the definition of the nodes in /etc/makedev.d/.

Are the names fine or should we rename /etc/sysconfig/makedev.d in s.th. like /etc/sysconfig/init-makedev.d ??


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]