···7171 cp -r scripts/t/origins $out/etc/dpkg
7272 '';
73737474+ setupHook = ./setup-hook.sh;
7575+7476 meta = with lib; {
7577 description = "The Debian package manager";
7678 homepage = "https://wiki.debian.org/Teams/Dpkg";
+12
pkgs/tools/package-management/dpkg/setup-hook.sh
···11+unpackCmdHooks+=(_tryDpkgDeb)
22+_tryDpkgDeb() {
33+ if ! [[ "$curSrc" =~ \.deb$ ]]; then return 1; fi
44+ # Don't use dpkg-deb -x as that will error if the archive contains a file
55+ # or directory with a setuid bit in its permissions. This is because dpkg
66+ # calls tar internally with the -p flag, preserving file permissions.
77+ #
88+ # We instead only use dpkg-deb to extract the tarfile containing the files
99+ # we want from the .deb, then finish extracting with tar directly.
1010+ mkdir root
1111+ dpkg-deb --fsys-tarfile "$curSrc" | tar --extract --directory=root
1212+}