You are not logged in.

#1 2009-10-01 02:13:12

Aaron 'Я' God
Member
From: Toronto
Registered: 2009-07-18
Posts: 26

Using ld_preload in startup script

Hoy there, gang!

I am trying to set Skype to load once GNOME loads. I need to use the LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so work around to get my web cam working, but I have not been successful by adding that to the 'exec' portion of my skype.desktop file.

Any thoughts? Am I out of luck, and forced to use a manual Bash alias instead?

Offline

#2 2009-10-01 02:28:28

StanIsTheMan
Member
Registered: 2009-09-18
Posts: 38

Re: Using ld_preload in startup script

Have you tried adding it to your ~/.bashrc file..?

export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so

Offline

#3 2009-10-01 02:35:49

Aaron 'Я' God
Member
From: Toronto
Registered: 2009-07-18
Posts: 26

Re: Using ld_preload in startup script

Sorry, I should have been more clear.

I do have it as an alias in Bash already

alias skype='LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype'

What I am hoping to do is to have it load automatically when Gnome loads, as opposed to having to open a terminal and start it manually.

Offline

#4 2009-10-01 02:46:52

StanIsTheMan
Member
Registered: 2009-09-18
Posts: 38

Re: Using ld_preload in startup script

Instead of an alias, cant you just "export" the library upon sourcing the .bashrc on login...?

e.g.

# export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
# echo $LD_PRELOAD
/usr/lib/libv4l/v4l1compat.so

Last edited by StanIsTheMan (2009-10-01 02:48:47)

Offline

#5 2009-10-01 02:55:15

Aaron 'Я' God
Member
From: Toronto
Registered: 2009-07-18
Posts: 26

Re: Using ld_preload in startup script

How do I go about sourcing the .bashrc on login?

Offline

#6 2009-10-01 03:27:48

StanIsTheMan
Member
Registered: 2009-09-18
Posts: 38

Re: Using ld_preload in startup script

Aaron 'Я' God wrote:

How do I go about sourcing the .bashrc on login?

in your ~/ directory you should have a file called .bash_profile

Add this line:

. $HOME/.bashrc

If you don't have the file, then create it. This will source the .bashrc file upon login. Once logged in, test the source with

echo $LD_PRELOAD

It should print out the path to your *.so

Last edited by StanIsTheMan (2009-10-01 03:29:14)

Offline

#7 2009-10-01 10:43:36

Aaron 'Я' God
Member
From: Toronto
Registered: 2009-07-18
Posts: 26

Re: Using ld_preload in startup script

So, the export works. But, now the problem is with the desktop entry file:

[Desktop Entry]
Encoding=UTF-8
Version=2.1.0.47
Type=Application
Name=Skype
Name[en_CA]=Skype
Comment=Instant Messaging and Video Voice Client
Comment[en_CA]=Instant Messaging and Video Voice Client
Exec=/usr/bin/skype
StartupNotify=false
Terminal=true
Hidden=false
X-GNOME-Autostart-enabled=true

Ignore the doubles: they were created by GNOME because of my locale. With 'Terminal' set to 'true', nothing happens upon log in (that I see). If I set 'Terminal' to 'false', then Skype starts when I log in, but with no preloaded library support, of course.

Offline

#8 2009-10-01 15:07:57

neddie_seagoon
Member
Registered: 2009-08-23
Posts: 121

Re: Using ld_preload in startup script

You could also create a shell script somewhere in your home directory that simply runs skype with the LD_PRELOAD as in your alias, and modify the desktop entry to run your script instead of the skype executable directly.

Offline

#9 2009-10-01 17:46:09

StanIsTheMan
Member
Registered: 2009-09-18
Posts: 38

Re: Using ld_preload in startup script

Aaron 'Я' God wrote:

So, the export works. But, now the problem is with the desktop entry file:
Ignore the doubles: they were created by GNOME because of my locale. With 'Terminal' set to 'true', nothing happens upon log in (that I see). If I set 'Terminal' to 'false', then Skype starts when I log in, but with no preloaded library support, of course.

I agree with the previous poster on writing a script that exports the library and exec Skype. Then point the icon to the ~/bin folder in your home directory to launch Skype. Like this:

#!/bin/bash
#
#~/bin/skype_mod.sh
#
# Ensure that the LD_PRELOAD is clear
unset LD_PRELOAD

# Export LD_PRELOAD
export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so

# Execute Skype
exec /usr/bin/skype 

exit 0

### End of File ###

Now make the file executable and make sure its saved in ~/bin

$ chmod +x  skype_mod.sh

Now edit the Destop icon to point to ~/bin to load skype_mod.sh

[Desktop Entry]
Encoding=UTF-8
Version=2.1.0.47
Type=Application
Name=Skype
Name[en_CA]=Skype
Comment=Instant Messaging and Video Voice Client
Comment[en_CA]=Instant Messaging and Video Voice Client
Exec=~/bin/skype_mod.sh
StartupNotify=false
Terminal=true
Hidden=false
X-GNOME-Autostart-enabled=true

This will launch the skype_mod.sh whenever you click the icon.... If you want skype to load on startup, then point to the ~/bin/skype_mod.sh in Gnome startup Applications to launch on startup... with something like this:

(sleep 3s; ~/bin/skype_mod.sh) &

Or, you can add ~/bin to your $PATH, so in the terminal you can launch it with

$ skype_mod.sh &

Last edited by StanIsTheMan (2009-10-01 17:46:50)

Offline

#10 2009-10-01 18:33:26

Aaron 'Я' God
Member
From: Toronto
Registered: 2009-07-18
Posts: 26

Re: Using ld_preload in startup script

Thanks, you two! It seems like a really obvious solution, now...

The script works great. I did not have any luck with your

(sleep 3s; ~/bin/skype_mod.sh) &

suggestion, but I just told GNOME Autostart to load the desktop file.

Offline

#11 2009-10-01 18:41:25

StanIsTheMan
Member
Registered: 2009-09-18
Posts: 38

Re: Using ld_preload in startup script

Aaron 'Я' God wrote:

Thanks, you two! It seems like a really obvious solution, now...

The script works great. I did not have any luck with your

(sleep 3s; ~/bin/skype_mod.sh) &

suggestion, but I just told GNOME Autostart to load the desktop file.

I dont use Gnome, so I was only guessing, You can point to your ~/bin folder instead to the desktop file. like this

~/bin/skype_mod.sh

This way your always using the ~/bin, just in case the desktop file ends up missing or corrupt.

Offline

Board footer

Powered by FluxBB