[systemd-devel] how can I add a boot parameter to a app which depend on kernel boot option

Colin Guthrie gmane at colin.guthr.ie
Tue May 13 07:57:50 PDT 2014


'Twas brillig, and Umut Tezduyar Lindskog at 13/05/14 12:18 did gyre and
gimble:
> Hi Xiong
> 
> You can have a script that reads the  /proc/cmdline and then calls
> exec with your app.
> 
> ExecStart=/your/custom/scipt
> 
> cat /your/custom/script:
> 
> # Do what ever you want, figure out parameters
> 
> # Start your application
> exec myapp --parameter=xyz

Yup this looks like the best idea.


There is also ConditionKernelCommandLine= but that would require you
actually have several units for each different option and have the
Condition prevent it from running.

ConditionKernelCommandLine also only does quite simple matching, so it
might not do what you need anyway.

So I think a wrapper script is likely best here. Or some:
  ExecStart=/bin/bash -c '...'
if you can encapsulate it simply enough within the ''.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list