Installing an application of Arch linux tar.xz in /opt

Unix & Linux Asked by cantik memekmu on January 5, 2022

How do we install application of Arch Linux tar.xz in /opt directory rather than the default location? (maybe /usr/bin or etc.)

2 Answers

So the "cleanest" way to do this is what @Rayleigh suggested: to edit the PKGBUILD of the package in question and edit it to install its files to /opt rather than somewhere else.

This process is different for every package, so without knowing which specific packages you're looking at I cannot give you more concrete advice than to look at the PKGBUILD documentation and that the code you're looking to edit is probably in the package() section.

After you've succesfully edited the PKGBUILD file in question you can then create a package from it using makepkg(doc) and you can then go on to install these packages like you normally would in pacman.

If you rather would not go through these steps, you could also edit the package files themselves, as they are merely tarballs containing the files to be installed, and some extra metadata files. To do this you can update the archive to rename any toplevel directories to opt instead. You will also need to update the .MTREE file using bsdtar --format=mtree.

You can then install the edited package as you would normally using pacman.

Note that both methods will be required for every update though, so it's a lot of work for something that goes against the Arch Linux packaging guidelines.

If you tell us which packages you are referring to, and why you want to achieve this, I can give more specific and possibly more useful advice.

Answered by MadeOfMagicAndWires on January 5, 2022

I do not endorse this behavior. This method is for Academic Purposes only. Always install packages through pacman if possible.

A package in Arch Linux consist of a few files (not always) and a PKGBUILD file. Modifying the PKGBUILD accordingly can enable the possibility of a different installation path.

To find the PKGBUILD go to the Arch Linux website, find your package and on the top left corner under Package Actions Click "Source Files".

enter image description here

Answered by Rayleigh on January 5, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP