[SCM] xbmc packaging branch, master, updated. upstream/9.11.svn25484.beta2.deb1-66-g24da732

ceros-guest at users.alioth.debian.org ceros-guest at users.alioth.debian.org
Sun Dec 13 02:18:21 UTC 2009


The following commit has been merged in the master branch:
commit 24da732c9bb93313a63333fb125ae6ee0309c6d7
Author: Andres Mejia <mcitadel at gmail.com>
Date:   Sat Dec 12 19:46:06 2009 -0500

    Allow xbmc-live maintainer scripts to cope with a missing /etc/sudoers file.

diff --git a/debian/xbmc-live.postinst b/debian/xbmc-live.postinst
index 4d9cf9c..580c3fa 100755
--- a/debian/xbmc-live.postinst
+++ b/debian/xbmc-live.postinst
@@ -69,14 +69,43 @@ ENDOFBLOCK
 
 	SUDOERS_TEMPFILE=$(mktemp -q)
 
+	# Simply create a sudoers file if none exists
+	if [ ! -e /etc/sudoers ]; then
+	    cat > /etc/sudoers <<ENDOFBLOCK
+# /etc/sudoers
+#
+# This file MUST be edited with the 'visudo' command as root.
+#
+# See the man page for details on how to write a sudoers file.
+#
+
+Defaults        env_reset
+
+# Host alias specification
+
+# User alias specification
+
+# Cmnd alias specification
+
+# User privilege specification
+root    ALL=(ALL) ALL
+
+# Uncomment to allow members of group sudo to not need a password
+# (Note that later entries override this, so you might need to move
+# it further down)
+%sudo ALL=NOPASSWD: ALL
+ENDOFBLOCK
+	    chmod 0440 /etc/sudoers
+	fi
+
 	# Add xbmc to the sudoers file (if not already done)
-	if ! grep -i -q XBMC-specific /etc/sudoers ; then 
+	if ! grep -i -q XBMC-specific /etc/sudoers ; then
 		cat /etc/sudoers $SUDOERSBLOCK_TEMPFILE > $SUDOERS_TEMPFILE
 
 		# Check if sudoers file is ok with visudo and write to /etc/sudoers if
 		# it is ok, else display a message to the user.
 		if visudo -c -f $SUDOERS_TEMPFILE >/dev/null 2>&1; then
-			cp $SUDOERS_TEMPFILE /etc/sudoers
+			cp -f $SUDOERS_TEMPFILE /etc/sudoers
 		else
 			# TODO: Use debconf for this message.
 			echo "Couldn't edit /etc/sudoers, must be manually edited."
@@ -89,7 +118,6 @@ ENDOFBLOCK
 	rm $SUDOERS_TEMPFILE
 	rm $SUDOERSBLOCK_TEMPFILE
 
-
 	# Our set of PolicyKit actions
 
 	# This is a list of actions that the 'xbmc' user should be allowed to
diff --git a/debian/xbmc-live.postrm b/debian/xbmc-live.postrm
index f1516cb..c1e14c8 100755
--- a/debian/xbmc-live.postrm
+++ b/debian/xbmc-live.postrm
@@ -7,8 +7,8 @@ set -e
 if [ "$1" = "purge" ]; then
 	SUDOERS_TEMPFILE=$(mktemp -q)
 
-	# Add xbmc to the sudoers file (if not already done)
-	if ! grep -i -q XBMC-specific /etc/sudoers ; then 
+	# Remove xbmc specific entries from /etc/sudoers
+	if test -r /etc/sudoers && grep -i -q XBMC-specific /etc/sudoers ; then
 		cat /etc/sudoers > $SUDOERS_TEMPFILE
 
 		sed -i -e "/XBMC/d" $SUDOERS_TEMPFILE
@@ -24,6 +24,9 @@ if [ "$1" = "purge" ]; then
 		fi
 	fi
 
+	# Remove XBMC sudoers files
+	rm $SUDOERS_TEMPFILE
+
 	POLKIT_ACTIONS="org.freedesktop.hal.dockstation.undock
 		org.freedesktop.hal.wol.enabled
 		org.freedesktop.hal.wol.enable

-- 
xbmc packaging



More information about the pkg-multimedia-commits mailing list