added consolekit2

This commit is contained in:
joborun linux 2022-10-09 17:22:47 +03:00
parent 67e9acece0
commit 15f51f47ef
12 changed files with 472 additions and 0 deletions

View File

@ -0,0 +1,8 @@
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.consolekit.system.stop" ||
action.id == "org.freedesktop.consolekit.system.restart" ||
action.id == "org.freedesktop.consolekit.system.hibernate" ||
action.id == "org.freedesktop.consolekit.system.suspend") {
return polkit.Result.YES;
}
});

110
consolekit2/PKGBUILD Normal file
View File

@ -0,0 +1,110 @@
#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=consolekit2
pkgver=1.2.4
pkgrel=02
pkgdesc="A framework for defining and tracking users, login sessions, and seats"
url="https://github.com/ConsoleKit2/ConsoleKit2"
arch=(x86_64)
target=tag
track="$pkgver"
source=("$pkgname::git+$url#$target=$track"
25-consolekit.rules
consolekit.pamd
pam-foreground-compat.ck
tmpfiles.conf
trust_runtime_admin_policy.patch
set_good_hpr_command.patch
keep_runtime_dir.patch)
options=(libtool)
depends=( dbus glib2 libx11 polkit eudev zlib popt)
optdepends=('pm-utils: support for suspend/hibernate')
makedepends=(xmlto docbook-xsl gtk-doc pam)
provides=(consolekit consolekit2)
replaces=(consolekit)
conflicts=(consolekit)
pkgver() {
cd $pkgname
git describe --tags | sed -e 's:-:+:g;'
}
prepare() {
cd $srcdir/$pkgname
patch --forward --strip=1 --input="${srcdir}/trust_runtime_admin_policy.patch"
patch --forward --strip=1 --input="${srcdir}/set_good_hpr_command.patch"
patch --forward --strip=1 --input="${srcdir}/keep_runtime_dir.patch"
}
path=(
--prefix=/usr
--sysconfdir=/etc
--sbindir=/usr/bin
--libdir=/usr/lib
--with-rundir=/run
--libexecdir=/usr/libexec/
--localstatedir=/var
)
flags=(
--enable-polkit
--enable-pam-module
--enable-udev-acl
--with-dbus-services=/usr/share/dbus-1/services
--with-dbus-sys=/usr/share/dbus-1/system.d
--with-pam-module-dir=/usr/lib/security
--with-systemdsystemunitdir=no
--disable-libcgmanager
--enable-libevdev
--enable-libudev
--with-html-dir=/usr/share/doc/consolekit/html
--disable-gtk-doc-html
--with-x
--with-xinitrc-dir=/etc/X11/Xsession.d
)
build(){
cd $srcdir/$pkgname
./autogen.sh "${path[@]}" "${flags[@]}"
make
}
package() {
cd $srcdir/$pkgname
make DESTDIR="$pkgdir" install
install -dm 700 "${pkgdir}"/usr/share/polkit-1/rules.d
install -m 644 ${srcdir}/25-consolekit.rules $pkgdir/usr/share/polkit-1/rules.d/75-consolekit.rules
install -dm755 $pkgdir/etc/pam.d/
install -Dm644 ${srcdir}/consolekit.pamd $pkgdir/etc/pam.d/consolekit
install -Dm 0755 "${srcdir}"/pam-foreground-compat.ck "${pkgdir}"/usr/lib/ConsoleKit/run-session.d/pam-foreground-compat.ck
install -Dm 0644 "${srcdir}"/tmpfiles.conf "${pkgdir}"/usr/lib/tmpfiles.d/consolekit.conf
rm -r "${pkgdir}"/run
}
#---- license gpg-key sha256sums ----
license=(GPL)
sha256sums=(SKIP
c5159d9fe8fdd52ad0d6a84af7ba00bac09edaae965896ab0d099a4df1c5ea6b # 25-consolekit.rules
f7b88e87f447e2d37c12886f57d932c385f19a8fef238e0f1de7a1746d8be69e # consolekit.pamd
7a727be018e26eb7b67df02d3dc493eaa3dafea412801d6bf4b55b4a83c9df7c # pam-foreground-compat.ck
778552dc12b3c235bde200e476d4262da0c135f3f6f8b3e975a87881d1f154d1 # tmpfiles.conf
8e4a486794ef176af3f753c3c1077e0b69a0dc5332bb3277726a7bd2cccb8e1d # trust_runtime_admin_policy.patch
780e09ccff9aca92f698e70cccd2079e3916d4b3feff27c373d6ddfe95ce6431 # set_good_hpr_command.patch
5c4340496a6370bf424135f368c5b42d1e99efbc72cc0538b102754adcc6b887) # keep_runtime_dir.patch

151
consolekit2/PKGBUILD-oba Normal file
View File

@ -0,0 +1,151 @@
# Obarun : 66 init/supervisor
# Maintainer : Eric Vidal <eric@obarun.org>
# Maintainer : Jean-Michel T.Dydak <jean-michel@obarun.org>
# Obarun PkgSrc : https://git.obarun.org/pkg/obextra/consolekit/
#--------------------------------------------------------------------------
# Website : https://github.com/ConsoleKit2/ConsoleKit2/
#--------------------------------------------------------------------------
#--DESCRIPTION---------------------------------------------------------------
pkgname=consolekit2
pkgver=1.2.4
pkgrel=2
pkgdesc="A framework for defining and tracking users, login sessions, and seats"
url="https://github.com/ConsoleKit2/ConsoleKit2"
target=tag
track="${pkgver}"
source=("$pkgname::git+$url#$target=$track"
'25-consolekit.rules'
'consolekit.pamd'
'pam-foreground-compat.ck'
'tmpfiles.conf'
'trust_runtime_admin_policy.patch'
'set_good_hpr_command.patch'
'keep_runtime_dir.patch')
#--BUILD CONFIGURATION-------------------------------------------------------
options=('libtool')
optdepends=(
'pm-utils: support for suspend/hibernate')
makedepends=(
'xmlto'
'docbook-xsl'
'gtk-doc'
'pam')
#--BUILD PREPARATION---------------------------------------------------------
pkgver() {
cd $pkgname
git describe --tags | sed -e 's:-:+:g;'
}
prepare() {
cd $srcdir/$pkgname
patch --forward --strip=1 --input="${srcdir}/trust_runtime_admin_policy.patch"
patch --forward --strip=1 --input="${srcdir}/set_good_hpr_command.patch"
patch --forward --strip=1 --input="${srcdir}/keep_runtime_dir.patch"
}
#--BUILD CONTROL----------------------------------------------------------
path=(
--prefix=/usr
--sysconfdir=/etc
--sbindir=/usr/bin
--with-rundir=/run
--libexecdir=/usr/libexec/
--localstatedir=/var
)
flags=(
--enable-polkit
--enable-pam-module
--enable-udev-acl
--with-dbus-services=/usr/share/dbus-1/services
--with-dbus-sys=/usr/share/dbus-1/system.d
--with-pam-module-dir=/usr/lib/security
--with-systemdsystemunitdir=no
--disable-libcgmanager
--enable-libevdev
--enable-libudev
--with-html-dir=/usr/share/doc/consolekit/html
--disable-gtk-doc-html
--with-x
--with-xinitrc-dir=/etc/X11/Xsession.d
)
#--BUILD---------------------------------------------------------------------
build(){
cd $srcdir/$pkgname
./autogen.sh "${path[@]}" "${flags[@]}"
make
}
#--PACKAGE-------------------------------------------------------------------
package() {
cd $srcdir/$pkgname
make DESTDIR="$pkgdir" install
install -dm 700 "${pkgdir}"/usr/share/polkit-1/rules.d
install -m 644 ${srcdir}/25-consolekit.rules $pkgdir/usr/share/polkit-1/rules.d/75-consolekit.rules
install -dm755 $pkgdir/etc/pam.d/
install -Dm644 ${srcdir}/consolekit.pamd $pkgdir/etc/pam.d/consolekit
install -Dm 0755 "${srcdir}"/pam-foreground-compat.ck "${pkgdir}"/usr/lib/ConsoleKit/run-session.d/pam-foreground-compat.ck
install -Dm 0644 "${srcdir}"/tmpfiles.conf "${pkgdir}"/usr/lib/tmpfiles.d/consolekit.conf
rm -r "${pkgdir}"/run
}
#--INSTALL CONFIGURATION-----------------------------------------------------
arch=(x86_64)
provides=(
'consolekit'
'consolekit2')
replaces=(
'consolekit')
conflicts=(
'consolekit')
depends=(
'dbus'
'glib2'
'libx11'
'polkit'
'udev'
'zlib'
'popt')
#--------------------------------------------------------------------------
license=('GPL')
sha512sums=('SKIP'
'56865e65e269cb4aec2ab6beea537c79fa62b23eec74ec40c343956f0dd5d53c30f493e732c478c6f5ceb50a16008a3176ec69c089d735b3383bcf068060dc25'
'ddc50300ec8328f1a586400d124a4f77b8267677f6804e91d62ba3a869e6e20ef192b77f009eb202d6d297c69f31ad67b47ac04fb9330dcb14aa6ad9c3030080'
'294b006a31df6e4e7e71a4292626de961c0a6408ee977a041897001fc201e4e32bc50dba70fa1ee8d3398057881cea6335b8b2fed11b5d2c079701790caa2a2f'
'1ec445433f7eee94d46609c3398c8388bb008323debc047e665e14a0c3f27a1c264460347531da124b5a907cb15ef9fdadff23aebab332b410c69b8ad1ff40b6'
'65e5d6986b56f63b7ca347b3bd80576ef765d1f49ee27f3171b160ebb196b4c4968ed32c4df1e697a31706d1f0bca39d3bb66eaa89d6603e80fa4b7e400b9f3c'
'a1dc81208940bdc392ba2a60e4871ddf11f15e7343f0b15bd2591d7436581f409d7c684291d3d91c8c978b89848e06b5f28b4c81a6c90c7afa0f2fbac48220ec'
'05f01f2f0f6b293e97c1b39f8ef75c99dbacd89df7c7a4968f1ce1331175d2eda710b5f0d43443d4afe9ab581ca9399a08ff9be607d15caef2f017427ad4d212')

1
consolekit2/clean Normal file
View File

@ -0,0 +1 @@
rm -rf {src,pkg,consolekit2}

View File

@ -0,0 +1,11 @@
#%PAM-1.0
auth include system-login
account include system-login
session include system-login
password include system-login
session optional pam_ck_connector.so nox11

12
consolekit2/deps Normal file
View File

@ -0,0 +1,12 @@
git
libx11
polkit
popt
xmlto
docbook-xsl
gtk-doc
autoconf
automake
gettext
eudev

View File

@ -0,0 +1,20 @@
diff -Nuar -uar a/src/ck-manager.c b/src/ck-manager.c
--- a/src/ck-manager.c 2019-03-19 21:50:30.000000000 +1100
+++ b/src/ck-manager.c 2019-07-21 00:30:01.451028451 +1100
@@ -3327,13 +3327,13 @@
orig_ssid,
orig_ssid);
- if (get_runtime_dir_for_user (manager, unix_user) == NULL) {
+ //if (get_runtime_dir_for_user (manager, unix_user) == NULL) {
/* We removed the session and now there's no runtime dir
* associated with that user.
* Remove the runtime dir from the system.
*/
- ck_remove_runtime_dir_for_user (unix_user);
- }
+ // ck_remove_runtime_dir_for_user (unix_user);
+ //}
ret = TRUE;
out:

View File

@ -0,0 +1,17 @@
#!/bin/sh
TAGDIR=/run/console
[ -n "$CK_SESSION_USER_UID" ] || exit 1
[ "$CK_SESSION_IS_LOCAL" = "true" ] || exit 0
TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
if [ "$1" = "session_added" ]; then
mkdir -p "$TAGDIR"
echo "$CK_SESSION_ID" >> "$TAGFILE"
fi
if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
[ -s "$TAGFILE" ] || rm -f "$TAGFILE"
fi

View File

@ -0,0 +1,34 @@
diff -Nuar -uar a/tools/linux/ck-system-restart c/tools/linux/ck-system-restart
--- a/tools/linux/ck-system-restart 2019-03-19 21:50:30.000000000 +1100
+++ c/tools/linux/ck-system-restart 2019-07-20 22:32:56.154875518 +1100
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/shutdown" ] ; then
- /sbin/shutdown -r now
- exit $?
-elif [ -x "/usr/sbin/shutdown" ] ; then
- /usr/sbin/shutdown -r now
- exit $?
-else
- exit 1
-fi
+/usr/bin/reboot
diff -Nuar -uar a/tools/linux/ck-system-stop c/tools/linux/ck-system-stop
--- a/tools/linux/ck-system-stop 2019-03-19 21:50:30.000000000 +1100
+++ c/tools/linux/ck-system-stop 2019-07-20 22:35:29.281538892 +1100
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/shutdown" ] ; then
- /sbin/shutdown -h now
- exit $?
-elif [ -x "/usr/sbin/shutdown" ] ; then
- /usr/sbin/shutdown -h now
- exit $?
-else
- exit 1
-fi
+/usr/bin/poweroff

6
consolekit2/time Normal file
View File

@ -0,0 +1,6 @@
real 0m30.295s
user 0m26.932s
sys 0m2.650s

View File

@ -0,0 +1 @@
d /run/ConsoleKit 0755 - - -

View File

@ -0,0 +1,101 @@
diff -Nuar -uar a/src/ck-sysdeps-unix.c b/src/ck-sysdeps-unix.c
--- a/src/ck-sysdeps-unix.c 2019-03-19 21:50:30.000000000 +1100
+++ b/src/ck-sysdeps-unix.c 2019-07-19 00:54:37.011751960 +1100
@@ -403,11 +403,17 @@
create_rundir_base (guint uid)
{
const gchar *base;
-
+ struct stat st ;
TRACE ();
base = RUNDIR "/user";
-
+
+ if (stat(base,&st) == -1) {
+ g_warning ("unable to stat %s, reason was: %s",base,strerror(errno)) ;
+ errno = 0 ;
+ return FALSE ;
+ }
+ if (S_ISDIR(st.st_mode)) return TRUE ;
/* Create the base directory that we will own. */
if (g_mkdir_with_parents (base, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
g_warning ("Failed to create %s, reason was: %s", base, strerror(errno));
@@ -459,7 +465,7 @@
{
gchar *dest;
struct passwd *pwent;
-
+ struct stat st ;
TRACE ();
errno = 0;
@@ -476,33 +482,41 @@
}
dest = get_rundir (uid);
-
- /* Ensure any files from the last session are removed */
- if (g_file_test (dest, G_FILE_TEST_EXISTS) == TRUE) {
- remove_rundir (uid, dest);
- }
-
- /* Create the new directory */
- if (g_mkdir_with_parents (dest, S_IRWXU) != 0) {
- g_warning ("Failed to create XDG_RUNTIME_DIR, reason was: %s", strerror(errno));
- errno = 0;
- g_free (dest);
- return NULL;
- }
-
- g_debug ("setting uid %d, gid %d", uid, pwent->pw_gid);
-
- /* assign ownership to the user */
- if (chown (dest, uid, pwent->pw_gid) != 0) {
- g_warning ("Failed to chown XDG_RUNTIME_DIR, reason was: %s", strerror(errno));
- errno = 0;
- g_free (dest);
- return NULL;
- }
-
- /* attempt to make it a small tmpfs location */
- ck_make_tmpfs (uid, pwent->pw_gid, dest);
-
+ if (stat(dest,&st) == -1) {
+ g_warning ("unable to stat %s, reason was: %s",dest,strerror(errno)) ;
+ errno = 0 ;
+ return NULL ;
+ }
+ /** if administrator have already set rundir, we
+ * trust him */
+ if (!S_ISDIR(st.st_mode)) {
+ /* Ensure any files from the last session are removed */
+ if (g_file_test (dest, G_FILE_TEST_EXISTS) == TRUE) {
+ remove_rundir (uid, dest);
+ }
+
+ /* Create the new directory */
+ if (g_mkdir_with_parents (dest, S_IRWXU) != 0) {
+ g_warning ("Failed to create XDG_RUNTIME_DIR, reason was: %s", strerror(errno));
+ errno = 0;
+ g_free (dest);
+ return NULL;
+ }
+
+ g_debug ("setting uid %d, gid %d", uid, pwent->pw_gid);
+
+ /* assign ownership to the user */
+ if (chown (dest, uid, pwent->pw_gid) != 0) {
+ g_warning ("Failed to chown XDG_RUNTIME_DIR, reason was: %s", strerror(errno));
+ errno = 0;
+ g_free (dest);
+ return NULL;
+ }
+
+ /* attempt to make it a small tmpfs location */
+ ck_make_tmpfs (uid, pwent->pw_gid, dest);
+ }
+
return dest;
}