diff options
author | Marc Weber <marco-oweber@gmx.de> | 2009-10-08 00:54:31 +0000 |
---|---|---|
committer | Marc Weber <marco-oweber@gmx.de> | 2009-10-08 00:54:31 +0000 |
commit | 5fe030ee0a921f68a1c29a7f10db53bfd8c581b0 (patch) | |
tree | 6ecce3b2e12d73d49846a6b60dad0ec63970377d /pkgs/tools | |
parent | 0e6c476d60b8cfa7fd130f54b11fca4af2cf0729 (diff) |
adding debootstrap (bootstrap debian in a chroot)
svn path=/nixpkgs/trunk/; revision=17709
Diffstat (limited to 'pkgs/tools')
-rw-r--r-- | pkgs/tools/misc/debootstrap/default.nix | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/pkgs/tools/misc/debootstrap/default.nix b/pkgs/tools/misc/debootstrap/default.nix new file mode 100644 index 0000000000000..25653314eecde --- /dev/null +++ b/pkgs/tools/misc/debootstrap/default.nix @@ -0,0 +1,91 @@ +args: with args; + +let devices = fetchurl { + url = mirror://gentoo/distfiles/devices.tar.gz; + sha256 = "0j4yhajmlgvbksr2ij0dm7jy3q52j3wzhx2fs5lh05i1icygk4qd"; + }; +in + +stdenv.mkDerivation { + name = "debbotstrap-1.0.10lenny"; + + src = fetchurl { + # I'd like to use the source. However it's lacking the lanny script ? + url = mirror://debian/pool/main/d/debootstrap/debootstrap_1.0.10lenny1_all.deb; + sha256 = "a70af8e3369408ce9d6314fb5219de73f9523b347b75a3b07ee17ea92c445051"; + }; + buildInputs = [dpkg gettext gawk perl]; + + unpackPhase = '' + dpkg-deb --extract "$src" . + ''; + buildPhase = ":"; + + patches = [ + # replace /usr/* and /sbin/* executables by @executable@ so that they can be replaced by substitute + # Be careful not to replace code being run in the debian chroot ! + ./subst.patch + ]; + + # from deb + installPhase = '' + cp -r . $out; cd $out + t=bin/debootstrap + ensureDir bin man/man8 + cat >> $t << EOF + #!/bin/sh + export DEBOOTSTRAP_DIR=$out/usr/share/debootstrap + # 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 + $out/usr/sbin/debootstrap "\$@" + EOF + chmod +x $t + mv usr/share/man/man8/debootstrap.8.gz man/man8 + + set -x + for file in usr/share/debootstrap/functions usr/sbin/debootstrap; do + 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 + ''; + + /* build from source: + installPhase = '' + cp ${devices} devices.tar.gz + ensureDir $out/{bin,man/man8}; + cp debootstrap.8 $out/man/man8 + sed -i \ + -e 's@-o root@@' \ + -e 's@-g root@@' \ + -e 's@chown@true@' \ + Makefile + make pkgdetails debootstrap-arch + make DESTDIR="''\${out}" install-arch + t=$out/bin/debootstrap + cat >> $t << EOF + #!/bin/sh + DEBOOTSTRAP_DIR=$out/usr/share/debootstrap $out/usr/sbin/debootstrap "\$@" + EOF + chmod +x $t + ''; + */ + + meta = { + description = "create a debian system in a chroot easily."; + longDescription = "this way you can use debian packages we don't have in nixpkgs yet. + "; + homepage = http://packages.debian.org/de/lenny/debootstrap; # http://code.erisian.com.au/Wiki/debootstrap + license = "GPL-2"; # gentoo says so.. ? + maintainers = [args.lib.maintainers.marcweber]; + platforms = args.lib.platforms.linux; + }; +} |