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:
parent
2fa1ba85c6
commit
337423af8e
|
@ -12,6 +12,23 @@ let
|
||||||
description = "Description of this unit used in systemd messages and progress indicators.";
|
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 {
|
after = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
types = types.listOf types.string;
|
types = types.listOf types.string;
|
||||||
|
@ -33,7 +50,7 @@ let
|
||||||
wantedBy = mkOption {
|
wantedBy = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
types = types.listOf types.string;
|
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 {
|
environment = mkOption {
|
||||||
|
@ -249,6 +266,8 @@ let
|
||||||
${optionalString (def.description != "") ''
|
${optionalString (def.description != "") ''
|
||||||
Description=${def.description}
|
Description=${def.description}
|
||||||
''}
|
''}
|
||||||
|
Requires=${concatStringsSep " " def.requires}
|
||||||
|
Wants=${concatStringsSep " " def.wants}
|
||||||
Before=${concatStringsSep " " def.before}
|
Before=${concatStringsSep " " def.before}
|
||||||
After=${concatStringsSep " " def.after}
|
After=${concatStringsSep " " def.after}
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,12 @@ in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
config =
|
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.
|
|
||||||
" {
|
|
||||||
|
|
||||||
jobs.backdoor =
|
boot.systemd.services."backdoor.service" =
|
||||||
{ startOn = "started udev";
|
{ wantedBy = [ "multi-user.target" ];
|
||||||
stopOn = "";
|
requires = [ "dev-hvc0.device" ];
|
||||||
|
after = [ "dev-hvc0.device" ];
|
||||||
|
|
||||||
script =
|
script =
|
||||||
''
|
''
|
||||||
|
@ -43,8 +40,6 @@ in
|
||||||
stty -F /dev/hvc0 raw -echo # prevent nl -> cr/nl conversion
|
stty -F /dev/hvc0 raw -echo # prevent nl -> cr/nl conversion
|
||||||
${pkgs.socat}/bin/socat stdio exec:${rootShell}
|
${pkgs.socat}/bin/socat stdio exec:${rootShell}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
respawn = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.postDeviceCommands =
|
boot.initrd.postDeviceCommands =
|
||||||
|
|
Loading…
Reference in New Issue