[pacman-dev] pacman user+group support without mtree
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. $ tar -tvf vienna-os-scaffold-0.0.0-any.pkg.tar.xz | grep sbin/vienna -r-x------ vienna/nogroup 533 2017-12-04 13:18 usr/local/sbin/vienna ... $ sudo pacman --noconfirm -U vienna-os-scaffold-0.0.0-any.pkg.tar.xz warning: no 'XferCommand' configured loading packages... resolving dependencies... looking for conflicting packages... Packages (1) vienna-os-scaffold-0.0.0-0 :: Proceed with installation? [Y/n] (1/1) checking package integrity [#####################################################################################################] 100% (1/1) loading package files [#####################################################################################################] 100% (1/1) checking for file conflicts [#####################################################################################################] 100% (1/1) checking available disk space [#####################################################################################################] 100% :: Processing package changes... (1/1) installing vienna-os-scaffold ... $ ls -l /usr/local/sbin/vienna -r-x------ 1 501 dialout 533 Dec 4 13:18 /usr/local/sbin/vienna As the above shell script snippets demonstrate, the file usr/local/sbin/vienna is owned by "vienna" in the tarball, and assigned to group "nogroup". It also is only readable and execute by the user. When deployed by pacman it retains the permission and is installed at /usr/local/sbin/vienna. Which is correct, but it is owned by dialout and 553? This is not correct. If I want the file to be installed with user=vienna and group=nogroup, do I need to create a .mtree file and add that to the package as well or is there some other way I can get pacman to look at the user and group of the file inside the tarball? Michael Power
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. -- Eli Schwartz Bug Wrangler and Trusted User
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.
participants (3)
-
Andrew Gregory
-
Eli Schwartz
-
pacman-dev