tests/virtualbox: Fix long line in guestAdditions.
This is essentially not only "wrapping" the line but refactoring into a shorter name which is used in two places. And yes, I know I'm very pedantic if it comes to whitespaces and line lengths, but I made sure this doesn't change any functionality: $ nix-instantiate nixos/tests/virtualbox.nix ... /nix/store/cldxyrxqvwpqm02cd3lvknnmj4qmblyn-vm-test-run-virtualbox.drv $ git stash pop ... $ nix-instantiate nixos/tests/virtualbox.nix ... /nix/store/cldxyrxqvwpqm02cd3lvknnmj4qmblyn-vm-test-run-virtualbox.drv $ Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
8f98226f50
commit
17f58275a0
|
@ -2,38 +2,40 @@
|
||||||
|
|
||||||
import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
|
import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
|
||||||
|
|
||||||
testVMConfig = vmName: attrs: { config, pkgs, ... }: {
|
testVMConfig = vmName: attrs: { config, pkgs, ... }: let
|
||||||
boot.kernelParams = let
|
guestAdditions = pkgs.linuxPackages.virtualboxGuestAdditions;
|
||||||
miniInit = ''
|
|
||||||
#!${pkgs.stdenv.shell} -xe
|
|
||||||
export PATH="${pkgs.coreutils}/bin:${pkgs.utillinux}/bin"
|
|
||||||
|
|
||||||
mkdir -p /etc/dbus-1 /var/run/dbus
|
miniInit = ''
|
||||||
cat > /etc/passwd <<EOF
|
#!${pkgs.stdenv.shell} -xe
|
||||||
root:x:0:0::/root:/bin/false
|
export PATH="${pkgs.coreutils}/bin:${pkgs.utillinux}/bin"
|
||||||
messagebus:x:1:1::/var/run/dbus:/bin/false
|
|
||||||
EOF
|
|
||||||
cat > /etc/group <<EOF
|
|
||||||
root:x:0:
|
|
||||||
messagebus:x:1:
|
|
||||||
EOF
|
|
||||||
cp -v "${pkgs.dbus.daemon}/etc/dbus-1/system.conf" \
|
|
||||||
/etc/dbus-1/system.conf
|
|
||||||
"${pkgs.dbus.daemon}/bin/dbus-daemon" --fork --system
|
|
||||||
|
|
||||||
${pkgs.linuxPackages.virtualboxGuestAdditions}/bin/VBoxService
|
mkdir -p /etc/dbus-1 /var/run/dbus
|
||||||
${(attrs.vmScript or (const "")) pkgs}
|
cat > /etc/passwd <<EOF
|
||||||
|
root:x:0:0::/root:/bin/false
|
||||||
|
messagebus:x:1:1::/var/run/dbus:/bin/false
|
||||||
|
EOF
|
||||||
|
cat > /etc/group <<EOF
|
||||||
|
root:x:0:
|
||||||
|
messagebus:x:1:
|
||||||
|
EOF
|
||||||
|
cp -v "${pkgs.dbus.daemon}/etc/dbus-1/system.conf" \
|
||||||
|
/etc/dbus-1/system.conf
|
||||||
|
"${pkgs.dbus.daemon}/bin/dbus-daemon" --fork --system
|
||||||
|
|
||||||
i=0
|
${guestAdditions}/bin/VBoxService
|
||||||
while [ ! -e /mnt-root/shutdown ]; do
|
${(attrs.vmScript or (const "")) pkgs}
|
||||||
sleep 10
|
|
||||||
i=$(($i + 10))
|
|
||||||
[ $i -le 120 ] || fail
|
|
||||||
done
|
|
||||||
|
|
||||||
rm -f /mnt-root/boot-done /mnt-root/shutdown
|
i=0
|
||||||
'';
|
while [ ! -e /mnt-root/shutdown ]; do
|
||||||
in [
|
sleep 10
|
||||||
|
i=$(($i + 10))
|
||||||
|
[ $i -le 120 ] || fail
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f /mnt-root/boot-done /mnt-root/shutdown
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
boot.kernelParams = [
|
||||||
"console=tty0" "console=ttyS0" "ignore_loglevel"
|
"console=tty0" "console=ttyS0" "ignore_loglevel"
|
||||||
"boot.trace" "panic=1" "boot.panic_on_fail"
|
"boot.trace" "panic=1" "boot.panic_on_fail"
|
||||||
"init=${pkgs.writeScript "mini-init.sh" miniInit}"
|
"init=${pkgs.writeScript "mini-init.sh" miniInit}"
|
||||||
|
@ -52,7 +54,7 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.extraUtilsCommands = ''
|
boot.initrd.extraUtilsCommands = ''
|
||||||
copy_bin_and_libs "${pkgs.linuxPackages.virtualboxGuestAdditions}/bin/mount.vboxsf"
|
copy_bin_and_libs "${guestAdditions}/bin/mount.vboxsf"
|
||||||
copy_bin_and_libs "${pkgs.utillinux}/bin/unshare"
|
copy_bin_and_libs "${pkgs.utillinux}/bin/unshare"
|
||||||
${(attrs.extraUtilsCommands or (const "")) pkgs}
|
${(attrs.extraUtilsCommands or (const "")) pkgs}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in New Issue