cleaned up code for selecting GRUB_PC class
[fai-configs.git] / scripts / FAIBASE / 20-removable_media
CommitLineData
2d1f8014 1#! /bin/bash
2
3# (c) Thomas Lange, 2006,2009, lange@debian.org
4# create entries for removable media in fstab and directories in /media
5
6[ -b $target/dev/fd0 ] && ainsl $target/etc/fstab "/dev/fd0 /media/floppy auto users,noauto 0 0"
7
8cdromlist() {
9 [ -f /proc/sys/dev/cdrom/info ] || return
10 devs=$(grep 'drive name:' /proc/sys/dev/cdrom/info | cut -d ":" -f 2)
11 for d in $devs; do
12 echo $d
13 done
14}
15
16fstabline () {
17 line=$(printf "%-15s %-15s %-7s %-15s %-7s %s\n" "$1" "$2" "$3" "$4" "$5" "$6")
18 ainsl $target/etc/fstab "$line"
19}
20
21i=0
22for cdrom in $(cdromlist | tac); do
23 [ $i -eq 0 ] && ln -s cdrom0 $target/media/cdrom
24 mkdir -p $target/media/cdrom$i
25 fstabline /dev/$cdrom /media/cdrom$i udf,iso9660 ro,user,noauto 0 0
26 i=$(($i + 1))
27done