Using different repo for single package

Archived topics about LMDE 1
Forum rules
chemicalfan
Level 2
Level 2
Posts: 67
Joined: Fri Mar 02, 2012 7:51 am
Location: Portsmouth, UK

Using different repo for single package

Postby chemicalfan » Tue Sep 11, 2012 7:55 am

The subject of this thread isn't quite accurate, but it's hard to summarise in 6 words! Basically, I want to know whether it is possible to use/specify a different repo when using apt-get install, rather than having to edit sources.list, then apt-get update, then the install, then edit the sources back again. What I'm after, is "sudo-like" functionality, in that it the "elevation" only lasts for the one command. For example - say I want the latest Iceweasel (I know LMDE uses Firefox, but hear me out). Now, in wheezy's repos, it's version 10.0.7, in sid it's 10.0.7, yet in experimental, it's 15.0. Obviously I don't want experimental there all the time, and if I forgot to update the sources.list after the install (could happen, maybe in a hurry to try out the new software), the next apt-get upgrade would hose my system.

If this isn't a feature of apt-get (doesn't seem to be anything like it on the man page), then maybe this could be addressed by a Bash script? I don't mind having a crack at writing one, but I've never really done one (have poked around in some Arch ABS files though, and I'm not afraid of the terminal!)

wavespot
Level 2
Level 2
Posts: 94
Joined: Tue Jan 17, 2012 6:44 am

Re: Using different repo for single package

Postby wavespot » Tue Sep 11, 2012 7:59 am

chemicalfan wrote:The subject of this thread isn't quite accurate, but it's hard to summarise in 6 words! Basically, I want to know whether it is possible to use/specify a different repo when using apt-get install, rather than having to edit sources.list, then apt-get update, then the install, then edit the sources back again. What I'm after, is "sudo-like" functionality, in that it the "elevation" only lasts for the one command. For example - say I want the latest Iceweasel (I know LMDE uses Firefox, but hear me out). Now, in wheezy's repos, it's version 10.0.7, in sid it's 10.0.7, yet in experimental, it's 15.0. Obviously I don't want experimental there all the time, and if I forgot to update the sources.list after the install (could happen, maybe in a hurry to try out the new software), the next apt-get upgrade would hose my system.

If this isn't a feature of apt-get (doesn't seem to be anything like it on the man page), then maybe this could be addressed by a Bash script? I don't mind having a crack at writing one, but I've never really done one (have poked around in some Arch ABS files though, and I'm not afraid of the terminal!)


Check apt pinning.

Here is an exemple to prefer virtualbox from oracle rather than from offical repo. Change priority number to select the package you want to install if available from different sources. However, beware with dependencies if you play with that...

File : /etc/apt/preferences
Package: virtualbox-4.1
Pin: origin download.virtualbox.org
Pin-Priority: 1000

chemicalfan
Level 2
Level 2
Posts: 67
Joined: Fri Mar 02, 2012 7:51 am
Location: Portsmouth, UK

Re: Using different repo for single package

Postby chemicalfan » Tue Sep 11, 2012 8:14 am

Ah, that looks perfect! I found this guide (http://jaqque.sbih.org/kplug/apt-pinning.html), it's based around an old version of Debian, but hopefully still holds true

Monsta
Level 9
Level 9
Posts: 2929
Joined: Fri Aug 19, 2011 3:46 am

Re: Using different repo for single package

Postby Monsta » Tue Sep 11, 2012 9:37 am

Apt-pinning has some traps and surprises. More info here: http://carlo17.home.xs4all.nl/howto/debian.html#errata

chemicalfan
Level 2
Level 2
Posts: 67
Joined: Fri Mar 02, 2012 7:51 am
Location: Portsmouth, UK

Re: Using different repo for single package

Postby chemicalfan » Tue Sep 11, 2012 9:45 am

Thanks for that, most of it went over my head, but hopefully for what I want to do, it should be ok! I'm hoping that I can just list the repos in sources, scale their pin priorities appropriately in the preferences, and then when I run the apt-get command, I can use the "-t repo"switch to install from the specified repo

wavespot
Level 2
Level 2
Posts: 94
Joined: Tue Jan 17, 2012 6:44 am

Re: Using different repo for single package

Postby wavespot » Wed Sep 12, 2012 3:28 am

If you want to know which package is going to be installed, run "apt-cache policy packagename".

You'll see the candidate package as well as the priority of it from every repo available.


Return to “Archive”

Who is online

Users browsing this forum: No registered users and 0 guests