mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-01 08:25:55 +03:00
scsi-link-pm: Don't fail if there are no matching SCSI hosts
This commit is contained in:
parent
8f4d8cf620
commit
5d9b3ed12b
@ -6,7 +6,7 @@ with pkgs.lib;
|
|||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
powerManagement.scsiLinkPolicy = mkOption {
|
powerManagement.scsiLinkPolicy = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = "min_power";
|
example = "min_power";
|
||||||
@ -16,7 +16,7 @@ with pkgs.lib;
|
|||||||
the kernel configures "max_performance".
|
the kernel configures "max_performance".
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -25,19 +25,20 @@ with pkgs.lib;
|
|||||||
config = mkIf (config.powerManagement.scsiLinkPolicy != "") {
|
config = mkIf (config.powerManagement.scsiLinkPolicy != "") {
|
||||||
|
|
||||||
jobs."scsi-link-pm" =
|
jobs."scsi-link-pm" =
|
||||||
{ description = "Set SCSI link power management policy";
|
{ description = "SCSI Link Power Management Policy";
|
||||||
|
|
||||||
startOn = "started udev";
|
startOn = "stopped udevtrigger";
|
||||||
|
|
||||||
task = true;
|
task = true;
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
|
shopt -s nullglob
|
||||||
for x in /sys/class/scsi_host/host*/link_power_management_policy; do
|
for x in /sys/class/scsi_host/host*/link_power_management_policy; do
|
||||||
echo ${config.powerManagement.scsiLinkPolicy} > $x
|
echo ${config.powerManagement.scsiLinkPolicy} > $x
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user