This repository has been archived on 2024-05-18. You can view files and clone it, but cannot push or open issues or pull requests.
soifai/config/scripts/FAIBASE/20-removable_media

26 lines
675 B
Bash
Executable File

#! /bin/bash
# (c) Thomas Lange, 2006,2009, lange@debian.org
# create entries for removable media in fstab and directories in /media
cdromlist() {
[ -f /proc/sys/dev/cdrom/info ] || return
devs=$(grep 'drive name:' /proc/sys/dev/cdrom/info | cut -d ":" -f 2)
for d in $devs; do
echo $d
done
}
fstabline () {
line=$(printf "%-15s %-15s %-7s %-15s %-7s %s\n" "$1" "$2" "$3" "$4" "$5" "$6")
ainsl /etc/fstab "$line"
}
i=0
for cdrom in $(cdromlist | tac); do
[ $i -eq 0 ] && ln -sfn cdrom0 $target/media/cdrom
mkdir -p $target/media/cdrom$i
fstabline /dev/$cdrom /media/cdrom$i udf,iso9660 ro,user,noauto 0 0
i=$((i + 1))
done