Installing a program on Linux: providing a short command

1

Suppose you're distributing a program to run on Linux, call it Foo, and the program executable is called foo.exe (because it's a CLR program so it runs under Mono) and it needs a couple of DLLs in the same directory and maybe a later version might need some data files that it reads on startup and whatever, so relocating it to a global bin directory is a bit of hassle and it really prefers to remain in its original directory...

But the user would prefer to invoke the program by typing foo instead of mono /path/to/foo.exe.

What's the best/most usual way to provide such a short command? Can/should an install script/makefile create a one line script called foo that invokes the full path, and put the one line script in a global bin directory? If so, what should be the target bin directory, and are there any directions about exactly how to do this? Or is there a preferred alternative?

edit: The approach of creating a one line script at install time seems to work well, here's the actual install script I ended up writing:

a@a-desktop:~/ayane$ cat install.sh 
#!/bin/sh
echo mono `pwd`/ayane.exe '"$@"' >ayane
chmod +x ayane
mv ayane /usr/local/bin

rwallace

Posted 2010-05-30T16:33:05.460

Reputation: 2 021

Answers

3

I would put a link or a script in /usr/local/bin

A link if all you need to do to start foo.exe is to type the full path /my/path/foo.exe. You on the other hand would need a small shell script that calls mono /path/to/foo.exe.

Nifle

Posted 2010-05-30T16:33:05.460

Reputation: 31 337

2

Use an alias

put something like

alias foo='mono /path/to/foo.exe'

into the users shell initialisation file.

user35787

Posted 2010-05-30T16:33:05.460

Reputation:

1

I would use the Filesystem Hierarchy Standard as a guide and install your package in /opt/package_name and place your wrapper script in /usr/local/bin or allow the user to configure these choices and generate the wrapper script at install-time based on those choices. An alternative would be to put the wrapper script in the same directory as the application and add the application directory to PATH in /etc/profile, but I consider this less desirable.

Paused until further notice.

Posted 2010-05-30T16:33:05.460

Reputation: 86 075

0

The simplest way is with a Bash alias. I'm not sure if it's normal practice to add an alias to profile files though.

Nerdfest

Posted 2010-05-30T16:33:05.460

Reputation: 808