You are not logged in.

#1 2008-11-18 22:27:31

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

[SOLVED] Bash scripts to mount & unmount optical drive in Worker?

I'm running XFCE on Arch with the HAL daemon being called in /etc/rc.conf.

I can access media on my optical drive (DVD's or CD's) through the desktop icon that appears after HAL has recognised the drive, VLC automatically does its thing as does NeroLinux.

The reason I'm posting is that I found a great DOpus clone yesterday called Worker - http://www.boomerangsworld.de/cms/worker/index?lang=en, which I am in the process of configuring.

A problem I have is being able to access the optical drive via Worker.

The way it is on my system, with HAL handling it, the first line (see below) appears after HAL mounts the media, which basically makes the two lines below it useless:

/media/<title of disk>
/media/cd
/media/dvd

I have tried configuring Worker to use /media/dvd (or cd), to access the optical media, these don't work for the reason stated above, & /dev/sd0 doesn't work either.

So, do I have to turn off HAL, uncomment the lines in fstab & use mount?

A little bash script, that would do the job for me would be great, as Worker will accept a script or a command string.

I am a bash baby, so if someone can see a solution please post it?

All input welcome.

Thanks.

Last edited by handy (2008-11-19 04:11:02)


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#2 2008-11-18 23:32:47

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Bash scripts to mount & unmount optical drive in Worker?

Having removed hal from the rc.conf  daemons call, I can use the following code to mount the dvd:

sudo mount /mnt/dvd

So now the use of sudo in a script becomes my problem.

Is it possible to make the optical group not need a password using visudo?


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#3 2008-11-18 23:57:39

Zariel
Member
Registered: 2008-10-07
Posts: 446

Re: [SOLVED] Bash scripts to mount & unmount optical drive in Worker?

i guess something like this?

%optical ALL=(ALL) NOPASSWD: ALL

Offline

#4 2008-11-19 01:04:58

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Bash scripts to mount & unmount optical drive in Worker?

Zariel wrote:

i guess something like this?

%optical ALL=(ALL) NOPASSWD: ALL

I found the clues for this in the sudoers manual:

handy   ALL = NOPASSWD: /sbin/umount /CDROM,\
                /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM

Which works in so far as now mounting no longer needs the password.

Which leaves me with the problem of trying to understand how to get Worker to mount the optical drive on command.

If I enter the bash command in the Terminal as follows:

mount /mnt/dvd

the media is mounted, after which I can push the button in Worker, which I have configured with:

/mnt/dvd

& the root list of the optical media is displayed in the active panel of Worker.

I just haven't been able to get Worker to use "mount /mnt/dvd" yet, there will be a way, I wonder how long it will take me to find it? lol

Last edited by handy (2008-11-19 06:48:09)


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#5 2008-11-19 02:00:36

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Bash scripts to mount & unmount optical drive in Worker?

An easy solution is to make a couple of simple executable scripts & call them from buttons Mount & uMount, using the Add Command / Own Command options.

The simple mount script without the need for sudo:

#!/bin/sh
# ~/mountdvd.sh mounts the optical drive
# via the Mount button in Worker.

cd /
mount /mnt/dvd

I think that there may probably be a way to use a variable so that the the same 2 scripts can be used for any mountable devices?

Last edited by handy (2008-11-19 02:33:21)


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#6 2008-11-19 03:34:46

Tenken
Member
Registered: 2008-02-01
Posts: 126

Re: [SOLVED] Bash scripts to mount & unmount optical drive in Worker?

Wouldn't just adding your user to the optical group let Worker access the drive?

Offline

#7 2008-11-19 04:09:32

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Bash scripts to mount & unmount optical drive in Worker?

Tenken wrote:

Wouldn't just adding your user to the optical group let Worker access the drive?

No, my user already was in that group, & the storage group as well.

It works now, & I'm satisfied with the result.

Now I'm going through all of the other buttons, configuring them to suit. smile


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#8 2008-11-19 06:47:05

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: [SOLVED] Bash scripts to mount & unmount optical drive in Worker?

I found out that using (u)mount {F} on a selected device does the job, so my (u)mount scripts are redundant already. wink


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

Board footer

Powered by FluxBB