Backdoor: depend on /dev/hvc0

Systemd is the shit: units can declare a dependency on the appearance
of device nodes.  Yay!
This commit is contained in:
Eelco Dolstra 2012-06-19 17:36:02 -04:00
parent 2fa1ba85c6
commit 337423af8e
2 changed files with 25 additions and 11 deletions

View File

@ -12,6 +12,23 @@ let
description = "Description of this unit used in systemd messages and progress indicators.";
};
requires = mkOption {
default = [];
types = types.listOf types.string;
description = ''
Start the specified units when this unit is started, and stop
this unit when the specified units are stopped or fail.
'';
};
wants = mkOption {
default = [];
types = types.listOf types.string;
description = ''
Start the specified units when this unit is started.
'';
};
after = mkOption {
default = [];
types = types.listOf types.string;
@ -33,7 +50,7 @@ let
wantedBy = mkOption {
default = [];
types = types.listOf types.string;
description = "Units that want (i.e. depend on) this unit.";
description = "Start this unit when the specified units are started.";
};
environment = mkOption {
@ -249,6 +266,8 @@ let
${optionalString (def.description != "") ''
Description=${def.description}
''}
Requires=${concatStringsSep " " def.requires}
Wants=${concatStringsSep " " def.wants}
Before=${concatStringsSep " " def.before}
After=${concatStringsSep " " def.after}

View File

@ -21,15 +21,12 @@ in
{
config =
# Require a patch to the kernel to increase the 15s CIFS timeout.
mkAssert (config.boot.kernelPackages.kernel.features ? cifsTimeout) "
VM tests require that the kernel has the CIFS timeout patch.
" {
config = {
jobs.backdoor =
{ startOn = "started udev";
stopOn = "";
boot.systemd.services."backdoor.service" =
{ wantedBy = [ "multi-user.target" ];
requires = [ "dev-hvc0.device" ];
after = [ "dev-hvc0.device" ];
script =
''
@ -43,8 +40,6 @@ in
stty -F /dev/hvc0 raw -echo # prevent nl -> cr/nl conversion
${pkgs.socat}/bin/socat stdio exec:${rootShell}
'';
respawn = false;
};
boot.initrd.postDeviceCommands =