polkit: add polkit support, merge polkit-elogind back

This commit is contained in:
Enno Boland 2019-08-02 22:46:33 +02:00 committed by Enno Boland
parent 839db57c79
commit a13ad26623
7 changed files with 12 additions and 126 deletions

1
srcpkgs/polkit-elogind Symbolic link
View file

@ -0,0 +1 @@
polkit

View file

@ -1 +0,0 @@
../polkit/files

View file

@ -1,68 +0,0 @@
--- configure.ac
+++ configure.ac
@@ -99,7 +99,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
AC_SUBST(EXPAT_LIBS)
-AC_CHECK_FUNCS(clearenv fdatasync)
+AC_CHECK_FUNCS(clearenv fdatasync getnetgrent)
if test "x$GCC" = "xyes"; then
LDFLAGS="-Wl,--as-needed $LDFLAGS"
--- src/polkitbackend/polkitbackendinteractiveauthority.c
+++ src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -2228,6 +2228,7 @@ get_users_in_net_group (PolkitIdentity *group,
ret = NULL;
name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group));
+#if defined HAVE_GETNETGRENT
#ifdef HAVE_SETNETGRENT_RETURN
if (setnetgrent (name) == 0)
{
@@ -2236,6 +2237,7 @@ get_users_in_net_group (PolkitIdentity *group,
}
#else
setnetgrent (name);
+#endif
#endif
for (;;)
@@ -2248,8 +2250,10 @@ get_users_in_net_group (PolkitIdentity *group,
PolkitIdentity *user;
GError *error = NULL;
+#if defined HAVE_GETNETGRENT
if (getnetgrent (&hostname, &username, &domainname) == 0)
break;
+#endif
/* Skip NULL entries since we never want to make everyone an admin
* Skip "-" entries which mean "no match ever" in netgroup land */
@@ -2274,7 +2278,9 @@ get_users_in_net_group (PolkitIdentity *group,
ret = g_list_reverse (ret);
out:
+#if defined HAVE_GETNETGRENT
endnetgrent ();
+#endif
return ret;
}
--- src/polkitbackend/polkitbackendjsauthority.cpp
+++ src/polkitbackend/polkitbackendjsauthority.cpp
@@ -1502,6 +1502,7 @@
JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
+#if defined HAVE_GETNETGRENT
JS::RootedString usrstr (authority->priv->cx);
usrstr = args[0].toString();
user = JS_EncodeStringToUTF8 (cx, usrstr);
@@ -1521,6 +1522,7 @@
JS_free (cx, user);
ret = true;
+#endif
args.rval ().setBoolean (is_in_netgroup);

View file

@ -1,52 +0,0 @@
# Template file for 'polkit-elogind'
pkgname=polkit-elogind
version=0.116
revision=1
wrksrc="polkit-${version}"
build_style=gnu-configure
build_helper="gir"
configure_args="$(vopt_enable gir introspection) --disable-static
--with-authfw=pam --with-os-type=void --with-mozjs=mozjs-52.0"
make_dirs="
/etc/polkit-1/rules.d 0700 polkitd polkitd
/usr/share/polkit-1/rules.d 0700 polkitd polkitd"
hostmakedepends="automake libtool gettext-devel git glib-devel
gobject-introspection gtk-doc intltool pkg-config"
makedepends="elogind-devel libglib-devel mozjs60-devel pam-devel"
short_desc="Authorization Toolkit"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://www.freedesktop.org/wiki/Software/polkit"
distfiles="${FREEDESKTOP_SITE}/polkit/releases/polkit-${version}.tar.gz"
checksum=88170c9e711e8db305a12fdb8234fac5706c61969b94e084d0f117d8ec5d34b1
system_accounts="polkitd"
provides="polkit-${version}_${revision}"
replaces="polkit>=0"
# Package build options
build_options="gir"
build_options_default="gir"
pre_configure() {
autoreconf -fi
# Drop requirement of /sys/fs/cgroup/systemd test in configure... WTF.
sed -e 's,/sys/fs/cgroup/systemd/,/sys/fs/cgroup,g' -i configure
}
post_configure() {
if [ "$CROSS_BUILD" ]; then
sed -e "s#-include \(/usr/include/mozjs-52/js/RequiredDefines\.h\)#-include ${XBPS_CROSS_BASE}\1#" \
-i $(find -name Makefile)
fi
}
post_install() {
vinstall ${FILESDIR}/polkit-1.pam 644 etc/pam.d polkit-1
rm -r $DESTDIR/usr/include
rm -r $DESTDIR/usr/lib/pkgconfig
if [ "$build_option_gir" ]; then
rm -rf $DESTDIR/usr/share/gir-*
fi
rm -r $DESTDIR/usr/lib/*.so
}

View file

@ -1 +0,0 @@
pkgname=polkit

View file

@ -1,18 +1,17 @@
# Template file for 'polkit'
pkgname=polkit
version=0.116
revision=1
revision=2
build_style=gnu-configure
build_helper="gir"
configure_args="$(vopt_enable gir introspection) --disable-systemd
--disable-libsystemd-login --disable-libelogind --disable-static
configure_args="$(vopt_enable gir introspection) -disable-static
--with-authfw=pam --with-os-type=void --with-mozjs=mozjs-60.0"
make_dirs="
/etc/polkit-1/rules.d 0700 polkitd polkitd
/usr/share/polkit-1/rules.d 0700 polkitd polkitd"
hostmakedepends="autoconf-archive automake gettext-devel git glib-devel
gobject-introspection gtk-doc intltool libtool pkg-config"
makedepends="mozjs60-devel pam-devel"
makedepends="elogind-devel mozjs60-devel pam-devel"
short_desc="Authorization Toolkit"
maintainer="Rasmus Thomsen <rasmus.thomsen@protonmail.com>"
license="GPL-2.0-or-later"
@ -20,6 +19,8 @@ homepage="https://www.freedesktop.org/wiki/Software/polkit"
distfiles="${FREEDESKTOP_SITE}/${pkgname}/releases/${pkgname}-${version}.tar.gz"
checksum=88170c9e711e8db305a12fdb8234fac5706c61969b94e084d0f117d8ec5d34b1
system_accounts="polkitd"
replaces="polkit-elogind>=0"
provides="polkit-elogind-${version}_${revision}"
# Package build options
build_options="gir"
@ -55,3 +56,9 @@ polkit-devel_package() {
vmove "usr/lib/*.so"
}
}
polkit-elogind_package() {
depends="polkit>=${version}_${revision}"
build_style=meta
short_desc+=" (transitional dummy package)"
}