2020-11-24 16:29:28 +01:00
|
|
|
{ stdenv, fetchurl, dpkg, gawk, perl, wget, coreutils, util-linux
|
2018-10-20 00:24:21 +02:00
|
|
|
, gnugrep, gnutar, gnused, gzip, makeWrapper }:
|
2012-09-19 11:48:27 +02:00
|
|
|
# USAGE like this: debootstrap sid /tmp/target-chroot-directory
|
|
|
|
# There is also cdebootstrap now. Is that easier to maintain?
|
2018-10-20 00:24:21 +02:00
|
|
|
let binPath = stdenv.lib.makeBinPath [
|
|
|
|
coreutils
|
|
|
|
dpkg
|
|
|
|
gawk
|
|
|
|
gnugrep
|
|
|
|
gnused
|
|
|
|
gnutar
|
|
|
|
gzip
|
|
|
|
perl
|
|
|
|
wget
|
|
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-07-12 19:12:14 +02:00
|
|
|
pname = "debootstrap";
|
2020-04-05 15:59:54 +02:00
|
|
|
version = "1.0.123";
|
2009-10-08 02:54:31 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2012-09-19 11:48:27 +02:00
|
|
|
# git clone git://git.debian.org/d-i/debootstrap.git
|
|
|
|
# I'd like to use the source. However it's lacking the lanny script ? (still true?)
|
2019-07-12 19:12:14 +02:00
|
|
|
url = "mirror://debian/pool/main/d/${pname}/${pname}_${version}.tar.gz";
|
2020-04-05 15:59:54 +02:00
|
|
|
sha256 = "0a53dhfwa74vdhqd6kbl7zlm7iic37c6wkdclppf0syxxi3q2njy";
|
2009-10-08 02:54:31 +02:00
|
|
|
};
|
2012-09-19 11:48:27 +02:00
|
|
|
|
2018-10-20 00:24:21 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2009-10-08 02:54:31 +02:00
|
|
|
|
2016-05-04 12:08:35 +02:00
|
|
|
dontBuild = true;
|
2009-10-08 02:54:31 +02:00
|
|
|
|
|
|
|
installPhase = ''
|
2018-10-20 00:24:21 +02:00
|
|
|
runHook preInstall
|
2012-09-19 11:48:27 +02:00
|
|
|
|
2018-10-20 00:24:21 +02:00
|
|
|
substituteInPlace debootstrap \
|
|
|
|
--replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
|
2020-11-24 16:29:28 +01:00
|
|
|
--replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${util-linux}/bin/unshare ' \
|
2018-10-20 00:24:21 +02:00
|
|
|
--replace /usr/bin/dpkg ${dpkg}/bin/dpkg \
|
|
|
|
--replace '#!/bin/sh' '#!/bin/bash' \
|
|
|
|
--subst-var-by VERSION ${version}
|
2012-09-19 11:48:27 +02:00
|
|
|
|
|
|
|
d=$out/share/debootstrap
|
2014-06-30 14:56:10 +02:00
|
|
|
mkdir -p $out/{share/debootstrap,bin}
|
2012-09-19 11:48:27 +02:00
|
|
|
|
2018-10-20 00:24:21 +02:00
|
|
|
mv debootstrap $out/bin
|
|
|
|
|
2012-09-19 11:48:27 +02:00
|
|
|
cp -r . $d
|
|
|
|
|
2018-10-20 00:24:21 +02:00
|
|
|
wrapProgram $out/bin/debootstrap \
|
|
|
|
--set PATH ${binPath} \
|
|
|
|
--set-default DEBOOTSTRAP_DIR $d
|
2012-09-19 11:48:27 +02:00
|
|
|
|
2014-06-30 14:56:10 +02:00
|
|
|
mkdir -p $out/man/man8
|
2012-09-19 11:48:27 +02:00
|
|
|
mv debootstrap.8 $out/man/man8
|
2018-10-20 00:24:21 +02:00
|
|
|
|
|
|
|
rm -rf $d/debian
|
|
|
|
|
|
|
|
runHook postInstall
|
2009-10-08 02:54:31 +02:00
|
|
|
'';
|
2012-09-19 11:48:27 +02:00
|
|
|
|
2019-07-12 19:12:14 +02:00
|
|
|
meta = with stdenv.lib; {
|
2010-07-28 13:55:54 +02:00
|
|
|
description = "Tool to create a Debian system in a chroot";
|
2020-03-04 20:34:32 +01:00
|
|
|
homepage = "https://wiki.debian.org/Debootstrap";
|
2019-07-12 19:12:14 +02:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ marcweber ];
|
|
|
|
platforms = platforms.linux;
|
2009-10-08 02:54:31 +02:00
|
|
|
};
|
|
|
|
}
|