nixosTests.virtualbox.net-hostonlyif: use dhcpcd

dhclient is no longer built by default in the dhcp package, so this
test has been broken since that change was made.  To fix, switch to
dhcpcd.  dhcpcd insists on writing into /var/run, so we need to ensure
that exists.

Fixes: a2c379d4b6 ("dhcp: make client and relay component optional")
This commit is contained in:
Alyssa Ross 2022-06-25 17:11:34 +00:00
parent 34ec11729e
commit 253fa03ea9
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0

View file

@ -17,7 +17,8 @@ let
#!${pkgs.runtimeShell} -xe
export PATH="${lib.makeBinPath [ pkgs.coreutils pkgs.util-linux ]}"
mkdir -p /run/dbus
mkdir -p /run/dbus /var
ln -s /run /var
cat > /etc/passwd <<EOF
root:x:0:0::/root:/bin/false
messagebus:x:1:1::/run/dbus:/bin/false
@ -309,10 +310,7 @@ let
];
dhcpScript = pkgs: ''
${pkgs.dhcp}/bin/dhclient \
-lf /run/dhcp.leases \
-pf /run/dhclient.pid \
-v eth0 eth1
${pkgs.dhcpcd}/bin/dhcpcd eth0 eth1
otherIP="$(${pkgs.netcat}/bin/nc -l 1234 || :)"
${pkgs.iputils}/bin/ping -I eth1 -c1 "$otherIP"