On Tue, 10.07.12 15:32, Ran Benita ([email protected]) wrote: > > On Tue, Jul 10, 2012 at 05:00:43AM +0000, Kok, Auke-jan H wrote: > > So in short, I'd like to do both: > > > > - have systemd chdir to $HOME if uid != 1 > > > > - extend the printf specifier list for user sessions with a specifer > > that can be used in various fields to refer to at minimum $HOME ("%h" > > ?) and possibly $UID ("%u") and $SHELL ("%s"), since these fields are > > part of the struct *passwd, and might be useful at some point. > > > > Comments? I'll post a patch gladly to implement this. > > > > I think that's useful as well, and used it for a while. Also see > http://lists.freedesktop.org/archives/systemd-devel/2011-December/004076.html
Hmm, this patch looks pretty good. How did I miss that? Shame on me. I'd merge this patch, with two changes: Could you please split up the function into two, one for each of %u and %h? Also, I think we should honour $HOME if it is set and fall back to getpwuid(getuid())->pw_home if it isn't. This might be a good candidate for a new call get_home() or so, in util.c. Hmm, and I wonder if getlogname_malloc() is actually the best choice for %u. It probably should honour $USER too, and otherwise resolve getpwuid(getuid()), but not do the tty stuff that getlogname_malloc() does. (getlogname_mallc() has a different use: it should return the user who actually really originally logged in. But for the --user purpose we'd need the user of that runs systemd, hence this should be a different call). And I guess Auke's suggested $SHELL specifier would be cool too. Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
