summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-system/udev_link.sh
blob: 45038e9e9050eb9b629c6e2addcf79b28c67fdc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
my_base=$1
dev_name=$2
#DEVNAME=/dev/dvb/adapter2/frontend0
#DVB_ADAPTER_NUM=2

lndir=`dirname $dev_name`
for clink in `ls -d /dev/dvb/adapter_*`
do
   if [ `readlink $clink` == $lndir ]
   then
       echo "link is already present $clink"
       exit 0
   fi
done
mkdir -p /dev/vstatic
for i in 1 2 3 4
do
    if [ $i -eq 1 ]
    then
        mydir="/dev/dvb/adapter_${my_base}"
    else
        mydir="/dev/dvb/adapter_${my_base}-$i"
    fi
    if [ ! -e $mydir ]
    then
        ln -s $lndir  $mydir
        exit 0
    else
        echo "dvb $mydir already exists"
    fi
done
exit 0