Unverified Commit 9d50a5b0 authored by Linus Heckemann's avatar Linus Heckemann Committed by GitHub
Browse files

Merge pull request #264147 from lheckemann/foreign-distros

vmTools: misc debian tool improvements
parents 9a2979d9 5a4f4079
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -72,8 +72,8 @@ rec {

    for o in $(cat /proc/cmdline); do
      case $o in
        mountDisk=1)
          mountDisk=1
        mountDisk=*)
          mountDisk=''${mountDisk#mountDisk=}
          ;;
        command=*)
          set -- $(IFS==; echo $o)
@@ -103,6 +103,8 @@ rec {

    if test -z "$mountDisk"; then
      mount -t tmpfs none /fs
    elif [[ -e "$mountDisk" ]]; then
      mount "$mountDisk" /fs
    else
      mount /dev/${hd} /fs
    fi
@@ -388,7 +390,7 @@ rec {
     filesystem containing a non-NixOS Linux distribution. */

  runInLinuxImage = drv: runInLinuxVM (lib.overrideDerivation drv (attrs: {
    mountDisk = true;
    mountDisk = attrs.mountDisk or true;

    /* Mount `image' as the root FS, but use a temporary copy-on-write
       image since we don't want to (and can't) write to `image'. */
@@ -576,9 +578,9 @@ rec {

  fillDiskWithDebs =
    { size ? 4096, debs, name, fullName, postInstall ? null, createRootFS ? defaultCreateRootFS
    , QEMU_OPTS ? "", memSize ? 512 }:
    , QEMU_OPTS ? "", memSize ? 512, ... }@args:

    runInLinuxVM (stdenv.mkDerivation {
    runInLinuxVM (stdenv.mkDerivation ({
      inherit name postInstall QEMU_OPTS memSize;

      debs = (lib.intersperse "|" debs);
@@ -647,7 +649,6 @@ rec {

        echo "running post-install script..."
        eval "$postInstall"
        ln -sf dash /mnt/bin/sh

        rm /mnt/.debug

@@ -658,7 +659,7 @@ rec {
      '';

      passthru = { inherit fullName; };
    });
    } // args));


  /* Generate a Nix expression containing fetchurl calls for the
@@ -727,9 +728,6 @@ rec {
        esac
      done

      # Work around this bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452279
      sed -i ./Packages -e s/x86_64-linux-gnu/x86-64-linux-gnu/g

      perl -w ${deb/deb-closure.pl} \
        ./Packages ${urlPrefix} ${toString packages} > $out
    '';
@@ -744,7 +742,7 @@ rec {
    , packagesList ? "", packagesLists ? [packagesList]
    , packages, extraPackages ? [], postInstall ? ""
    , extraDebs ? [], createRootFS ? defaultCreateRootFS
    , QEMU_OPTS ? "", memSize ? 512 }:
    , QEMU_OPTS ? "", memSize ? 512, ... }@args:

    let
      expr = debClosureGenerator {
@@ -752,10 +750,10 @@ rec {
        packages = packages ++ extraPackages;
      };
    in
      (fillDiskWithDebs {
      (fillDiskWithDebs ({
        inherit name fullName size postInstall createRootFS QEMU_OPTS memSize;
        debs = import expr {inherit fetchurl;} ++ extraDebs;
      }) // {inherit expr;};
      } // args)) // {inherit expr;};


  /* The set of supported RPM-based distributions. */