views:

320

answers:

1

I've created a ubuntu/debian package that installs an application that depends on R. When installing I want the package to install R from the repository at:

deb http://cran.uk.r-project.org/bin/linux/ubuntu jaunty/

because this repository contains the up to date version of R. I've tried adding the package to the sources.list file from the packages preinst script but it doesn't seem to work.

Any ideas how I can force the use of this repository?

+1  A: 

You really should not install other packages from the preinst script. This makes it impossible for apt or dpkg to figure out the package dependencies. The correct way is to state the up-to-date version as a dependency in the debian/control file:

Depends: R (>= x.y)

For example:

Depends: libapr0 (>= 2.0.54)

This may mean that the package is uninstallable for users that do not add the other repository as well; you should inform them of the other repository through other channels. Or you could consider including the package in your repository.

Bruno De Fraine
I didn't mean actually installing the package from the preinst script, just adding the other repository that contains the up to date version of R. My preinst script looks like this:#!/bin/sh# add the repository for the new version of Recho "deb http://cran.uk.r-project.org/bin/linux/ubuntu jaunty/" | sudo tee -a /etc/apt/sources.listsudo apt-get updateWhen the package was installed, R was still downloaded from the normal repository though and the sources.list was unchanged for some reason.
It appears that my preinst script has appeared all on one line above, it should be split over 4.