On 06/04/18 at 05:01pm, Eli Schwartz wrote:
On 06/04/2018 04:55 PM, pacman-dev via pacman-dev wrote:
Hello Pacman Dev, The basic question first, is there a way to create a tarball with .PKGINFO and use that tarball as a pacman package to install files with particular permissions without also adding a .MTREE file to that tarball?
More context, currently we install files into our servers using a bash script. It pops open a tarball, keeping the users, groups, permissions, times for the files in the tarball, then it copies each file to the filesystem according to their location in the tarball. It works great for a cheap slightly better then POC solution. That tarball and a pacman pkg file are vary similar in that those are both tar files, with the files listed according to their desired location on the filesystem. So my idea was that it would be relatively easy for me to add the appropriate .PKGINFO into the tarball and switch from using my bash script to using pacman itself. This all worked great, except for users. In this case the file was created, in the right place, with the right permissions but the wrong user and group.
I'd suggest you have two choices to proceed from here: - use makepkg to repackage your tarball - generate the .MTREE which pacman expects
The .MTREE is simple to make, this is where makepkg generates it: https://git.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in?h=v5.1.0#n76...
As you can see, it's really just bsdtar --format=mtree with a couple other options.
pacman extracts the file with whatever uid and gid it has in the tarball. The mtree file is completely irrelevant.