Skip to content

Commit

Permalink
fixed: policykit has been depracated on Maverick in favor ov policyki…
Browse files Browse the repository at this point in the history
…t-1.

This means that our dep was broken in Maverick, and the old policykit
script would not work anyway. Use a pkla file for distros >= Maverick.
Ping ceros and lcapriotti for review.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@34993 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
theuni committed Oct 24, 2010
1 parent 28795eb commit 1b8bc9a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
1 change: 0 additions & 1 deletion debian/control
Expand Up @@ -56,7 +56,6 @@ Description: XBMC Media Center (full metapackage)
Package: xbmc-live
Architecture: any
Depends: xbmc-standalone (= ${binary:Version}),
policykit,
openssh-server,
${python:Depends},
python-apt,
Expand Down
9 changes: 8 additions & 1 deletion debian/var_info
Expand Up @@ -35,7 +35,6 @@ case "$1" in
;;
XBMC_LIVE_DEPENDS)
XBMC_LIVE_DEPENDS="xbmc-standalone (= \${binary:Version}),
policykit,
openssh-server,
\${python:Depends},
python-apt,
Expand All @@ -53,6 +52,14 @@ case "$1" in
XBMC_LIVE_DEPENDS="$XBMC_LIVE_DEPENDS
mkpasswd,"
fi
if [ $(lsb_release -cs) = "maverick" ]; then
XBMC_LIVE_DEPENDS="$XBMC_LIVE_DEPENDS
policykit-1,"
else
XBMC_LIVE_DEPENDS="$XBMC_LIVE_DEPENDS
policykit,"
fi

printf "$XBMC_LIVE_DEPENDS"
;;
LIBVDPAU_DEPENDS)
Expand Down
18 changes: 14 additions & 4 deletions debian/xbmc-live.postinst
Expand Up @@ -4,6 +4,7 @@
# see: dh_installdeb(1)

set -e
release="$(lsb_release -r | cut -f2 | sed 's/\.//')"

case "$1" in
configure)
Expand Down Expand Up @@ -125,8 +126,18 @@ ENDOFBLOCK
rm $SUDOERS_TEMPFILE
rm $SUDOERSBLOCK_TEMPFILE

# Our set of PolicyKit actions

#Maverick no longer has polkit-auth, we have to use a .pkla file instead
if [ $release -ge 1010 ]; then
cat > /var/lib/polkit-1/localauthority/50-local.d/20-xbmclive.pkla <<ENDOFBLOCK
# Policy to allow the livecd user to bypass policykit. Should be installed at /var/lib/polkit-1/localauthority/50-local.d/20-xbmclive.pkla
[XBMC-Live user permissions]
Identity=unix-user:xbmc
Action=*
ResultAny=no
ResultInactive=no
ResultActive=yes
ENDOFBLOCK
else
# This is a list of actions that the 'xbmc' user should be allowed to
# do. If we missed one, or we have one that's not necessary, please
# submit a bug report.
Expand Down Expand Up @@ -191,7 +202,7 @@ ENDOFBLOCK
polkit-auth --user $xbmcUser --grant $ACTION
fi
done

fi
if ! grep -i -q XBMCLive /etc/lsb-release ; then
sed -i -e "/^DISTRIB_DESCRIPTION/s/\"\(.*\)\"/\"\1 - XBMCLive\"/" /etc/lsb-release
fi
Expand Down Expand Up @@ -223,7 +234,6 @@ ENDOFBLOCK
esac

# Upstart scripts tested on karmic+ only (>=9.10) and not backward compatible ATM
release="$(lsb_release -r | cut -f2 | sed 's/\.//')"
if [ $release -ge 910 ]; then
if [ -f "/etc/init.d/xbmc-live" ]; then
update-rc.d -f xbmc-live remove >/dev/null
Expand Down
8 changes: 7 additions & 1 deletion debian/xbmc-live.postrm
Expand Up @@ -4,6 +4,7 @@
# see: dh_installdeb(1)

set -e
release="$(lsb_release -r | cut -f2 | sed 's/\.//')"
if [ "$1" = "purge" ]; then
SUDOERS_TEMPFILE=$(mktemp -q)

Expand All @@ -27,6 +28,11 @@ if [ "$1" = "purge" ]; then
# Remove XBMC sudoers files
rm $SUDOERS_TEMPFILE

if [ $release -ge 1010 ]; then
if [ -f " /var/lib/polkit-1/localauthority/50-local.d/20-xbmclive.pkla" ]; then
rm "/var/lib/polkit-1/localauthority/50-local.d/20-xbmclive.pkla" > /dev/null
fi
else
POLKIT_ACTIONS="org.freedesktop.hal.dockstation.undock
org.freedesktop.hal.wol.enabled
org.freedesktop.hal.wol.enable
Expand Down Expand Up @@ -81,7 +87,7 @@ if [ "$1" = "purge" ]; then
polkit-auth --user xbmc --revoke $ACTION
fi
done

fi
sed -i s/allowed_users=anybody/allowed_users=console/ /etc/X11/Xwrapper.config
if [ -f "/etc/X11/Xwrapper.config.bak-xbmc-live" ]; then
rm /etc/X11/Xwrapper.config.bak-xbmc-live > /dev/null
Expand Down

0 comments on commit 1b8bc9a

Please sign in to comment.