On Sun, 19 Jul 2015 09:30:34 -0500
Richard Shaw wrote:
> I wonder if that would work for akmods as well - background
itself
> and monitor the dnf PID that started everything to wait for it
> to exit, then run the build while no one has the rpm lock.
>
That would be ideal, but not something I know how to do.
Well, if I was going to do it, I'd start by reading /proc/self/status
to find the PPid: line and get the parent pid off the end of
the line then check /proc/pid/cmdline for "python" and "dnf"
in which case that pid is the dnf process you want to wait
for, otherwise, look for the next PPid in /proc/pid/status
and keep backing up through parents till you find a dnf,
or hit PPid 1 in which case you aren't being run from dnf :-).
Once you find the pid, waiting for it is easier. Just
check and see if there is a directory /proc/pid every
so often and once it goes away dnf has finished running.