Re: [HEADS-UP] systemd for F14 - the next steps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 21, 2010 at 03:13:12PM +0200, Lennart Poettering wrote:
> On Tue, 20.07.10 20:24, Toshio Kuratomi (a.badger@xxxxxxxxx) wrote:
> 
> > On Wed, Jul 14, 2010 at 2:50 PM, Adam Williamson <awilliam@xxxxxxxxxx> wrote:
> > > On Wed, 2010-07-14 at 15:42 -0600, Kevin Fenzi wrote:
> > >
> > >> Perhaps someone could put together a wiki page for lazy sysadmins with
> > >> a Q&A? ie, I used to do this in upstart/sysvinit, how do I do it with
> > >> systemd?
> > >
> > > Jóhann Guðmundsson (viking_ice) has been working on something along
> > > these lines:
> > >
> > > http://fedoraproject.org/wiki/User:Johannbg/QA/Systemd
> > >
> > > it was mentioned in the QA meeting a few weeks back.
> > 
> > I have a few requests for things to add to that page :-)
> > 
> > * What replaces chkconfig
> > * What replaces /etc/init.d/SERVICENAME start | stop ?
> > 
> > Similarly, for packaging guidelines updates, how do we install
> > packages that provide services and have them not start up?
> 
> The longer answers for most of these questions you find in Jóhann's
> reply. But a few additional notes:
> 
> - If you only install a SysV init script, then continue to use chkconfig
>   as usual. It works as intended to enable/disable SysV init
>   scripts. Only if you use native systemd unit files you should use
>   systemd-install instead. Note that most operations systemd-install
>   executes are very easy however, as all it does is creating/removing a
>   few suggested symlinks which are listed in a [Install] section in
>   the unit file. It is OK and even expected to manually create
>   additional symlinks, or remove symlinks, as the administrator likes.
> 
> - Regardless whether systemd or SysV init scripts/unit files are used,
>   "systemctl start" and "systemctl stop" are the recommended
>   replacements for "service foo start" and "service foo stop". Howver,
>   as soon as https://bugzilla.redhat.com/show_bug.cgi?id=612728 is fixed
>   you can use the old syntax for SysV scripts too in which case the
>   right thing happens, but you'll get a blurb printed that suggests you
>   to use "systemctl" instead, the next time.
> 
> - If you want to enable and possibly start a service from the %post of
>   an RPM then use the "systemd-install enable" command, which will
>   create a few symlinks as listed in the [Install] section of the unit
>   file. On top of that you may also pass --realize=... to the command,
>   which allows you to not only enable the unit for the next boot, but
>   also have the changes take effect immediately: i.e. --realize=reload
>   is the very least you should use, which simply makes systemd aware of
>   the changed symlinks. Then, at time of %preun you should use
>   --realize=yes which makes sure the daemon is stopped in
>   deinstallation. For a few daemons it makes sense to restart them if
>   they are running already during upgrade. Use --realize=minimal for
>   those. For even others (usually very low-level ones) it might even
>   make sense to start them right-away after installation, even if they
>   were not running before. For those use --realize=maybe. But which
>   option you use really depends on the package. Most packages
>   should probably stick to --realize=yes on %preun and --realize=reload
>   in %post. Suggested .spec file fragments you find in the daemon(7) man
>   page.
> 
Normally, we don't want a service to be started just because the package has
been installed:

https://fedoraproject.org/wiki/Packaging/SysVInitScript.

This is the current recommended scriptlets:

%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add <script>

%preun
if [ $1 = 0 ] ; then
    /sbin/service <script> stop >/dev/null 2>&1
    /sbin/chkconfig --del <script>
fi

%postun
if [ "$1" -ge "1" ] ; then
    /sbin/service <script> condrestart >/dev/null 2>&1 || :
fi


I think I've got the %preun translated correctly but I'm not sure about
either the %post or %postun::

%post
# Don't need a %post as systemd automatically knows about the defaults?

%preun
if [ $1 = 0 ] ; then
    /usr/bin/systemd-install disable %{unit name}.service --realize=disable > /dev/null 2>&1 || :
fi

%postun
if [ "$1" -ge "1" ] ; then
    # Can't figure out how to do a conditional restart here.  Help?
fi

-Toshio

Attachment: pgp8Y6EwC3PCG.pgp
Description: PGP signature

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux