Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Running cat /etc/apt/apt.conf gives:

APT::Default-Release "stable";

I thought doing that would disallow the command apt-get install wajig to work, if a newer version was available anywhere but Stable.

How do I set up APT so that such a version would require me to specify the repository name in order to install it (e.g. apt-get --target-release testing wajig)?

[update] I wasn't aware that my question wasn't so clear. I want this to be an archive-wide setting (i.e. it should apply to each package in the Stable archive), not to some specific package.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Put this in your "/etc/apt/preferences":

Package: *
Pin: release a=stable
Pin-Priority: 900

Package: *
Pin: release o=Debian
Pin-Priority: -10

This is from man apt_preferences where P means Pin-Priority:

500 < P <=990
   causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent

P < 0
   prevents the version from being installed

See this Debian wiki page for something gentler than the manpage.

share|improve this answer
    
You can replace "wajig" with * –  Tim Bielawa Feb 22 '11 at 0:02

If there is a wajig package with a positive pin priority in any of your sources, apt-get install wajig will install it. Default-Release works like setting a high priority to that particular release. If I understand correctly, you'd like apt-get install wajig to work if squeeze has the latest version and not to work otherwise; I don't think that's possible.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.