Merge pull request #264147 from lheckemann/foreign-distros
vmTools: misc debian tool improvements
This commit is contained in:
commit
9d50a5b0d8
|
@ -72,8 +72,8 @@ rec {
|
||||||
|
|
||||||
for o in $(cat /proc/cmdline); do
|
for o in $(cat /proc/cmdline); do
|
||||||
case $o in
|
case $o in
|
||||||
mountDisk=1)
|
mountDisk=*)
|
||||||
mountDisk=1
|
mountDisk=''${mountDisk#mountDisk=}
|
||||||
;;
|
;;
|
||||||
command=*)
|
command=*)
|
||||||
set -- $(IFS==; echo $o)
|
set -- $(IFS==; echo $o)
|
||||||
|
@ -103,6 +103,8 @@ rec {
|
||||||
|
|
||||||
if test -z "$mountDisk"; then
|
if test -z "$mountDisk"; then
|
||||||
mount -t tmpfs none /fs
|
mount -t tmpfs none /fs
|
||||||
|
elif [[ -e "$mountDisk" ]]; then
|
||||||
|
mount "$mountDisk" /fs
|
||||||
else
|
else
|
||||||
mount /dev/${hd} /fs
|
mount /dev/${hd} /fs
|
||||||
fi
|
fi
|
||||||
|
@ -388,7 +390,7 @@ rec {
|
||||||
filesystem containing a non-NixOS Linux distribution. */
|
filesystem containing a non-NixOS Linux distribution. */
|
||||||
|
|
||||||
runInLinuxImage = drv: runInLinuxVM (lib.overrideDerivation drv (attrs: {
|
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
|
/* 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'. */
|
image since we don't want to (and can't) write to `image'. */
|
||||||
|
@ -576,9 +578,9 @@ rec {
|
||||||
|
|
||||||
fillDiskWithDebs =
|
fillDiskWithDebs =
|
||||||
{ size ? 4096, debs, name, fullName, postInstall ? null, createRootFS ? defaultCreateRootFS
|
{ 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;
|
inherit name postInstall QEMU_OPTS memSize;
|
||||||
|
|
||||||
debs = (lib.intersperse "|" debs);
|
debs = (lib.intersperse "|" debs);
|
||||||
|
@ -647,7 +649,6 @@ rec {
|
||||||
|
|
||||||
echo "running post-install script..."
|
echo "running post-install script..."
|
||||||
eval "$postInstall"
|
eval "$postInstall"
|
||||||
ln -sf dash /mnt/bin/sh
|
|
||||||
|
|
||||||
rm /mnt/.debug
|
rm /mnt/.debug
|
||||||
|
|
||||||
|
@ -658,7 +659,7 @@ rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = { inherit fullName; };
|
passthru = { inherit fullName; };
|
||||||
});
|
} // args));
|
||||||
|
|
||||||
|
|
||||||
/* Generate a Nix expression containing fetchurl calls for the
|
/* Generate a Nix expression containing fetchurl calls for the
|
||||||
|
@ -727,9 +728,6 @@ rec {
|
||||||
esac
|
esac
|
||||||
done
|
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} \
|
perl -w ${deb/deb-closure.pl} \
|
||||||
./Packages ${urlPrefix} ${toString packages} > $out
|
./Packages ${urlPrefix} ${toString packages} > $out
|
||||||
'';
|
'';
|
||||||
|
@ -744,7 +742,7 @@ rec {
|
||||||
, packagesList ? "", packagesLists ? [packagesList]
|
, packagesList ? "", packagesLists ? [packagesList]
|
||||||
, packages, extraPackages ? [], postInstall ? ""
|
, packages, extraPackages ? [], postInstall ? ""
|
||||||
, extraDebs ? [], createRootFS ? defaultCreateRootFS
|
, extraDebs ? [], createRootFS ? defaultCreateRootFS
|
||||||
, QEMU_OPTS ? "", memSize ? 512 }:
|
, QEMU_OPTS ? "", memSize ? 512, ... }@args:
|
||||||
|
|
||||||
let
|
let
|
||||||
expr = debClosureGenerator {
|
expr = debClosureGenerator {
|
||||||
|
@ -752,10 +750,10 @@ rec {
|
||||||
packages = packages ++ extraPackages;
|
packages = packages ++ extraPackages;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
(fillDiskWithDebs {
|
(fillDiskWithDebs ({
|
||||||
inherit name fullName size postInstall createRootFS QEMU_OPTS memSize;
|
inherit name fullName size postInstall createRootFS QEMU_OPTS memSize;
|
||||||
debs = import expr {inherit fetchurl;} ++ extraDebs;
|
debs = import expr {inherit fetchurl;} ++ extraDebs;
|
||||||
}) // {inherit expr;};
|
} // args)) // {inherit expr;};
|
||||||
|
|
||||||
|
|
||||||
/* The set of supported RPM-based distributions. */
|
/* The set of supported RPM-based distributions. */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user