#!/bin/bash

for ITEM in `ls -1 /dev/dvb/` ; do
    mv /dev/dvb/$ITEM /dev/dvb/.$ITEM
done

COUNT=0
for ITEM in `find '/sys/devices/pci0000:00/' -regex '.*dvb[0-9]+\.[a-z0-9]+$' | sed -e 's/\(^.*\)\..*$/\1/' | sort | uniq` ; do
    ADAPTER=`echo $ITEM | sed -e 's/^.*dvb//'`
    mv /dev/dvb/.adapter$ADAPTER /dev/dvb/adapter$COUNT
    let COUNT=$COUNT+1
done
