[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Installing and locating scripts
- From: Craig Barnes <craigbarnes85@...>
- Date: Sun, 3 Mar 2013 23:26:25 +0000
On 3 March 2013 22:36, Rena <hyperhacker@gmail.com> wrote:
> So, I've been developing some small applications in Lua, and one issue
> that's come to light is once my app is installed, if it's made up of
> more than one script, the main 'executable' script needs to know where
> to find the other scripts.
> It's enough to use os.getenv('PWD') .. arg[0] during testing, but that
> won't work if the script is in the $PATH. Unfortunately my
> understanding is there's no standard way to determine the current path
> of the executable.
>
> I'm also not sure what is the best practice when it comes to
> installing a program that consists of several files (the main
> executable and several sub-scripts it includes) on a Linux system.
> With a compiled language you can split your source code into as many
> files as you like and still produce a single compiled binary, but with
> Lua all those individual files *are* your "binary".
>
> Should I just install the main script in the usual place
> (/usr/local/bin or /usr/bin), the additional scripts in some other
> standard place (/usr[/local]/share/appname/?), and have it try to find
> them in those standard places? Or is there a better way to handle
> this?
>
The standard place to install arch-independent files specific to one
application is /usr/local/share/$APPNAME/. Normally, only system
packages install under /usr/share. If someone packages your app for
a distribution, they'll use whatever method you provide for changing
the install prefix (generally a PREFIX variable in a Makefile).