[SCM] flumotion/master: Use 'sudo' if possible (Closes: #722599)

zmoelnig-guest at users.alioth.debian.org zmoelnig-guest at users.alioth.debian.org
Fri Jan 31 16:28:03 UTC 2014


The following commit has been merged in the master branch:
commit 0575346348a266b609ced75b9b8e6f934216dbeb
Author: IOhannes m zmölnig <zmoelnig at iem.at>
Date:   Fri Jan 31 17:27:11 2014 +0100

    Use 'sudo' if possible (Closes: #722599)
    
    in some case 'su' seems to make trouble...

diff --git a/debian/control.in b/debian/control.in
index aed5f7f..f3058ef 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -44,6 +44,7 @@ Depends: ${python:Depends},
          gstreamer0.10-ffmpeg
 Recommends: python-gnome2,
          gstreamer0.10-alsa [linux-any]
+Suggests: sudo
 Description: Fluendo Streaming Server - manager, worker and admin
  Flumotion is a modern streaming media server built with a modular
  distributed design. This gives you unprecedented stability and
diff --git a/debian/flumotion.init b/debian/flumotion.init
index f4a4c16..2ff6b8a 100644
--- a/debian/flumotion.init
+++ b/debian/flumotion.init
@@ -26,6 +26,9 @@ SCRIPTNAME="/etc/init.d/$NAME"
 
 FLUMOTION_STATEDIR=/var/run/flumotion
 
+SUDO="/usr/bin/sudo"
+[ -x "$SUDO" ] || SUDO=""
+
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
 
@@ -40,11 +43,15 @@ FLUMOTION_STATEDIR=/var/run/flumotion
 . /lib/lsb/init-functions
 
 user_do() {
-	# set an umask for log files
-	# unset HOME as otherwise flumotion uses $HOME/.flumotion as its cache
-	# dir
-	su -s /bin/sh -c "umask 026; unset HOME; $1" flumotion
-	return "$?"
+        # set an umask for log files
+        # unset HOME as otherwise flumotion uses $HOME/.flumotion as its cache
+        # dir
+        if [ "x${SUDO}" = "x" ]; then
+          su -s /bin/sh -c "umask 026; unset HOME; $1" flumotion
+        else
+          ${SUDO} -s /bin/sh -c "umask 026; unset HOME; $1" -u flumotion
+        fi
+        return "$?"
 }
 
 #

-- 
flumotion packaging



More information about the pkg-multimedia-commits mailing list