[Frugalware-git] pacman-g2: man FrugalBuild: document handling systemd services
Miklos Vajna
vmiklos at frugalware.org
Fri Mar 4 13:19:36 CET 2011
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=ab5e84315006ee5550783633a24b7ef1dac55b02
commit ab5e84315006ee5550783633a24b7ef1dac55b02
Author: Miklos Vajna <vmiklos at frugalware.org>
Date: Fri Mar 4 13:12:30 2011 +0100
man FrugalBuild: document handling systemd services
man 7 daemon mentions rpm only, document the pacman equivalent here
diff --git a/doc/FrugalBuild.txt b/doc/FrugalBuild.txt
index 97103da..e214fe0 100644
--- a/doc/FrugalBuild.txt
+++ b/doc/FrugalBuild.txt
@@ -471,6 +471,48 @@ subpackage.
NOTE: Don't use a trailing slash when defining file patterns with wildcards in
it!
+=== Systemd services
+
+Use a snippet like the following to enable/disable the service during
+installation/deinstallation:
+
+----
+post_install()
+{
+ chkconfig --add rc.foobar
+ # On install (not upgrade), enable (but don't start) the
+ # units by default
+ systemctl enable foobar.service >/dev/null 2>&1
+}
+
+post_upgrade()
+{
+ # Reload init system configuration, to make systemd honour changed
+ # unit files
+ systemctl daemon-reload >/dev/null 2>&1
+ if [ `vercmp $2 4.4-5` -lt 0 ]; then
+ if chkconfig rc.foobar; then
+ post_install
+ fi
+ fi
+}
+
+pre_remove()
+{
+ chkconfig --del rc.foobar
+ # On uninstall (not upgrade), disable and stop the units
+ systemctl --no-reload disable foobar.service >/dev/null 2>&1
+ systemctl stop foobar.service >/dev/null 2>&1
+}
+
+post_remove()
+{
+ # Reload init system configuration, to make systemd honour
+ # deleted unit files
+ systemctl daemon-reload >/dev/null 2>&1
+}
+----
+
== SEE ALSO
*makepkg*(8), *pacman-g2*(8)
More information about the Frugalware-git
mailing list