4
On a headless Linux server (latest fedora if this is of interest), how can I detect that the inserted optical disk is an audio disk, as opposed to a data disk or a video DVD? There is no desktop environment installed, and I would prefer not to install one.
What I can see is that mounting fails, but I guess that could also be the case for a corrupt data disk:
[root@server ~]# mount /dev/sr0 /mnt/cdrom
mount: /dev/sr0 is write-protected, mounting read-only
mount: /dev/sr0: can't read superblock
[root@server ~]# echo $?
32
Any suggestions?
If you want to use it in a script, redirect stdout and stderr to
/dev/null
, and use the return value - 0 (success) if there's a disk, or non-zero (failure) otherwise. – Toby Speight – 2016-04-28T16:06:01.127