On 2017-09-09, Julian Andres Klode wrote: > On Sat, Sep 09, 2017 at 04:57:19PM +0200, Petter Reinholdtsen wrote: >> [Julian Andres Klode] >> > Instead of relying on internals, please use the interfaces provided by >> > APT 1.1 and newer: >> >> Very good. As you might have seen from the URL you sent, LTSP copies >> the package lists into its chroot to avoid having to download the same >> set of files again in the chroot. What is the recommended way to do >> this using the API interfaces? Is there a way to "inject" package >> lists, or should the script get the paths inside and outside the chroot >> before copying between the paths?
> I'm not entirely sure why you just copy Packages files, but you could > just do the query for Packages with indextargets and copy them over into > $ROOT. Probably because we don't generally care about Sources, and Release files are small enough that it's worth re-downloading them to make sure everything is up to date. > for file in $(apt-get indextargets --format '$(FILENAME)' "Created-By: > Packages"); do > mkdir -p $ROOT/"$(dirname "$file")" > cp "$file" "$ROOT/$file" > done If the "apt-get indextargets" syntax depends on apt 1.1+, it looks like this wouldn't be supported on Debian Jessie (apt 1.0.9) or Ubuntu 14.04 (apt 1.0.1). This is not a deal-breaker, per se, but it's worth noting. Of course, the /var/lib/apt/lists path might actually be different outside of the chroot than inside, if it's configurable. So inside the chroot we would need to get the values before copying them: dirstate=$(chroot $ROOT apt-config dump Dir::State) And then parse out Dir::State and Dir::State::Lists and reassemble inside the chroot. That said, with a freshly built chroot, how likely is it that the directory is non-default, or how likely will the default change in the forseeable future? > But I guess you also have to copy Release files, I don't see how that > works well with APT currently. But we don't store Release files > compressed, so it's sort of OK. Why not just copy everything? It's been a while since I've used this feature for LTSP, but in my experience, apt goes ahead and gets whatever files are missing. Maybe that will change... live well, vagrant
signature.asc
Description: PGP signature