2022-04-03 18:54:34 +00:00
|
|
|
{ lib, stdenv, fetchFromGitLab, dpkg, gawk, perl, wget, coreutils, util-linux
|
2021-10-28 06:52:43 +00:00
|
|
|
, gnugrep, gnupg1, gnutar, gnused, gzip, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
# USAGE like this: debootstrap sid /tmp/target-chroot-directory
|
|
|
|
# There is also cdebootstrap now. Is that easier to maintain?
|
2021-01-15 22:18:51 +00:00
|
|
|
let binPath = lib.makeBinPath [
|
2020-04-24 23:36:52 +00:00
|
|
|
coreutils
|
|
|
|
dpkg
|
|
|
|
gawk
|
|
|
|
gnugrep
|
2021-10-28 06:52:43 +00:00
|
|
|
gnupg1
|
2020-04-24 23:36:52 +00:00
|
|
|
gnused
|
|
|
|
gnutar
|
|
|
|
gzip
|
|
|
|
perl
|
|
|
|
wget
|
|
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "debootstrap";
|
2022-11-04 12:27:35 +00:00
|
|
|
version = "1.0.128";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "salsa.debian.org";
|
|
|
|
owner = "installer-team";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-11-04 12:27:35 +00:00
|
|
|
sha256 = "sha256-WybWWyRPreokjUAdWfZ2MUjgZhF1GTncpbLajQ3rh0E=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
substituteInPlace debootstrap \
|
|
|
|
--replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
|
2020-11-24 20:58:05 +00:00
|
|
|
--replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${util-linux}/bin/unshare ' \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace /usr/bin/dpkg ${dpkg}/bin/dpkg \
|
|
|
|
--replace '#!/bin/sh' '#!/bin/bash' \
|
|
|
|
--subst-var-by VERSION ${version}
|
|
|
|
|
|
|
|
d=$out/share/debootstrap
|
|
|
|
mkdir -p $out/{share/debootstrap,bin}
|
|
|
|
|
|
|
|
mv debootstrap $out/bin
|
|
|
|
|
|
|
|
cp -r . $d
|
|
|
|
|
|
|
|
wrapProgram $out/bin/debootstrap \
|
|
|
|
--set PATH ${binPath} \
|
|
|
|
--set-default DEBOOTSTRAP_DIR $d
|
|
|
|
|
|
|
|
mkdir -p $out/man/man8
|
|
|
|
mv debootstrap.8 $out/man/man8
|
|
|
|
|
|
|
|
rm -rf $d/debian
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tool to create a Debian system in a chroot";
|
|
|
|
homepage = "https://wiki.debian.org/Debootstrap";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ marcweber ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|