updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / udev-old-kernel / cdsymlinks.sh
blob498abda4acc874bbea904b38ff27c61b9b4ce232
1 #! /bin/sh
2 # Creates cdsymlinks in /dev
3 # for Archlinux by Tobias Powalowski <tpowa@archlinux.org>
5 # check on cd/dvd drives and if persistant rules file is used
6 if [ -d /dev/cd -a ! -e /etc/udev/rules.d/75-persistent-cd.rules ]; then
7 # remove existing device files
8 rm /dev/cdrom*
9 rm /dev/cdrw*
10 rm /dev/dvd*
11 rm /dev/dvdrw*
12 # start creating symlinks
13 for i in /dev/cd/cdrom-*; do
14 if [ -h $i ]; then
15 [ "$CD_NUMBER" = "" ] && ln -s $i /dev/cdrom
16 [ "$CD_NUMBER" = "" ] && CD_NUMBER="-1"
17 ! [ "$CD_NUMBER" = "" ] && CD_NUMBER="$((CD_NUMBER+1))" && ln -s $i /dev/cdrom$CD_NUMBER
19 done
21 for i in /dev/cd/cdrw-*; do
22 if [ -h $i ]; then
23 [ "$CDRW_NUMBER" = "" ] && ln -s $i /dev/cdrw
24 [ "$CDRW_NUMBER" = "" ] && CDRW_NUMBER="-1"
25 ! [ "$CDRW_NUMBER" = "" ] && CDRW_NUMBER="$((CDRW_NUMBER+1))" && ln -s $i /dev/cdrw$CDRW_NUMBER
27 done
29 for i in /dev/cd/dvd-*; do
30 if [ -h $i ]; then
31 [ "$DVD_NUMBER" = "" ] && ln -s $i /dev/dvd
32 [ "$DVD_NUMBER" = "" ] && DVD_NUMBER="-1"
33 ! [ "$DVD_NUMBER" = "" ] && DVD_NUMBER="$((DVD_NUMBER+1))" && ln -s $i /dev/dvd$DVD_NUMBER
35 done
37 for i in /dev/cd/dvdrw-*; do
38 if [ -h $i ]; then
39 [ "$DVDRW_NUMBER" = "" ] && ln -s $i /dev/dvdrw
40 [ "$DVDRW_NUMBER" = "" ] && DVDRW_NUMBER="-1"
41 ! [ "$DVDRW_NUMBER" = "" ] && DVDRW_NUMBER="$((DVDRW_NUMBER+1))" && ln -s $i /dev/dvdrw$DVDRW_NUMBER
43 done