bcache: wirtualny przełącznik do zmiany trybu pracy bcache

Zastosowanie: włączenie szybszego, ale mniej bezpiecznego trybu
w czasie oglądania czegoś w Kodi.

  Wymaga unitu systemd toggle-bcache@.service:
---
[Unit]
Description=toggle bcache mode for all devices

[Service]
Type=oneshot
WorkingDirectory=/sys
ExecStart=/usr/bin/fd --full-path bcache/cache_mode --exec sh -c "echo %i > {}; "
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ProtectControlGroups=yes
---

 Oraz regułki polkit openhab.rules:
---

polkit.addRule(function(action, subject) {
	if (action.id == "org.freedesktop.systemd1.manage-units") {
		var unit = action.lookup("unit");
		if (unit == "toggle-bcache@writethrough.service" ||
		    unit == "toggle-bcache@writeback.service") {
			var verb = action.lookup("verb");
			if (verb == "start" && subject.user == "openhabik") {
				return polkit.Result.YES;
			}
		}
	}
});
---
This commit is contained in:
root
2019-08-13 18:46:42 +02:00
parent 0a74850811
commit 1d0d343454
3 changed files with 8 additions and 0 deletions

View File

@@ -3,6 +3,8 @@ sitemap pbrk label="Szczegóły techniczne"
Frame {
Text item=dtSunset_Time
Text item=wClouds
Switch item=sHolidayVacancy
Switch item=sBCacheWriteback
}
Group label="Łączność" {