* In the network-interfaces task, emit an ip-up event if there is a

statically configured interface (i.e. we're not running dhclient).
  Otherwise the ntpd job won't be triggered.
* Use the "-n" flag of "initctl emit" to send the event
  asynchronously.

svn path=/nixos/branches/upstart-0.6/; revision=18227
This commit is contained in:
Eelco Dolstra 2009-11-06 21:38:40 +00:00
parent 4b2ff53ec6
commit d545d08461
8 changed files with 26 additions and 14 deletions

View File

@ -191,7 +191,7 @@ in
${udev}/sbin/udevadm trigger
${udev}/sbin/udevadm settle # wait for udev to finish
initctl emit new-devices
initctl emit -n new-devices
'';
};

View File

@ -28,11 +28,11 @@ let
# it"), so we silently lose time synchronisation.
${config.system.build.upstart}/sbin/initctl stop ntpd
${config.system.build.upstart}/sbin/initctl emit ip-up
${config.system.build.upstart}/sbin/initctl emit -n ip-up
fi
if test "$reason" = EXPIRE -o "$reason" = RELEASE; then
${config.system.build.upstart}/sbin/initctl emit ip-down
${config.system.build.upstart}/sbin/initctl emit -n ip-down
fi
'';

View File

@ -82,7 +82,7 @@ in
chown ${ntpUser} ${stateDir}
# Needed to run ntpd as an unprivileged user.
${modprobe}/sbin/modprobe capability || true
${modprobe}/sbin/modprobe --quiet capability
# !!! This can hang indefinitely if the network is down or
# the servers are unreachable. This is particularly bad

View File

@ -61,7 +61,7 @@ with pkgs.lib;
echo "<<< MAINTENANCE SHELL >>>"
echo ""
while ! ${pkgs.bash}/bin/bash --login; do true; done
initctl emit startup
initctl emit -n startup
exit 0
fi

View File

@ -23,7 +23,7 @@
# make them appear in /dev.
${pkgs.lvm2}/sbin/vgchange --available y
initctl emit new-devices
initctl emit -n new-devices
'';
task = true;

View File

@ -178,6 +178,11 @@ in
# Run any user-specified commands.
${pkgs.stdenv.shell} ${pkgs.writeText "local-net-cmds" cfg.localCommands} || true
# Emit the ip-up event (e.g. to start ntpd).
${optionalString (cfg.interfaces != []) ''
initctl emit -n ip-up
''}
'';
postStop =

View File

@ -31,7 +31,7 @@ in
# Activate each device found.
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
initctl emit new-devices
initctl emit -n new-devices
'';
task = true;

View File

@ -9,6 +9,8 @@
{config, pkgs, ...}:
with pkgs.lib;
let
vmName = config.networking.hostName;
@ -16,7 +18,7 @@ let
options = {
virtualisation.diskImage =
pkgs.lib.mkOption {
mkOption {
default = "./${vmName}.qcow2";
description =
''
@ -90,7 +92,7 @@ in
# where the regular value for the `fileSystems' attribute should be
# disregarded for the purpose of building a VM test image (since
# those filesystems don't exist in the VM).
fileSystems = pkgs.lib.mkOverride 50 {}
fileSystems = mkOverride 50 {}
[ { mountPoint = "/";
device = "/dev/vda";
}
@ -121,6 +123,11 @@ in
networking.nameservers = [ "10.0.2.3" ];
networking.interfaces = singleton
{ name = "eth0";
ipAddress = "10.0.2.15";
};
system.build.vm = pkgs.runCommand "nixos-vm" {}
''
ensureDir $out/bin
@ -137,11 +144,11 @@ in
# When building a regular system configuration, override whatever
# video driver the host uses.
services.xserver.videoDriver = pkgs.lib.mkOverride 50 {} null;
services.xserver.videoDrivers = pkgs.lib.mkOverride 50 {} [ "cirrus" "vesa" ];
services.xserver.defaultDepth = pkgs.lib.mkOverride 50 {} 0;
services.xserver.resolutions = pkgs.lib.mkOverride 50 {} [];
services.xserver.videoDriver = mkOverride 50 {} null;
services.xserver.videoDrivers = mkOverride 50 {} [ "cirrus" "vesa" ];
services.xserver.defaultDepth = mkOverride 50 {} 0;
services.xserver.resolutions = mkOverride 50 {} [];
# Wireless won't work in the VM.
networking.enableWLAN = pkgs.lib.mkOverride 50 {} false;
networking.enableWLAN = mkOverride 50 {} false;
}