convert init.d to systemd, how to determine which python is installed

Adam Jackson ajax at redhat.com
Thu Nov 3 14:38:18 UTC 2011


On Thu, 2011-11-03 at 10:10 -0400, Kaleb S. KEITHLEY wrote:
> HekaFS runs a daemon from init. It's a Bottle (python-based) http server.
> 
> In order to work on, e.g. RHEL6 in addition to Fedora, the old init 
> script has:
> ...
> vercmd="from distutils.sysconfig import get_python_lib; print 
> get_python_lib()"
> py_dir=$(python -c "${vercmd}")
> exe="${py_dir}/hekafsd.py"
> ...
> 
> I'd kinda like to preserve that in some fashion in the new systemd 
> service file. Not to run on RHEL6 obviously, but to be future-proof 
> against the day when python2.8 or python3.x ships in F17 or later or 
> RHEL7, e.g.

Generate the actual systemd service file at rpmbuild time.  Something
like this maybe, if you're using the standard magic for
%{python_sitelib}:

Source1: hekafs.service.in
...
sed s/@PYTHON_SITELIB@/%{python_sitelib}/ %{SOURCE1} > $RPM_BUILD_ROOT/lib/systemd/system/hekafs.service

- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.fedoraproject.org/pipermail/devel/attachments/20111103/32ec90db/attachment.bin 


More information about the devel mailing list