[gnome-ostree] Add a trigger for processing systemd unit [Install] sections



commit bfffae542dd3a7357907d6944a671e8c08bd5eef
Author: Colin Walters <walters verbum org>
Date:   Thu Aug 15 18:25:57 2013 -0400

    Add a trigger for processing systemd unit [Install] sections
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706022

 Makefile-ostbuild.am                   |    1 +
 src/triggers/0008systemd-units.trigger |   39 ++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index 6a3d23b..ae6552c 100644
--- a/Makefile-ostbuild.am
+++ b/Makefile-ostbuild.am
@@ -42,6 +42,7 @@ triggersdir = $(pkglibdir)/triggers
 triggers_SCRIPTS = \
        src/triggers/0001ldconfig.trigger \
        src/triggers/0005depmod.trigger \
+       src/triggers/0008systemd-units.trigger \
        src/triggers/0010mime-database.trigger \
        src/triggers/0020dconf.trigger \
        src/triggers/0030glib.trigger \
diff --git a/src/triggers/0008systemd-units.trigger b/src/triggers/0008systemd-units.trigger
new file mode 100755
index 0000000..b3fb624
--- /dev/null
+++ b/src/triggers/0008systemd-units.trigger
@@ -0,0 +1,39 @@
+#!/bin/bash
+# Post-installation hook for systemd unit files; -*- mode: sh -*-
+#
+# Written by Colin Walters <walters verbum org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+if test -x "$(which systemctl 2>/dev/null)"; then
+    # FIXME - need to make user presets work too
+    for unittype in system; do 
+       path=/usr/lib/systemd/${unittype}
+       if test -d ${path}; then
+           for unitname in ${path}/*.service; do
+               if test '!' -L ${unitname} &&
+                   ! echo ${unitname} | grep -q '@\.service$' &&
+                   grep -q '^\[Install\]' ${unitname}; then
+                   bn=$(basename ${unitname})
+                   echo systemctl --${unittype} preset ${bn}
+                   systemctl --${unittype} preset ${bn}
+               fi
+           done
+       fi
+    done
+fi


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