"Fossies" - the Fresh Open Source Software Archive

Member "aoe-aoe6-86/aoetools-36/aoe-mkshelf.in" (4 Jul 2015, 1162 Bytes) of archive /linux/misc/aoe-aoe6-86.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #! /bin/sh
    2 # aoe-mkshelf - device nodes for one shelf without udev
    3 # Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
    4 
    5 zero=`basename $0`
    6 
    7 if test "$#" != "2"; then
    8     echo "Usage: $zero {dir} {shelfaddress}" 1>&2
    9     echo "       n_partitions=16 $zero {dir} {shelfaddress}" 1>&2
   10     exit 1
   11 fi
   12 dyn=/sys/module/aoe/parameters/aoe_dyndevs
   13 if test -r "$dyn" && test "`cat $dyn`" = 1; then
   14     cat 1>&2 <<EOF
   15 $zero Error: aoe module is using dynamic devices.
   16 $zero: Please see the aoe-mkshelf manpage.
   17 $zero: Exiting.
   18 EOF
   19     exit 1
   20 fi
   21 if test "`ps axwwww | grep 'udev[d]'`" || test -d "/dev/.udev"; then
   22     cat 1>&2 <<EOF
   23 $zero Error: udev detected.  You shouldn't need to use $zero.
   24 $zero: Please see the aoe-mkshelf manpage.
   25 $zero: Exiting.
   26 EOF
   27     exit 1
   28 fi
   29 
   30 n_partitions=${n_partitions:-16}
   31 dir=$1
   32 shelf=$2
   33 nslots=@npershelf@
   34 maxslot=$(($nslots - 1))
   35 MAJOR=152
   36 
   37 set -e
   38 
   39 minor=$(($nslots * $shelf * $n_partitions))
   40 endp=$(($n_partitions - 1))
   41 for slot in `seq 0 $maxslot`; do
   42     for part in `seq 0 $endp`; do
   43         name=e$shelf.$slot
   44         test "$part" != "0" && name=${name}p$part
   45         rm -f $dir/$name
   46         mknod -m 0660 $dir/$name b $MAJOR $minor
   47 
   48         minor=`expr $minor + 1`
   49     done
   50 done