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
12 # start creating symlinks
13 for i
in /dev
/cd
/cdrom-
*; do
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
21 for i
in /dev
/cd
/cdrw-
*; do
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
29 for i
in /dev
/cd
/dvd-
*; do
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
37 for i
in /dev
/cd
/dvdrw-
*; do
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