You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

!nkubus

Beginner

  • "!nkubus" started this thread

Posts: 17

Location: Montreal

Occupation: Internet Solution Manager @ Bell

  • Send private message

1

Sunday, September 12th 2004, 7:15pm

need help with a bash script

i don't know if i'm on the right place.

but i'm a linux/kde user since about 1year and a half.

Lately i have been jealous to see gnome-volume-manager so i have started to play a bit with hotplug to make my own usb-storage and usbcam mounter that will interact with KDE.

i have been able by modifiying /etc/hotplug/usb.agent and by creating /usb/hotplug/usb-storage (wich is automatically called by hotplug deamon when a usb-torage device is plugged in). now in this script i want to warn the user so i have created some application that are configurable and that will help the kde user to know that those devices are configured and ready to use. but in my script i want to call my application with the users permissions not the root permission because i have some config files in the home, and of course for security reason.

here is the end of my script:
[code:1]

#execute the message box as a user. connected on :0
echo "#!/bin/sh" > /tmp/kdialog_cmd
echo "kdialog --msgbox \"usb-srorage detected mounted in your Storage Devices\"" >> /tmp/kdialog_cmd
chmod a+x /tmp/kdialog_cmd
su $(who | grep ":0" | awk '{print $1}') -c /tmp/kdialog_cmd

[/code:1]

so basically what i do here is i create a temp file and put the message box line in and change the permission then run it with the current user connected to X.

the script works flawlessly when i'm starting by hand but when , it's hotplug Deamon that call the script every other actions are done exept the part when i'm trying to sho the use a message box (eventually it wil be my little software).

so i'm a bit lost in all that at the moment.

so any help will be apreciated.

the distribution i use is called Munjoy (http://www.munjoylinux.org) linux wich is a derivate of Knoppix.



if i'm not at the right place please don't flame me and tell me where i should post thoses kind of messages.

thanks :).

sorry for my english i'm french from Montreal ...[/url]

Amoeba

Trainee

Posts: 115

Location: http://seattle.wa.u$

Occupation: Urban guerilla

  • Send private message

2

Sunday, September 12th 2004, 7:38pm

I'm no bash expert, but I can suggest one thing. Take this post and post it on http://forums.gentoo.org. Even if you're not a gentoo user, the gentoo forums is full of bash geeks willing to help...

Is French the primary language in Quebec?
-- rm -fr /etc/whitehouse
-- Gentoo | udev | Xorg 6.8.2 | 2.6.14-r4 | KDE 3.5.0

!nkubus

Beginner

  • "!nkubus" started this thread

Posts: 17

Location: Montreal

Occupation: Internet Solution Manager @ Bell

  • Send private message

3

Sunday, September 12th 2004, 7:41pm

Quoted


Is French the primary language in Quebec?


yes it is :)

so this i why my englis is a bit quirky ;)

thaks for your help i'll try the gentoo forum :)

Amoeba

Trainee

Posts: 115

Location: http://seattle.wa.u$

Occupation: Urban guerilla

  • Send private message

4

Sunday, September 12th 2004, 7:49pm

Well I'll be damned. I had no idea French was the primary. I thought it was taught side by side with english.

Make sure you post your bash question in the forum labeled "Other Things Gentoo" or "Off the Wall".. The latter might be the better place.
-- rm -fr /etc/whitehouse
-- Gentoo | udev | Xorg 6.8.2 | 2.6.14-r4 | KDE 3.5.0

!nkubus

Beginner

  • "!nkubus" started this thread

Posts: 17

Location: Montreal

Occupation: Internet Solution Manager @ Bell

  • Send private message

5

Sunday, September 12th 2004, 7:52pm

ooops i have putted in portage and programming :S

6

Sunday, September 12th 2004, 11:01pm

Instead of using the'su' command, can you change the user permission on the script.......replacing the 'su' command with the following: [code:1]chown $(who | awk '/:0/ {print $1}') /tmp/kdialog_cmd
[/code:1]
Note, there is a drawback using the 'who' command for finding the user........if the username is more than eight characters, it will be shortened to exactly eight characters.......Maybe using the $USER variable would be a better solution.........

:)
How long a minute is depends on which side of the bathroom door you're on.

!nkubus

Beginner

  • "!nkubus" started this thread

Posts: 17

Location: Montreal

Occupation: Internet Solution Manager @ Bell

  • Send private message

7

Monday, September 13th 2004, 4:15am

thank you very much for your help, the problem with the $USER variable is that the current user is root when the kernel runs the script. what i want is to run the script with the current user connected to :0.

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

8

Monday, September 13th 2004, 7:21pm

A friend of mine showed a script like this (mounting and copying images from a usb-storage digicam) on Grazer Linuxtage 04 (www.linuxtage.at)

direct links to his scripts:
http://glt04.linuxtage.at/slides/usb-storage
http://glt04.linuxtage.at/slides/usb-storage-helper

Additionally someone is working on a KDE volume manager:

http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdenonbeta/kvm/README?rev=1.6&content-type=text/x-cvsweb-markup

Cheers,
_
Qt/KDE Developer
Debian User

!nkubus

Beginner

  • "!nkubus" started this thread

Posts: 17

Location: Montreal

Occupation: Internet Solution Manager @ Bell

  • Send private message

9

Monday, September 13th 2004, 7:59pm

Very nice from you :)

i'm gonna check this :)

!nkubus

Beginner

  • "!nkubus" started this thread

Posts: 17

Location: Montreal

Occupation: Internet Solution Manager @ Bell

  • Send private message

10

Monday, September 13th 2004, 10:45pm

it works now with the help of the script your fiend is doing :)

i only had to set the export DISPLAU = :0.0 into the file and everything was fien :)


thank you very much i apreciate it very much