summaryrefslogtreecommitdiffstats
path: root/main/busybox-initscripts/dvbdev
blob: f0186c176cd8003605e84b7648f498fcb6723b96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# MDEV=dvb0.demux1 -> ADAPTER=dvb0 -> N=0
ADAPTER=${MDEV%.*}
N=${ADAPTER#dvb}
# MDEV=dvb0.demux1 -> DEVB_DEV=demux1
DVB_DEV=${MDEV#*.}

case "$ACTION" in
	add|"")
		mkdir -p dvb/adapter${N}
		mv ${MDEV} dvb/adapter${N}/${DVB_DEV}
		;;
	remove)
		rm -f dvb/adapter${N}/${DVB_DEV}
		rmdir dvb/adapter${N} 2>/dev/null
		rmdir dvb/ 2>/dev/null
esac