bin/heat: Protect changes to !s against running dnf.
authorJan Kratochvil <jan@jankratochvil.net>
Fri, 21 Jan 2022 08:16:43 +0000 (09:16 +0100)
committerJan Kratochvil <jan@jankratochvil.net>
Fri, 21 Jan 2022 08:16:43 +0000 (09:16 +0100)
bin/heat

index 2320115..8b97539 100755 (executable)
--- a/bin/heat
+++ b/bin/heat
@@ -145,6 +145,10 @@ sub setstate() {
   info "->$newstate";
   writefile $statefile,"$newstate\n" if $state ne $newstate;
   logmsg "$state->$newstate" if $state ne $newstate;
+  if ($newstate ne "s") {
+    my $pid=readfile "pidof -x dnf;true|";
+    die "\nchange refused: dnf running: $pid" if $pid;
+  }
   my $both={"s"=>[0,0],"0"=>[1,0],"1"=>[1,1]}->{$newstate};
   spawn "$usbrelay 1 ".$both->[0];
   spawn "$usbrelay 2 ".$both->[1];