Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to get a program to work that isn't in my distro's package manager. It doesn't provide a makefile or sources, just binaries. If I copy the whole folder to /usr/local and then add that to my PATH in .bashrc, I can execute the program but there are problems. The program requires some local files from its directory, and they are stored as a relative path. The program looks for the files in the directory I'm currently in, not the directory that the program itself is in. Is there any way around this? Thanks.

share|improve this question
add comment

2 Answers

If the program is really so unfriendly as to expect you to run it only from it's own directory then you may have to leave it in it's own directory (including sub folders) and create a script which is on your PATH. This script will change directories to the location of the program and run it. All will be well. Well... well enough. Something like:

#! /bin/sh -
cd /usr/local/crudesoftware &&
./theprogram  
share|improve this answer
add comment

Many programs use environment variables that are unique to themselves.  For example, a program called foo might look for an environment variable called FOO_DIR or FOO_DATA_PATH (and it might use the current directory as a default if the variable isn’t set).  I know you said that you don’t have source, but do you have any documentation?  Maybe a sample .bashrc for using the program?

As a last resort, try

strings foo

(assuming that foo is the name of the program).  This lists all the “strings” in the binary file (see strings(1) for details).  This will produce a lot of output; much of it gibberish.  You should probably pipe it into a pager; e.g., more or less.  Look for lines that look like environment variable names –– i.e., all caps, possibly including underscores –– and try setting them to the directory where you installed the program.

share|improve this answer
    
Thanks, I'll look for environment variables. –  user2102873 Mar 12 '13 at 2:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.