Installing packages to a specific directory

Hello to everyone at the Manjaro forums! Keen to be here! :grinning_face_with_smiling_eyes:

I want to install a package in a different location. I have tried various commands like sudo pacman -S <package_name> --root /chosen/directory/ and sudo pacman -S <package_name> --sysroot /chosen/directory/, but they both donā€™t do what I want them to.

I only want to install one particular package (and maybe its immediate dependencies) to this particular location, since I donā€™t want it on my main drive (the target directory is on a drive mounted at /mnt/sdb).
Is there anything I can do? A command line argument I overlooked? I have scoured the manpage, but I really canā€™t find anything.

Any help would be greatly appreciated. Thank you for your time :smiley:

Welcome to the forum!

Iā€™m afraid what you wish to do is a Windows-ism. GNU/Linux is a UNIX operating system, and UNIX doesnā€™t work that way.

The package always contains the paths to where the files from the package will be installed because UNIX is an integrated system. Once the package has been installed, its files will be distributed along the various directories of the filesystem hierarchy. So for instance, the shared libraries will always go under /usr/lib, the executables under /usr/bin, and so on.

The only exception to that rule are the games and stuff that you install through Lutris or Steam, because those are actually Windows games that have been made to run in GNU/Linux by way of a translation layer.

Now, the above all said, Snaps and Flatpaks are also different in that regard, because they are containerized applications ā”€ they are not integrated with the rest of the operating system ā”€ but even they normally have their designated directories contained in the package itself.

There is also certain third-party software that doesnā€™t come installed through the distributionā€™s package manager ā”€ although there are exceptions to that rule, e.g. Discord ā”€ and that comes with an installer of its own, usually in the form of a self-extracting archive. Those packages will then normally go under /opt, although ā”€ as I mentioned ā”€ Discord is one of those weird ones; it installs partly under /usr and partly under /opt.

4 Likes

Thank you for that explanation! Iā€™ve already learned a lot more about how UNIX systems manage packages, and explains a lot of the reasons why it looks like magic!
I guess Iā€™ll just build it from source. When building something from source, are there easy ways to overwrite and update it? Does the only way to do it by deleting the old version and building the new version in its place? Are there any ways to go around that?

what is this package ??? (source url)
it is impossible to answer without any technical information about your application !

not possible, dependencies are always in system partition (/)

why ? we install all apps in system partition (we use linux :slight_smile: ). If is a script or appimage, why not in another partition

Hi @papajoke ! Sorry, Iā€™ll be more specific about what I want to do.

So Iā€™m looking to install OpenMW - what I have been doing in the past is building it from source, placing that on my ā€˜Gamesā€™ drive (since I keep all my games on a separate mounted drive), and playing it from there. I wanted to mod it easier, so I decided to use the portmod package alongside it (which creates mod lists for OpenMW). Since OpenMW is also in the [community] repository, I thought I could maybe install openmw (from the [community] repo) in a location that I wanted, install portmod (in the AUR) alongside it, find a way of linking portmod to the OpenMW install, and I could easily keep both updated through the system package manager, and not lose all my mod lists and configuration tweaks when I did so.

So a bit of a confusing way to go, but I thought ā€œWhy not give it a try?ā€, since thereā€™s usually a way of getting things working the way that I want (So much freedom!). But by the sounds of it itā€™s not actually possible, so then Iā€™ll need to go back to building from source. But then Iā€™m wondering if there are easy ways to keep it updated without breaking stuff.

Thatā€™s the whole kaboodle of what Iā€™m trying to do :slight_smile:

Intricacies

So I know OpenMW keeps configuration files and save files and things like that in a different location, so I figure itā€™s easily possible to overwrite the source without issues. However I think Portmod (although I havenā€™t used it yet) keeps local copies of the mod files, which might likely mess things up (I reckon).
I just thought itā€™d be easier to do things through the system package manager (since the binaries are on there), but maybe doing something like this is more complex overall.

Links

Sorry, I had originally hyperlinked stuff in my post, but for some reason I canā€™t include links in my posts. So Iā€™ll just put the links separately here (formatted badly with spaces since I canā€™t include links in my posts).

Thank you :blush:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.