1 Answer
1

A debian package needs to be compliant to the FHS, that clearly defines where to put data and where to install applications on any system. This clear structure makes administration easy and we all should stick to that.

In your case, when it comes to testing applications an installation to a custom directory may be desired. However there is no way to tell your package manager not to use the predefined file locations from an exisiting DEB package.

If you need an installation to another location you may need to compile your package from source, as you already pointed out. Alternatively, and if you need to use dpkg you will have to build your own private DEB where you can define other installation paths. If however the application relies on access to files located on a FHS-compliant path it may not run the way developers intended.

For installing testing versions of applications you may consider a chroot (or schroot) environment. The safest solution (though maybe overkill) for testing is installing applications in a virtual OS (e.g. through Virtual Box)

Thanks. On further looking to 'man dpkg', I saw this and yet to evaluate. --instdir=dir Change default installation directory which refers to the directory where packages are to be installed. instdir is also the directory passed to chroot(2) before running package's installation scripts, which means that the scripts see instdir as a root directory. (Defaults to /).
–
JamessFeb 5 '11 at 10:19

I tried to install an already existing package using this switch and I could not do it since the dpkg -i command detected my old package and warned me. Something like "Preparing to replace "foo" with foo.deb". So looks like source compile is the only way
–
JamessFeb 5 '11 at 10:28

1

--instdir works and dumps the files to my directory. But this is not much useful in practise. This expects a chrooted environment. If I have a chrooted setup in this directory, I can use 'sudo chroot mydir' and use it.
–
JamessFeb 5 '11 at 10:44