aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/policykit/policykit_0.9.bb
blob: 889756d379807ecaedee77610405a31b64fe52c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
HOMEPAGE = "http://www.packagekit.org/"
DEPENDS = "libpam expat dbus-glib intltool-native"

PR = "r8"

SRC_URI = "http://hal.freedesktop.org/releases/PolicyKit-${PV}.tar.gz \
           file://PolicyKit.conf \
          "

EXTRA_OECONF = "--with-authfw=pam --with-os-type=moblin --disable-man-pages --disable-gtk-doc"

S = "${WORKDIR}/PolicyKit-${PV}"

inherit autotools pkgconfig

do_install_append () {
	install -m 0644 ${WORKDIR}/PolicyKit.conf ${D}${sysconfdir}/PolicyKit/PolicyKit.conf
	install -d ${D}${localstatedir}/run/PolicyKit
}

FILES_${PN} += " ${datadir}/dbus-1 \
                 ${datadir}/PolicyKit \
                 ${localstatedir}/run/PolicyKit \
"

pkg_postinst_${PN} () {
    # can't do this offline
    if [ "x$D" != "x" ]; then
        exit 1
    fi
    grep "^polkituser:" /etc/group > /dev/null || addgroup polkituser
    grep "^polkituser:" /etc/passwd > /dev/null || adduser --disabled-password --system --home /var/run/polkit polkituser --ingroup polkituser -g polkituser 

	echo "d root polkituser 0770 /var/run/PolicyKit none" > /etc/default/volatiles/98_policykit
	rm -f /etc/volatile.cache 

	# Fix owners
	for i in /var/lib/PolicyKit /usr/libexec/polkit-read-auth-helper /usr/libexec/polkit-revoke-helper /usr/libexec/polkit-grant-helper /usr/libexec/polkit-explicit-grant-helper /usr/libexec/polkit-grant-helper-pam ; do
		chown root:polkituser $i
	done

	for i in /var/lib/PolicyKit-public /usr/libexec/polkit-set-default-helper ; do
		chown polkituser:root $i
	done

	chown polkituser:polkituser /var/lib/misc/PolicyKit.reload
	chown root:root /usr/libexec/polkit-resolve-exe-helper
 
	# Fix permissions
	for i in /var/run/PolicyKit /var/lib/PolicyKit ; do
		chmod 770 $i
	done

	chmod 755 /var/lib/PolicyKit-public
	chmod 775 /var/lib/misc/PolicyKit.reload

	for i in /usr/libexec/polkit-read-auth-helper /usr/libexec/polkit-revoke-helper /usr/libexec/polkit-grant-helper /usr/libexec/polkit-explicit-grant-helper ; do
		chmod 2755 $i
	done

	for i in /usr/libexec/polkit-set-default-helper /usr/libexec/polkit-resolve-exe-helper ; do
		chmod 4755 $i
	done

	chmod 4754 /usr/libexec/polkit-grant-helper-pam

	DBUSPID=`pidof dbus-daemon`
    if [ "x$DBUSPID" != "x" ]; then
        /etc/init.d/dbus-1 force-reload
    fi
}

pkg_postrm_${PN} () {
    deluser polkituser || true
    delgroup polkituser || true
	rm -f /etc/default/volatiles/98_policykit
    rm -f /etc/volatile.cache  
}

SRC_URI[md5sum] = "802fd13ae41f73d79359e5ecb0a98716"
SRC_URI[sha256sum] = "f40c7c6bec19d7dba2335bddcffd0457494409a0dfce11d888c748dc892e80b7"