lol
at 18.03-beta 76 lines 2.7 kB view raw
1{ stdenv, fetchurl, dpkg, gettext, gawk, perl, wget, coreutils, fakeroot }: 2 3# USAGE like this: debootstrap sid /tmp/target-chroot-directory 4# There is also cdebootstrap now. Is that easier to maintain? 5stdenv.mkDerivation rec { 6 name = "debootstrap-${version}"; 7 version = "1.0.93"; 8 9 src = fetchurl { 10 # git clone git://git.debian.org/d-i/debootstrap.git 11 # I'd like to use the source. However it's lacking the lanny script ? (still true?) 12 url = "mirror://debian/pool/main/d/debootstrap/debootstrap_${version}.tar.gz"; 13 sha256 = "1nyp9fwb7xrk1vin81dmgx2g9rb52yg4gwz4rcx97gamw4mlvbfd"; 14 }; 15 16 buildInputs = [ dpkg gettext gawk perl ]; 17 18 dontBuild = true; 19 20 # If you have to update the patch for functions a vim regex like this 21 # can help you identify which lines are used to write scripts on TARGET and 22 # which should /bin/ paths should be replaced: 23 # \<echo\>\|\/bin\/\|^\s*\<cat\>\|EOF\|END 24 installPhase = '' 25 sed -i \ 26 -e 's@/usr/bin/id@id@' \ 27 -e 's@/usr/bin/dpkg@${dpkg}/bin/dpkg@' \ 28 -e 's@/usr/bin/sha@${coreutils}/bin/sha@' \ 29 -e 's@/bin/sha@${coreutils}/bin/sha@' \ 30 debootstrap 31 32 for file in functions debootstrap; do 33 substituteInPlace "$file" \ 34 --subst-var-by gunzip "$(type -p gunzip)" \ 35 --subst-var-by bunzip "$(type -p bunzip)" \ 36 --subst-var-by gettext "$(type -p gettext)" \ 37 --subst-var-by dpkg "$(type -p dpkg)" \ 38 --subst-var-by udpkg "$(type -p udpkg)" \ 39 --subst-var-by id "$(type -p id)" \ 40 --subst-var-by perl "$(type -p perl)" \ 41 --subst-var-by uname "$(type -p uname)" \ 42 --subst-var-by wget "${wget}/bin/wget" 43 done 44 45 46 sed -i \ 47 -e 's@\<wget\>@${wget}/bin/wget@' \ 48 functions 49 50 d=$out/share/debootstrap 51 mkdir -p $out/{share/debootstrap,bin} 52 53 cp -r . $d 54 55 cat >> $out/bin/debootstrap << EOF 56 #!/bin/sh 57 export DEBOOTSTRAP_DIR="''${DEBOOTSTRAP_DIR:-$d}" 58 # mount and other tools must be found in chroot. So add default debain paths! 59 # TODO only add paths which are required by the scripts! 60 export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 61 exec $d/debootstrap "\$@" 62 EOF 63 chmod +x $out/bin/debootstrap 64 65 mkdir -p $out/man/man8 66 mv debootstrap.8 $out/man/man8 67 ''; 68 69 meta = { 70 description = "Tool to create a Debian system in a chroot"; 71 homepage = http://packages.debian.org/de/lenny/debootstrap; # http://code.erisian.com.au/Wiki/debootstrap 72 license = stdenv.lib.licenses.gpl2; # gentoo says so.. ? 73 maintainers = [ stdenv.lib.maintainers.marcweber ]; 74 platforms = stdenv.lib.platforms.linux; 75 }; 76}