[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Modifying /etc/apt/sources.list in postinst ; determining the suite in postinst



Neil Williams <linux@codehelp.co.uk> writes:

> On Tue, 03 Apr 2007 19:27:17 +0000
> Lars Wirzenius <liw@liw.iki.fi> wrote:
>
>> On ti, 2007-04-03 at 16:28 +0100, Neil Williams wrote:
>> With regards to Debian Policy, you need to read section 10.7.
>
> That's why I'm changing the existing method (which does simply append
> data to /etc/apt/sources.list). The previous hack isn't good.
> :-)
>
> However, determining the suite from within postinst is my main issue at
> the moment.
>
> Is it safe to use `apt-cache policy` ?

Parse sources.list. Many people have multiple suites in there and you
will want to add multiple entries then. You also want to pick a mirror
near to the mirror already used.

>> Basically, since sources.list is a configuration file belonging to
>> apt, your package may only edit it in postinst if apt provides
>> commands for doing so. I don't think apt does that, but I could be
>> wrong.
>
> It does have a method: /etc/apt/sources.list.d/
>
> I'm going to put a sources file in there which can be purged when the
> package is purged.

Use ucf so you can set the best mirror in postinst.

>> With regards to the life of a sysadmin, don't do it.
>
> I can't see sysadmins having to manage many cross-building buildd
> machines but I will provide a README.Debian. The Emdebian repository
> only stores the cross-building toolchains.
>
>> Provide a README.Debian that tells what needs to be done, and
>> possibly provide a command to do it easily.
>
> The package is unusable without the added sources. Providing a
> userspace command doesn't ensure that the repository is removed from
> the sources list when the package is purged.
>
> The modified package is currently in the Emdebian repository, v0.1.4.

MfG
        Goswin



Reply to: