В Tue, 19 Aug 2014 22:54:04 +0200
Lennart Poettering <[email protected]> пишет:

> On Tue, 19.08.14 19:34, Florian Lindner ([email protected]) wrote:
> 
> > Hello,
> > I have a systemd unit that should do a commit on a specific path. Since 
> > there are more then one path / repos, I want to use an instantiated unit 
> > for 
> > that (the stuff with @ in the unit name):
> > 
> > 
> > ~/.config/systemd/user % cat [email protected]
> > [Unit]
> > Description=Auto commit for instance.
> > 
> > [Service]
> > Type = oneshot
> > Nice = 10
> > 
> > # git returns 1 if there is nothing to commit
> > SuccessExitStatus=1
> > 
> > WorkingDirectory = %I  # also tried %i
> > ExecStart = /usr/bin/sh -c 'echo %i > wd'
> > ExecStart = /usr/bin/sh -c 'echo %i >> wd'
> > ExecStart = /usr/bin/sh -c 'echo `pwd` >> wd'
> > ExecStart = /usr/bin/git add --all .
> > ExecStart = /usr/bin/git commit -a -m "Automatic commit."
> 
> Use "%f" for unescaping paths.

Actually this will give incorrect result. If you call it
foo@/path/to/file, instance gets escaped into -path-to-file;
prepending "/" to unescaped instance results in //path/to/file. Not
fatal, but some programs may misinterpret initial "//".

%I works just fine here.

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to