LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Puppy (https://www.linuxquestions.org/questions/puppy-71/)
-   -   Check for prescense of CD/DVD (https://www.linuxquestions.org/questions/puppy-71/check-for-prescense-of-cd-dvd-4175549193/)

rokytnji 07-29-2015 08:25 AM

Rox Desktop Icons on a JWM window manager auto mounting a icon for a text editor? Or auto mounting a icon period for a cd disk inserted and running?

http://www.murga-linux.com/puppy/viewtopic.php?t=50845

rokytnji 07-29-2015 08:27 AM

Quote:

Then it should mount OK this must be a puppy linux thing, which I can't help you with, its probably just a permissions thing, you may need to add yourself to a specific group to be able to mount cdroms eg group 'cdrom'.
Try mounting it manually and see what happens.
Puppy is a single user system by default and runs as root unless spot or fido is used to launch applications as a user.
Non of that maybe applies in this thread as nothing mentioned as running as user spot or fido.

Fixit7 07-29-2015 08:46 AM

This works.

But how can I have a script check for 'no disk' and perform an action based on that info ?

Quote:

# cddetect_quick -d/dev/sr0
no disc

michaelk 07-29-2015 08:53 AM

Something like

Code:

  cd_chk=$( cddetect_quick -d /dev/sr0 )
  if [[ $cd_chk == "no disc" ]]; then
    do something here
  fi


Fixit7 07-29-2015 09:18 AM

Thanks.

This works except for the thunar line.

The CD drive is mounted but no files are shown in /mnt/sr0.

Quote:

cd_chk=$( cddetect_quick -d /dev/sr0 )

if [[ $cd_chk == "no disc" ]]; then
echo "No CD/DVD in drive !!"
exit
fi

if [[ $cd_chk == "disc inserted" ]]; then
echo "CD/DVD is in drive."
thunar /mnt/sr0/
fi

michaelk 07-29-2015 09:40 AM

Not sure I understand, thunar is not opening a new window /mnt/sr0 or it is and your not seeing any files?

According to the man page the URI is specified with file: i.e.

thunar file:/mnt/sr0

Fixit7 07-29-2015 09:50 AM

I tried thunar file:/mnt/sr0 and it also did not show any files.

I will see if Rox Filer command will show the files.

rox /mnt/sr0/ does not show any files either.

michaelk 07-29-2015 10:07 AM

Are you sure the disc is mounted?

Fixit7 07-29-2015 01:19 PM

My final version.

Quote:

#!/bin/bash
# Display content of CD or DVD
#
# Linux Puppy 5.9.3
# SiegeWorks 2015 A.P.K.
#
# Help from rcrsn51,Flash,michaelk,01micko,
#
cd_chk=$( cddetect_quick -d /dev/sr0 )

if [[ $cd_chk == "no disc" ]]; then
echo "No CD/DVD in drive !!"
gxmessage -timeout 2 "No CD/DVD in drive !!"
exit
fi

if [[ $cd_chk == "disc inserted" ]]; then
echo "CD/DVD is in drive."
mkdir -p /mnt/sr0
mount -t iso9660 /dev/sr0 /mnt/sr0
thunar /mnt/sr0/
fi



All times are GMT -5. The time now is 05:31 PM.