[systemd-devel] Environment for prefdm.service

David Michael fedora.dm0 at gmail.com
Tue Jul 19 06:26:02 PDT 2011


Hi,

Just to post on a more appropriate list than fedora-devel after the
topic came up there:  The following are systemd-relevant parts of my
current RPM scriptlets with alternatives in mind.  They should ensure
a usable display-manager.service exists under /lib if at least one
compatible display manager is installed, while leaving users' symlinks
under /etc/systemd override it as expected.  (I imagine it to be more
intuitive for users to create the /etc/systemd symlink than to adjust
alternatives for these types of changes.)

And I apologise for suggesting it would be owned by systemd-units
earlier--it has been so long since I worked with alternatives that I
forgot the command creates the symlink itself and it is not packaged.
(I don't function well midday Mondays.)  So systemd-units probably
should no longer own display-manager.service (at least when
prefdm.service disappears), instead leaving it as ghost files in the
DM packages, as alternatives works elsewhere.

As for the concern that /lib should not have a symlink created outside
of RPM files, I would give higher priority to preserving consistent
behavior for customised services under /etc/systemd/system--namely not
having packages touch them at all--especially considering the /lib
symlink target should never change from /etc/alternatives anyway.  But
these are just my suggestions, and I will change my files as needed
when there is an official guideline written somewhere.

Thanks for all the info earlier.

David


%post
if [ $1 -eq 1 ] ; then
    %{_sbindir}/alternatives --install %{_unitdir}/display-manager.service \
        display-manager.service %{_unitdir}/example.service 10
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi

%preun
if [ $1 -eq 0 ] ; then
    %{_sbindir}/alternatives --remove \
        display-manager.service %{_unitdir}/example.service
    /bin/systemctl --no-reload disable example.service >/dev/null 2>&1
    /bin/systemctl stop example.service >/dev/null 2>&1 || :
fi

%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :


More information about the systemd-devel mailing list