2018-10-19 22:24:21 +00:00
|
|
|
{ stdenv, fetchurl, dpkg, gawk, perl, wget, coreutils, utillinux
|
|
|
|
, gnugrep, gnutar, gnused, gzip, makeWrapper }:
|
2012-09-19 09:48:27 +00:00
|
|
|
# USAGE like this: debootstrap sid /tmp/target-chroot-directory
|
|
|
|
# There is also cdebootstrap now. Is that easier to maintain?
|
2018-10-19 22:24:21 +00:00
|
|
|
let binPath = stdenv.lib.makeBinPath [
|
|
|
|
coreutils
|
|
|
|
dpkg
|
|
|
|
gawk
|
|
|
|
gnugrep
|
|
|
|
gnused
|
|
|
|
gnutar
|
|
|
|
gzip
|
|
|
|
perl
|
|
|
|
wget
|
|
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
2016-04-12 13:22:08 +00:00
|
|
|
name = "debootstrap-${version}";
|
2019-01-18 00:45:00 +00:00
|
|
|
version = "1.0.114";
|
2009-10-08 00:54:31 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2012-09-19 09:48:27 +00: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?)
|
2016-04-12 13:22:08 +00:00
|
|
|
url = "mirror://debian/pool/main/d/debootstrap/debootstrap_${version}.tar.gz";
|
2019-01-18 00:45:00 +00:00
|
|
|
sha256 = "14lw18bhxap1g15q0rhslacj1bcrl69wrqcx6azmbvd92rl4bqd8";
|
2009-10-08 00:54:31 +00:00
|
|
|
};
|
2012-09-19 09:48:27 +00:00
|
|
|
|
2018-10-19 22:24:21 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2009-10-08 00:54:31 +00:00
|
|
|
|
2016-05-04 10:08:35 +00:00
|
|
|
dontBuild = true;
|
2009-10-08 00:54:31 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2018-10-19 22:24:21 +00:00
|
|
|
runHook preInstall
|
2012-09-19 09:48:27 +00:00
|
|
|
|
2018-10-19 22:24:21 +00:00
|
|
|
substituteInPlace debootstrap \
|
|
|
|
--replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
|
|
|
|
--replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${utillinux}/bin/unshare ' \
|
|
|
|
--replace /usr/bin/dpkg ${dpkg}/bin/dpkg \
|
|
|
|
--replace '#!/bin/sh' '#!/bin/bash' \
|
|
|
|
--subst-var-by VERSION ${version}
|
2012-09-19 09:48:27 +00:00
|
|
|
|
|
|
|
d=$out/share/debootstrap
|
2014-06-30 12:56:10 +00:00
|
|
|
mkdir -p $out/{share/debootstrap,bin}
|
2012-09-19 09:48:27 +00:00
|
|
|
|
2018-10-19 22:24:21 +00:00
|
|
|
mv debootstrap $out/bin
|
|
|
|
|
2012-09-19 09:48:27 +00:00
|
|
|
cp -r . $d
|
|
|
|
|
2018-10-19 22:24:21 +00:00
|
|
|
wrapProgram $out/bin/debootstrap \
|
|
|
|
--set PATH ${binPath} \
|
|
|
|
--set-default DEBOOTSTRAP_DIR $d
|
2012-09-19 09:48:27 +00:00
|
|
|
|
2014-06-30 12:56:10 +00:00
|
|
|
mkdir -p $out/man/man8
|
2012-09-19 09:48:27 +00:00
|
|
|
mv debootstrap.8 $out/man/man8
|
2018-10-19 22:24:21 +00:00
|
|
|
|
|
|
|
rm -rf $d/debian
|
|
|
|
|
|
|
|
runHook postInstall
|
2009-10-08 00:54:31 +00:00
|
|
|
'';
|
2012-09-19 09:48:27 +00:00
|
|
|
|
2016-05-04 10:08:35 +00:00
|
|
|
meta = {
|
2010-07-28 11:55:54 +00:00
|
|
|
description = "Tool to create a Debian system in a chroot";
|
2018-10-19 22:24:21 +00:00
|
|
|
homepage = https://wiki.debian.org/Debootstrap;
|
|
|
|
license = stdenv.lib.licenses.mit;
|
2010-07-28 11:55:54 +00:00
|
|
|
maintainers = [ stdenv.lib.maintainers.marcweber ];
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2009-10-08 00:54:31 +00:00
|
|
|
};
|
|
|
|
}
|