dpkg: add setup-hook for unpacking .deb files
This commit is contained in:
parent
060e8eee74
commit
cdd1063945
3 changed files with 14 additions and 1 deletions
|
@ -21,7 +21,6 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
nativeBuildInputs = [ dpkg makeWrapper ];
|
nativeBuildInputs = [ dpkg makeWrapper ];
|
||||||
unpackCmd = "dpkg-deb -x $src debcontents";
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
|
@ -71,6 +71,8 @@ stdenv.mkDerivation rec {
|
||||||
cp -r scripts/t/origins $out/etc/dpkg
|
cp -r scripts/t/origins $out/etc/dpkg
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "The Debian package manager";
|
description = "The Debian package manager";
|
||||||
homepage = "https://wiki.debian.org/Teams/Dpkg";
|
homepage = "https://wiki.debian.org/Teams/Dpkg";
|
||||||
|
|
12
pkgs/tools/package-management/dpkg/setup-hook.sh
Normal file
12
pkgs/tools/package-management/dpkg/setup-hook.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
unpackCmdHooks+=(_tryDpkgDeb)
|
||||||
|
_tryDpkgDeb() {
|
||||||
|
if ! [[ "$curSrc" =~ \.deb$ ]]; then return 1; fi
|
||||||
|
# Don't use dpkg-deb -x as that will error if the archive contains a file
|
||||||
|
# or directory with a setuid bit in its permissions. This is because dpkg
|
||||||
|
# calls tar internally with the -p flag, preserving file permissions.
|
||||||
|
#
|
||||||
|
# We instead only use dpkg-deb to extract the tarfile containing the files
|
||||||
|
# we want from the .deb, then finish extracting with tar directly.
|
||||||
|
mkdir root
|
||||||
|
dpkg-deb --fsys-tarfile "$curSrc" | tar --extract --directory=root
|
||||||
|
}
|
Loading…
Reference in a new issue