Using different repo for single package

Archived topics about LMDE 1 and LMDE 2
Locked
chemicalfan

Using different repo for single package

Post by chemicalfan »

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!)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
wavespot
Level 2
Level 2
Posts: 94
Joined: Tue Jan 17, 2012 6:44 am

Re: Using different repo for single package

Post by wavespot »

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

Re: Using different repo for single package

Post by chemicalfan »

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 10
Level 10
Posts: 3071
Joined: Fri Aug 19, 2011 3:46 am

Re: Using different repo for single package

Post by Monsta »

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

Re: Using different repo for single package

Post by chemicalfan »

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

Post by wavespot »

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.
Locked

Return to “LMDE Archive”