Merge pull request #225504 from huantianad/dpkg-unpackCmdHook

authored by Artturi and committed by GitHub 3a49233b 9daee206

+14 -1
-1
pkgs/servers/jibri/default.nix
··· 21 22 dontBuild = true; 23 nativeBuildInputs = [ dpkg makeWrapper ]; 24 - unpackCmd = "dpkg-deb -x $src debcontents"; 25 26 installPhase = '' 27 runHook preInstall
··· 21 22 dontBuild = true; 23 nativeBuildInputs = [ dpkg makeWrapper ]; 24 25 installPhase = '' 26 runHook preInstall
+2
pkgs/tools/package-management/dpkg/default.nix
··· 71 cp -r scripts/t/origins $out/etc/dpkg 72 ''; 73 74 meta = with lib; { 75 description = "The Debian package manager"; 76 homepage = "https://wiki.debian.org/Teams/Dpkg";
··· 71 cp -r scripts/t/origins $out/etc/dpkg 72 ''; 73 74 + setupHook = ./setup-hook.sh; 75 + 76 meta = with lib; { 77 description = "The Debian package manager"; 78 homepage = "https://wiki.debian.org/Teams/Dpkg";
+12
pkgs/tools/package-management/dpkg/setup-hook.sh
···
··· 1 + unpackCmdHooks+=(_tryDpkgDeb) 2 + _tryDpkgDeb() { 3 + if ! [[ "$curSrc" =~ \.deb$ ]]; then return 1; fi 4 + # Don't use dpkg-deb -x as that will error if the archive contains a file 5 + # or directory with a setuid bit in its permissions. This is because dpkg 6 + # calls tar internally with the -p flag, preserving file permissions. 7 + # 8 + # We instead only use dpkg-deb to extract the tarfile containing the files 9 + # we want from the .deb, then finish extracting with tar directly. 10 + mkdir root 11 + dpkg-deb --fsys-tarfile "$curSrc" | tar --extract --directory=root 12 + }