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!)
Using different repo for single package
Forum rules
LMDE 2 has reached end of support as of 1-1-2019
LMDE 2 has reached end of support as of 1-1-2019
Using different repo for single package
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.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Using different repo for single package
Check apt pinning.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!)
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
Re: Using different repo for single package
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
Re: Using different repo for single package
Apt-pinning has some traps and surprises. More info here: http://carlo17.home.xs4all.nl/howto/debian.html#errata
Re: Using different repo for single package
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
Re: Using different repo for single package
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.
You'll see the candidate package as well as the priority of it from every repo available.