2012-09-19 10:48:27 +01:00
|
|
|
{ stdenv, fetchurl, dpkg, gettext, gawk, perl, wget, coreutils, fakeroot }:
|
2009-10-08 01:54:31 +01:00
|
|
|
|
2012-09-19 10:48:27 +01:00
|
|
|
# USAGE like this: debootstrap sid /tmp/target-chroot-directory
|
|
|
|
# There is also cdebootstrap now. Is that easier to maintain?
|
2016-11-24 21:51:58 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2016-04-12 14:22:08 +01:00
|
|
|
name = "debootstrap-${version}";
|
2018-01-07 20:29:30 +00:00
|
|
|
version = "1.0.93";
|
2009-10-08 01:54:31 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2012-09-19 10:48:27 +01: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 14:22:08 +01:00
|
|
|
url = "mirror://debian/pool/main/d/debootstrap/debootstrap_${version}.tar.gz";
|
2018-01-07 20:29:30 +00:00
|
|
|
sha256 = "1nyp9fwb7xrk1vin81dmgx2g9rb52yg4gwz4rcx97gamw4mlvbfd";
|
2009-10-08 01:54:31 +01:00
|
|
|
};
|
2012-09-19 10:48:27 +01:00
|
|
|
|
2010-07-28 12:55:54 +01:00
|
|
|
buildInputs = [ dpkg gettext gawk perl ];
|
2009-10-08 01:54:31 +01:00
|
|
|
|
2016-05-04 11:08:35 +01:00
|
|
|
dontBuild = true;
|
2009-10-08 01:54:31 +01:00
|
|
|
|
2012-09-19 10:48:27 +01:00
|
|
|
# If you have to update the patch for functions a vim regex like this
|
|
|
|
# can help you identify which lines are used to write scripts on TARGET and
|
|
|
|
# which should /bin/ paths should be replaced:
|
|
|
|
# \<echo\>\|\/bin\/\|^\s*\<cat\>\|EOF\|END
|
2009-10-08 01:54:31 +01:00
|
|
|
installPhase = ''
|
2012-09-19 10:48:27 +01:00
|
|
|
sed -i \
|
|
|
|
-e 's@/usr/bin/id@id@' \
|
|
|
|
-e 's@/usr/bin/dpkg@${dpkg}/bin/dpkg@' \
|
|
|
|
-e 's@/usr/bin/sha@${coreutils}/bin/sha@' \
|
|
|
|
-e 's@/bin/sha@${coreutils}/bin/sha@' \
|
|
|
|
debootstrap
|
|
|
|
|
|
|
|
for file in functions debootstrap; do
|
2009-10-08 01:54:31 +01:00
|
|
|
substituteInPlace "$file" \
|
|
|
|
--subst-var-by gunzip "$(type -p gunzip)" \
|
|
|
|
--subst-var-by bunzip "$(type -p bunzip)" \
|
|
|
|
--subst-var-by gettext "$(type -p gettext)" \
|
|
|
|
--subst-var-by dpkg "$(type -p dpkg)" \
|
|
|
|
--subst-var-by udpkg "$(type -p udpkg)" \
|
|
|
|
--subst-var-by id "$(type -p id)" \
|
|
|
|
--subst-var-by perl "$(type -p perl)" \
|
|
|
|
--subst-var-by uname "$(type -p uname)" \
|
|
|
|
--subst-var-by wget "${wget}/bin/wget"
|
|
|
|
done
|
|
|
|
|
2012-09-19 10:48:27 +01:00
|
|
|
|
2009-10-08 01:54:31 +01:00
|
|
|
sed -i \
|
2012-09-19 10:48:27 +01:00
|
|
|
-e 's@\<wget\>@${wget}/bin/wget@' \
|
|
|
|
functions
|
|
|
|
|
|
|
|
d=$out/share/debootstrap
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p $out/{share/debootstrap,bin}
|
2012-09-19 10:48:27 +01:00
|
|
|
|
|
|
|
cp -r . $d
|
|
|
|
|
|
|
|
cat >> $out/bin/debootstrap << EOF
|
2009-10-08 01:54:31 +01:00
|
|
|
#!/bin/sh
|
2012-09-19 10:48:27 +01:00
|
|
|
export DEBOOTSTRAP_DIR="''${DEBOOTSTRAP_DIR:-$d}"
|
|
|
|
# mount and other tools must be found in chroot. So add default debain paths!
|
|
|
|
# TODO only add paths which are required by the scripts!
|
|
|
|
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
exec $d/debootstrap "\$@"
|
2009-10-08 01:54:31 +01:00
|
|
|
EOF
|
2012-09-19 10:48:27 +01:00
|
|
|
chmod +x $out/bin/debootstrap
|
|
|
|
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p $out/man/man8
|
2012-09-19 10:48:27 +01:00
|
|
|
mv debootstrap.8 $out/man/man8
|
2009-10-08 01:54:31 +01:00
|
|
|
'';
|
2012-09-19 10:48:27 +01:00
|
|
|
|
2016-05-04 11:08:35 +01:00
|
|
|
meta = {
|
2010-07-28 12:55:54 +01:00
|
|
|
description = "Tool to create a Debian system in a chroot";
|
2009-10-08 01:54:31 +01:00
|
|
|
homepage = http://packages.debian.org/de/lenny/debootstrap; # http://code.erisian.com.au/Wiki/debootstrap
|
2014-06-19 05:19:00 +01:00
|
|
|
license = stdenv.lib.licenses.gpl2; # gentoo says so.. ?
|
2010-07-28 12:55:54 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.marcweber ];
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2009-10-08 01:54:31 +01:00
|
|
|
};
|
|
|
|
}
|