[Apt-Rpm] updating sources.list through lua script

Johan Huysmans johan.huysmans at inuits.be
Mon Apr 21 00:54:56 PDT 2008


And can you check with which option apt is called?

That way it would be possible to write a script for Scripts::Init and 
check that it is running as "apt-get update" and then perform the 
necessary actions to update the sources.list.

Greetings,
Johan

Panu Matilainen wrote:
> On Fri, 18 Apr 2008, Johan Huysmans wrote:
>
>   
>> Hi All,
>>
>> I want to achieve following situation.
>> You run "apt-get update".
>> When running that command it will check that the a specific system
>> variable is set, if it is that case, that server must be used.
>> If it is not set it must check that server 1 is available, if so it must
>> use that server, if not check and use the 2nd server.
>>
>> I'm running a lua script in "Scripts::AptGet::Update::Pre" that updates
>> the sources.list file.
>> The file gets updated, but the actual apt-get update still happens with
>> the old server configured, running apt-get update again uses the correct
>> server.
>> Apparently this is because the configuration (including the sources.list
>> file) gets read before the Pre script got executed.
>>     
>
> Hmm... yup, Scripts::AptGet::Update::Pre indeed runs after sources.list 
> gets read in. Which seems to kind of defeat the whole point of the slot, 
> makes me wonder if there was some reason for it being that way.
> One possibility would be adding yet another slot that runs just before 
> sources.list read-in.
>
>   
>> Is there a way to tell in the lua script to re-read the configuration?
>> Or can you adapt the configuration loaded in APT?
>>     
>
> Neither is possible, at the moment at least.
>
>   
>> Or any other feasible solution?
>>     
>
> There is one slot that runs before sources.list[.] is read: Scripts::Init.
> The main configuration is available to Lua at that point but little else 
> as this happens very early in the initialization process. Scripts::Init 
> also runs on each and every invocation of any program using libapt-pkg so 
> care must be taken to handle non-root use and such.
>
>  	- Panu -
>
>
> _______________________________________________
> Apt-Rpm mailing list
> Apt-Rpm at lists.laiskiainen.org
> http://lists.laiskiainen.org/listinfo.cgi/apt-rpm-laiskiainen.org
>   



More information about the Apt-Rpm mailing list