Quoting Benjamin Drung (2020-01-06 17:08:09) > Am Montag, den 06.01.2020, 07:52 +0100 schrieb Johannes Schauer: > > I assume you are not creating a tarball then, because tar would take care > > of clamping the mtime for you? > I wasn't aware of the mtime clamping. So this mtime adjustment can be removed > completely.
mtime clamping is how mmdebstrap makes the output tarball bit-by-bit reproducible if you run with the same SOURCE_DATE_EPOCH: $ SOURCE_DATE_EPOCH=1578217697 mmdebstrap --variant=apt --mode=fakechroot unstable chroot1.tar $ SOURCE_DATE_EPOCH=1578217697 mmdebstrap --variant=apt --mode=fakechroot unstable chroot2.tar $ cmp chroot1.tar chroot2.tar > > As you know from my private mail, there are now some basic special hooks to > > copy stuff in and out of the chroot. Just like with guestfish hooks, > > globbing is not (yet) supported. This could be fixed but would require > > implementing a full shell quoting parser as well as a symlink resolver > > which the current solution is working around by utilizing /bin/sh inside > > the chroot. If you want globbing, then create one hook that utilizes > > globbing in sh to create a tarball of the files you want and a second hook > > to move that tarball out of the chroot. Like this: > > > > --customize-hook='chroot "$1" sh -c "cd /boot && tar -cf > > /tmp/boot.tar vmlinuz* initrd.img*"' > > --customize-hook='copy-out /tmp/boot.tar .' > > --customize-hook='rm "$1"/tmp/boot.tar' > > > > Or like this: > > > > --customize-hook='chroot "$1" sh -c "mkdir /tmp/boot && cp > > /boot/vmlinuz* /boot/initrd.img* /tmp/boot"' > > --customize-hook='copy-out /tmp/boot .' > > --customize-hook='rm -r "$1"/tmp/boot' > > I tried this solution and are fine with using it. Compared to implementing > globbing in mmdebstrap, this solution adds two more hooks and copies the > files twice (should not have a big performance impact). > > The only remaining issues is that copy-out copies the directory as-is instead > of copying the content of the directory. So in this your example above, the > current directory would contain a directory 'boot' containing the kernel and > initrd, but I like to have the kernel and initrd in the current directory > (instead of the 'boot' subdirectory). Any good idea how to do that? Some ideas: --customize-hook='chroot "$1" sh -c "cp /boot/vmlinuz* /tmp/vmlinuz && cp /boot/initrd.img* /tmp/initrd"' --customize-hook='copy-out /tmp/vmlinuz .' --customize-hook='copy-out /tmp/initrd.img .' --customize-hook='rm "$1"/tmp/vmlinuz "$1"/tmp/initrd.img' or like this: --customize-hook='chroot "$1" sh -c "cd /boot && tar -cf /tmp/boot.tar vmlinuz* initrd.img*"' --customize-hook='copy-out /tmp/boot.tar .' --customize-hook='rm "$1"/tmp/boot.tar' --customize-hook='tar -xf boot.tar && rm boot.tar' or like this: --customize-hook='chroot "$1" sh -c "mkdir /tmp/boot && cp /boot/vmlinuz* /boot/initrd.img* /tmp/boot"' --customize-hook='tar-out /tmp/boot boot.tar' --customize-hook='rm -r "$1"/tmp/boot' --customize-hook='tar --strip-components=1 -xf boot.tar && rm boot.tar' If you think this is all too convoluted, feel free to write up a patch that adds wildcard support. I'd gladly apply it! Thanks! cheers, josch
signature.asc
Description: signature