Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Antoine Pietri
On Tue, Feb 27, 2018 at 2:37 PM, Antoine Pietri wrote: > - My current workaround is to shell-out to `systemd-run -p > DynamicUser=yes ...` first to do a mkdir -p, then for a cp -R. This > solution requires a lot of boilerplate from the Python wrapper and > takes more time for no good reason, so I

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Lennart Poettering
On Di, 27.02.18 14:37, Antoine Pietri (antoine.piet...@gmail.com) wrote: > Hi! > > To experiment with systemd dynamic users, I started working on a > wrapper around a program that builds user packages (Archlinux makepkg) > and that refuses to be launched as root (for very good reasons). The > ide

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread aleivag
Hi Antoine: 2 disclosure before reading this: 1) i'm not part of systemd-devel team, and 2) this is also a shameless plug because i'm talking about a lib i created. with that out of the way, here is my advice/solution. do everything in python and use `pystemd` (pip install pystemd, just have li

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Antoine Pietri
On Wed, Feb 28, 2018 at 5:13 PM, aleivag wrote: > do everything in python and use `pystemd` (pip install pystemd, just have > libsystemd installed and you should be fine) This is not an option for me as one of our requirements is to have everything packaged in the repos of Archlinux. But thanks f

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Antoine Pietri
On Wed, Feb 28, 2018 at 5:24 PM, Lennart Poettering wrote: > Does it have to be a writable copy? if not you could just do '-p > BindReadOnlyPaths=/path/to/my/source:/var/cache/mywrapper' Yes it does, the build happens in place. > That said, maybe we should add a concept of TemplateCacheDirectory

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Lennart Poettering
On Mi, 28.02.18 17:38, Antoine Pietri (antoine.piet...@gmail.com) wrote: > On Wed, Feb 28, 2018 at 5:24 PM, Lennart Poettering > wrote: > > Does it have to be a writable copy? if not you could just do '-p > > BindReadOnlyPaths=/path/to/my/source:/var/cache/mywrapper' > > Yes it does, the build h

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Antoine Pietri
On Wed, Feb 28, 2018 at 6:13 PM, Lennart Poettering wrote: >> Okay! Does that also apply to the other possible approach I sent in my >> second mail? (Running a `dummy sh -c read` service with systemd-run, >> do the setup and kill it when the setup is done). The advantage of >> that one is that you

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Lennart Poettering
On Mi, 28.02.18 18:22, Antoine Pietri (antoine.piet...@gmail.com) wrote: > On Wed, Feb 28, 2018 at 6:13 PM, Lennart Poettering > wrote: > >> Okay! Does that also apply to the other possible approach I sent in my > >> second mail? (Running a `dummy sh -c read` service with systemd-run, > >> do the

Re: [systemd-devel] custom var in sd_notify

2018-02-28 Thread Lennart Poettering
On Mo, 26.02.18 08:09, Mantas Mikulėnas (graw...@gmail.com) wrote: > > Daemons can choose to send additional variables. However, it is recommended > > to prefix variable names not listed above with X_. > > So naturally i tried > > > > sd_notify(0, "X_ANSWER=42") > > > > and apparently systemd has

Re: [systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

2018-02-28 Thread Antoine Pietri
On Wed, Feb 28, 2018 at 6:59 PM, Lennart Poettering wrote: > Not sure I follow. Why do you let the service hang around? If all you > want to do is have it create the directory for you you could just run: > > # systemd-run -P -p DynamicUser=yes -p CacheDirectory=mywrapper --wait true > > That would

Re: [systemd-devel] Why did you set MountFlags=slave in systemd-udevd.service.in

2018-02-28 Thread Hongzhi, Song
Thank you very much. It dose work. Would you tell me that how the '--no-block' works, I doesn't deeply understand the interpretation in https://www.freedesktop.org/software/systemd/man/systemd-mount.html#SYSTEMD_MOUNT_OPTIONS= And why systemd-mount can solve the problem brought by MountFlag=s