[gnome-continuous/wip/platform1.7: 2/4] Wrap python trigger in shell



commit 677b029dfe52d56dd0713fba1f21c8587f3ddecb
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Sep 8 11:02:55 2014 +0200

    Wrap python trigger in shell
    
    The platform component doesn't have python, so starting python
    directly from the systemd trigger fails. However, it also doesn't
    need systemd, so we wrap it in a shellscript that checks for the
    existance of python first.

 src/triggers/0008systemd-units.trigger |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/triggers/0008systemd-units.trigger b/src/triggers/0008systemd-units.trigger
index 8596b89..b01a477 100755
--- a/src/triggers/0008systemd-units.trigger
+++ b/src/triggers/0008systemd-units.trigger
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/bin/sh
 # Post-installation hook for systemd unit files; -*- mode: python; indent-tabs-mode: nil -*-
 #
 # Written by Colin Walters <walters verbum org>
@@ -18,6 +18,9 @@
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
+python --version  >/dev/null 2>&1 || { echo >&2 "No python installed, skipping."; exit 0; }
+
+python - << THEEND
 import os
 import sys
 import glob
@@ -59,3 +62,4 @@ if os.path.exists('/usr/bin/systemctl'):
             args = ['systemctl', '--' + unittype, 'preset', bn]
             print subprocess.list2cmdline(args)
             subprocess.check_call(args)
+THEEND


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