Using different repo for single package

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Using different repo for single package

Postby chemicalfan on 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!)
chemicalfan
Level 2
Level 2
 
Posts: 64
Joined: Fri Mar 02, 2012 7:51 am
Location: Portsmouth, UK

Linux Mint is funded by ads and donations.
 

Re: Using different repo for single package

Postby wavespot on 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
wavespot
Level 2
Level 2
 
Posts: 92
Joined: Tue Jan 17, 2012 6:44 am

Re: Using different repo for single package

Postby chemicalfan on 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
chemicalfan
Level 2
Level 2
 
Posts: 64
Joined: Fri Mar 02, 2012 7:51 am
Location: Portsmouth, UK

Re: Using different repo for single package

Postby Monsta on 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
Monsta
Level 8
Level 8
 
Posts: 2337
Joined: Fri Aug 19, 2011 3:46 am

Re: Using different repo for single package

Postby chemicalfan on 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
chemicalfan
Level 2
Level 2
 
Posts: 64
Joined: Fri Mar 02, 2012 7:51 am
Location: Portsmouth, UK

Re: Using different repo for single package

Postby wavespot on 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.
wavespot
Level 2
Level 2
 
Posts: 92
Joined: Tue Jan 17, 2012 6:44 am


Return to Newbie Questions

Who is online

Users browsing this forum: No registered users and 4 guests