You are not logged in.

#1 2012-11-01 11:59:42

panosk
Member
From: Athens, Greece
Registered: 2008-10-29
Posts: 241

Install in /usr or /opt?

I have created a package for a rather largish software framework. Right now I install the package in /usr, but the problem is that there is a scripts directory that must be placed in the same directory where /bin is, so this directory is created and installed also in /usr. I'm pretty sure this is not good practice, so I was thinking if it is better to install the whole thing in /opt and then export the path to the executables.

I'd appreciate your input.

Panos

Edit: Removed package and replaced it with another version in AUR.

Last edited by panosk (2012-11-02 06:48:02)

Offline

#2 2012-11-01 12:38:05

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,440
Website

Re: Install in /usr or /opt?

If the scripts directory needs to be in the bin directory, then /opt sounds fine. Alternatively, I think it'd be fine to store it all under /usr/share/moses. Either way, you can create a tiny script to put into /usr/bin that will launch the application.

...Aaaactually, according to the Wikipedia page for the Filesystem Hierarchy Standard, it looks like /opt might be better if there's no other option.

Actually, I don't know. tongue

Have you read all of the compile time options? Is it possible to put the other files into another location, such as /usr/share/moses?

Also, Moses has a great logo.

Offline

#3 2012-11-01 13:15:31

panosk
Member
From: Athens, Greece
Registered: 2008-10-29
Posts: 241

Re: Install in /usr or /opt?

drcouzelis wrote:

If the scripts directory needs to be in the bin directory, then /opt sounds fine. Alternatively, I think it'd be fine to store it all under /usr/share/moses. Either way, you can create a tiny script to put into /usr/bin that will launch the application.

...Aaaactually, according to the Wikipedia page for the Filesystem Hierarchy Standard, it looks like /opt might be better if there's no other option.

Actually, I don't know. tongue

Have you read all of the compile time options? Is it possible to put the other files into another location, such as /usr/share/moses?

Also, Moses has a great logo.

I think /opt is the right place then as anywhere else would be too messy. Placing scripts or symlinks in /usr/bin is not an option because there are many executables that are used for various purposes, in different instances, and by different sub-applications...

And this brings the next question: What's the best way to add the app's bin PATH? Placing a script in /etc/profile.d/ maybe?

Thanks.

Offline

#4 2012-11-01 13:33:49

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,619

Re: Install in /usr or /opt?

According to the FHS, I don't think /usr/share is the appropriate location:

The /usr/share hierarchy is for all read-only architecture independent data files.

I completely fail to understand the issue with the scripts directory though.  If it is supposed to be placed in the same directory as /bin, doesn't that mean it needs to be placed in / ?  And if it's really just a matter of it needing to be in the $PATH, why is amending the $PATH the second choice?


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2012-11-01 13:49:56

panosk
Member
From: Athens, Greece
Registered: 2008-10-29
Posts: 241

Re: Install in /usr or /opt?

alphaniner wrote:

According to the FHS, I don't think /usr/share is the appropriate location:

The /usr/share hierarchy is for all read-only architecture independent data files.

I completely fail to understand the issue with the scripts directory though.  If it is supposed to be placed in the same directory as /bin, doesn't that mean it needs to be placed in / ?  And if it's really just a matter of it needing to be in the $PATH, why is amending the $PATH the second choice?

By /bin I mean the application's /bin directory. That is, during installation, if the application doesn't find the /bin, /lib, and (optionally if I include the relevant config switch) /include directories, then it creates them automatically. The scripts directory needs to be placed in the same directory where the application's /bin is found (currently this is /usr/bin, so the scripts dir is installed in /usr/scripts). As for the PATH, I'm not sure I understand. The scripts PATH is different than the application's executables (/bin) PATH. The problem is that some scripts inside the Scripts directory do an awkward directory walk (something like "../bin/some-moses-executable")  and that's why the need for this particular structure.

Offline

#6 2012-11-01 14:01:23

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,619

Re: Install in /usr or /opt?

OK, I clearly don't understand what's going on here, so I'll bow out rather than confuse things further.

But if I may make a suggestion, I think it's very bad practice to use '/bin' to refer to anything other than the bin directory at the root of the filesystem.  Same for /lib, etc.

Last edited by alphaniner (2012-11-01 14:02:32)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#7 2012-11-01 14:20:08

panosk
Member
From: Athens, Greece
Registered: 2008-10-29
Posts: 241

Re: Install in /usr or /opt?

alphaniner wrote:

OK, I clearly don't understand what's going on here, so I'll bow out rather than confuse things further.

But if I may make a suggestion, I think it's very bad practice to use '/bin' to refer to anything other than the bin directory at the root of the filesystem.  Same for /lib, etc.

OK, I understand your confusion with "/bin". I should have left out the "/" then smile.

As for the directory structure, here is the build command in my PKGBUILD:

./bjam --prefix=$pkgdir/usr debug-symbols=off \
	 --with-irstlm=/opt/irstlm \
	 --install-scripts=$pkgdir/usr/moses-scripts

If you replace it with this

./bjam --prefix=$pkgdir/opt/moses debug-symbols=off \
	 --with-irstlm=/opt/irstlm \
	 --install-scripts=$pkgdir/opt/moses/moses-scripts

then the application will be installed in this directory structure:

/opt/moses/bin
/opt/moses/lib
/opt/moses/moses-scripts

Now, when some scripts run from inside the moses-scripts and do their directory walk ("../bin/some-moses-executable") everything will be fine.

I hope I gave you more clues now.

Offline

#8 2012-11-01 15:10:16

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,440
Website

Re: Install in /usr or /opt?

panosk wrote:
./bjam --prefix=$pkgdir/opt/moses debug-symbols=off \
	 --with-irstlm=/opt/irstlm \
	 --install-scripts=$pkgdir/opt/moses/moses-scripts

then the application will be installed in this directory structure:

/opt/moses/bin
/opt/moses/lib
/opt/moses/moses-scripts

Wait a minute... Why don't you just set prefix to "/usr" and put the install scripts in "/usr/share/moses-scripts"?

Edit for clarity: If bjam is smart enough to be able to change the location of the moses-scripts files, and if it includes the option to set the location of the moses-scripts files, then isn't it able to setup and install and use the moses-script files from anywhere? Did the developers really hard code the "../bin" type commands?

Last edited by drcouzelis (2012-11-01 15:14:16)

Offline

#9 2012-11-01 15:25:50

panosk
Member
From: Athens, Greece
Registered: 2008-10-29
Posts: 241

Re: Install in /usr or /opt?

drcouzelis wrote:
panosk wrote:
./bjam --prefix=$pkgdir/opt/moses debug-symbols=off \
	 --with-irstlm=/opt/irstlm \
	 --install-scripts=$pkgdir/opt/moses/moses-scripts

then the application will be installed in this directory structure:

/opt/moses/bin
/opt/moses/lib
/opt/moses/moses-scripts

Wait a minute... Why don't you just set prefix to "/usr" and put the install scripts in "/usr/share/moses-scripts"?

Edit for clarity: If bjam is smart enough to be able to change the location of the moses-scripts files, and if it includes the option to set the location of the moses-scripts files, then isn't it able to setup and install and use the moses-script files from anywhere? Did the developers really hard code the "../bin" type commands?


Nope, some perl scripts have a lot of variables that point to "$SCRIPTS_ROOTDIR/../bin/some-executable". bjam works fine and places the scripts wherever you tell it to. This is actually an option mentioned in the software's installation instructions. Of course this contradicts the required directory structure but I have already sent a mail to their mailing list asking to fix this.

Offline

#10 2012-11-02 06:51:11

panosk
Member
From: Athens, Greece
Registered: 2008-10-29
Posts: 241

Re: Install in /usr or /opt?

I finally decided to install everything in /opt and add a script to /etc/profile.d/ that sets the PATH for the application's bin folder (the new package is https://aur.archlinux.org/packages.php?ID=64202).

Thank you for your suggestions.

Offline

Board footer

Powered by FluxBB