[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Spawn long-running process from maintainer script?



On Sat, Oct 21, 2017 at 07:11:07PM +0200, Adam Borowski wrote:
> On Sat, Oct 21, 2017 at 11:40:34AM +0200, Marc Haber wrote:
> > Aide, however, is not a daemon, and the database init process started
> > from postinst is a one-shot process running for several minutes and then
> > terminating.
> 
> Is it supposed to provide an output?

No. It just writes a database, and just after _installation_ of the
package, not during update.

> Can it handle a reboot in the middle of processing?  There are people who
> like to reboot right after upgrading, and there even are heretic ideas to
> windowsize upgrade process by making this mandatory.

In that case, the database doesn't get written, which yields the same
result as saying "no" to the question whether the database should be
generated.

> > What would be the recommended way to do this?
> > 
> > (1)
> > remove the aide database init process from the package completely since
> > it runs at a time when other packages are still being installed and the
> > new database is outdated the second it is created?
> 
> By the above reason, it doesn't sound like something that can be safely done
> in the background unless you have a way to restart the process.

It has been done this way for nearly two decades, I don't think that we
should overengineer here.

> > (2)
> > continue using s-s-d and silence the lintian warning
> > 
> > (3)
> > adopt the perl code from man-db
> > 
> > (4)
> > use some other idiom ("&"? A systemd one-shot unit? Something entirely
> > different?
> 
> nohup would be better than & (no issues with logout).  Using a systemd unit
> would be pointless as you'd need to duplicate it the Unix way for
> non-systemd users anyway -- and Unix way works with systemd (unless someone
> uses KillUserProcesses=yes which is machinegunning one's foot).

I don't believe that non-systemd usage will survive buster.

> > what would you recommend?
> 
> Definitely something that does the work in foreground.

No, you can't delay an installation for minutes.

> It's your choice whether to do this in postinst (nicer) or manually invoked
> by the user.  The other option, backgrounding, sounds like too much work for
> a few minutes of gain, if you want to do so reliably.

Which is the reason for asking the user whether she wants it done in the
background or manually.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421


Reply to: