diff options
author | Ian Stakenvicius <axs@gentoo.org> | 2011-12-14 20:23:55 +0000 |
---|---|---|
committer | Ian Stakenvicius <axs@gentoo.org> | 2011-12-14 20:23:55 +0000 |
commit | ee6985e6247e8ddcecbd185360dd173585f468e3 (patch) | |
tree | 794022e1a5ddbc3d72d3ebffdf50dd4af426c8c0 /x11-misc/slim/files | |
parent | remove old versions (diff) | |
download | historical-ee6985e6247e8ddcecbd185360dd173585f468e3.tar.gz historical-ee6985e6247e8ddcecbd185360dd173585f468e3.tar.bz2 historical-ee6985e6247e8ddcecbd185360dd173585f468e3.zip |
Added experimental native consolekit support via -r7, and removed old -r5 ebuild as -r6 is stable on some archs
Package-Manager: portage-2.1.10.11/cvs/Linux i686
Diffstat (limited to 'x11-misc/slim/files')
-rw-r--r-- | x11-misc/slim/files/Xsession-r3 | 158 | ||||
-rw-r--r-- | x11-misc/slim/files/slim-1.3.2-ck.patch | 186 |
2 files changed, 344 insertions, 0 deletions
diff --git a/x11-misc/slim/files/Xsession-r3 b/x11-misc/slim/files/Xsession-r3 new file mode 100644 index 000000000000..237fb3630661 --- /dev/null +++ b/x11-misc/slim/files/Xsession-r3 @@ -0,0 +1,158 @@ +#!/bin/sh +# +# Slim login manager Xsession script +# + +command="$@" + +# this will go into slim.log along with all other echo's +# good for debugging where things go wrong +echo "$0: Beginning session setup..." + +# First read /etc/profile and .profile +test -f /etc/profile && . /etc/profile +test -f "$HOME/.profile" && . "$HOME/.profile" +# Second read /etc/xprofile and .xprofile for X specific setup +test -f /etc/xprofile && . /etc/xprofile +test -f "$HOME/.xprofile" && . "$HOME/.xprofile" + +# wrap possible arguments to determine whether to treat special or not +if [ "x$command" = "xcustom" ] || [ "x$command" = "xCustom" ] || [ "x$command" = "xdefault" ] || [ "x$command" = "xDefault" ]; then + command="Xsession" +fi +if [ "x$command" = "x" ]; then + # no default specified, check if Xsession will complete + # and if not then assign XSESSION to command + if [ -x "$HOME/.xsession" ] || [ -x "$HOME/.Xclients" ] || [ -x /etc/X11/xinit/Xclients ] || [ -x /etc/X11/Xclients ]; then + command="Xsession" + else + command=$XSESSION + fi +fi + +# most of this is from /etc/X11/chooser.sh +sessionscript="" +if [ -n "${command}" ]; then + # find a match for $command in /etc/X11/Sessions + for x in /etc/X11/Sessions/* ; do + if [ "`echo ${x##*/} | awk '{ print toupper($1) }'`" = "`echo ${command} | awk '{ print toupper($1) }'`" ]; then + sessionscript=${x} + break + fi + done + if [ -n "${sessionscript}" ]; then + if [ -x "${sessionscript}" ]; then + command="${sessionscript}" + else + command="/bin/sh ${sessionscript}" + fi + else + + # find an executable for $command + x="" + y="" + + for x in "${command}" "`echo ${command} | awk '{ print toupper($1) }'`" "`echo ${command} | awk '{ print tolower($1) }'`" + do + # Fall through ... + if [ -x "`which ${x} 2>/dev/null`" ]; then + y="`which ${x} 2>/dev/null`" + break + fi + done + # note , if the command could not be found then $command will be empty + command="$y" + unset x + unset y + fi +fi + +# call xrdb and xmodmap and such, since $command is not a session script +if [ -z "${sessionscript}" ]; then + userresources="$HOME/.Xresources" + usermodmap="$HOME/.Xmodmap" + userxkbmap="$HOME/.Xkbmap" + + sysresources=/etc/X11/Xresources + sysmodmap=/etc/X11/Xmodmap + sysxkbmap=/etc/X11/Xkbmap + + rh6sysresources=/etc/X11/xinit/Xresources + rh6sysmodmap=/etc/X11/xinit/Xmodmap + + # merge in defaults + if [ -f "$rh6sysresources" ]; then + xrdb -merge "$rh6sysresources" + fi + + if [ -f "$sysresources" ]; then + xrdb -merge "$sysresources" + fi + + if [ -f "$userresources" ]; then + xrdb -merge "$userresources" + fi + + # merge in keymaps + if [ -f "$sysxkbmap" ]; then + setxkbmap `cat "$sysxkbmap"` + XKB_IN_USE=yes + fi + + if [ -f "$userxkbmap" ]; then + setxkbmap `cat "$userxkbmap"` + XKB_IN_USE=yes + fi + + # + # Eeek, this seems like too much magic here + # + if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then + if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then + xkbsymbols=`sed -n -e 's/^[ ]*XkbSymbols[ ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config` + if [ -n "$xkbsymbols" ]; then + setxkbmap -symbols "$xkbsymbols" + XKB_IN_USE=yes + fi + fi + fi + + # xkb and xmodmap don't play nice together + if [ -z "$XKB_IN_USE" ]; then + if [ -f "$rh6sysmodmap" ]; then + xmodmap "$rh6sysmodmap" + fi + + if [ -f "$sysmodmap" ]; then + xmodmap "$sysmodmap" + fi + + if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" + fi + fi + + unset XKB_IN_USE +fi +unset sessionscript + +# start failsafe session +if [ -z "${command}" ]; then + echo "$0: Failed to find a command to start the session, so starting a failsafe xterm." + exec xterm -geometry 80x24+0+0 +fi + +# run all system xinitrc shell scripts which will update command +if [ -d /etc/X11/xinit/xinitrc.d ]; then + for i in /etc/X11/xinit/xinitrc.d/* ; do + if [ -x "$i" ]; then + . "$i" + fi + done + unset i +fi + +echo "$0: Setup done, will execute: $command" +exec $command + +# vim:ts=4 diff --git a/x11-misc/slim/files/slim-1.3.2-ck.patch b/x11-misc/slim/files/slim-1.3.2-ck.patch new file mode 100644 index 000000000000..b5f4aa517ff2 --- /dev/null +++ b/x11-misc/slim/files/slim-1.3.2-ck.patch @@ -0,0 +1,186 @@ +diff -Naur slim-1.3.2/app.cpp slim-1.3.2.new/app.cpp +--- slim-1.3.2/app.cpp 2011-12-14 14:33:45.000000000 -0500 ++++ slim-1.3.2.new/app.cpp 2011-12-14 13:25:19.000000000 -0500 +@@ -536,6 +536,60 @@ + string xauthority = pw->pw_dir; + xauthority.append("/.Xauthority"); + ++#ifdef USE_CONSOLEKIT ++ cerr << APPNAME << ": consolekit support enabled" << endl; ++ int ret; ++ DBusError error; ++ char *remote_host_name = ""; ++ dbus_bool_t is_local; ++ char *display_device = ""; ++ //char devtmp[16]; ++ ++ // if (!use_consolekit) return 1; ++ cerr << APPNAME << ": initializing a consolekit session" << endl; ++ ++ is_local = TRUE; //is_local = Dpy->displayType.location == Local; ++ //if (Dpy->peerlen > 0 && Dpy->peer) ++ //remote_host_name = Dpy->peer; ++ /* how can we get the corresponding tty at best...? */ ++// if (Dpy->windowPath) { ++// display_device = strchr(Dpy->windowPath, ':'); ++// if (display_device && display_device[1]) ++// display_device++; ++// else ++// display_device = Dpy->windowPath; ++// snprintf(devtmp, sizeof(devtmp), "/dev/tty%s", display_device); ++// display_device = devtmp; ++display_device = dpy_tty; // } ++ ++ ckconnector = ck_connector_new(); ++ if (!ckconnector) { ++ cerr << APPNAME << ": ck_connector not initialized" << endl; ++ //return 0; ++ } ++ ++ dbus_error_init(&error); ++ ret = ck_connector_open_session_with_parameters( ++ ckconnector, &error, ++ "unix-user", &pw->pw_uid, ++ "x11-display", &DisplayName, ++ "x11-display-device", &display_device, ++ "remote-host-name", &remote_host_name, ++ "is-local", &is_local, ++ NULL); ++ if (!ret) { ++ if (dbus_error_is_set(&error)) { ++ cerr << APPNAME << ": Dbus error: " << error.message << endl; ++ dbus_error_free(&error); ++ } else { ++ cerr << APPNAME << ": ConsoleKit error" << endl; ++ } ++ cerr << APPNAME << ": console-kit-daemon not running?" << endl; ++ ck_connector_unref(ckconnector); ++ ckconnector = NULL; ++ } ++#endif ++ + #ifdef USE_PAM + // Setup the PAM environment + try{ +@@ -548,6 +602,8 @@ + pam.setenv("DISPLAY", DisplayName); + pam.setenv("MAIL", maildir.c_str()); + pam.setenv("XAUTHORITY", xauthority.c_str()); ++ pam.setenv("XDG_SESSION_COOKIE", ck_connector_get_cookie(ckconnector)); ++ cerr << APPNAME << ": ck_connector has XDG_SESSION_COOKIE of " << ck_connector_get_cookie(ckconnector) << endl; + } + catch(PAM::Exception& e){ + cerr << APPNAME << ": " << e << endl; +@@ -564,7 +620,11 @@ + char** child_env = pam.getenvlist(); + pam.end(); + #else ++#if USE_CONSOLEKIT ++ const int Num_Of_Variables = 11; // Number of env. variables + 1 ++#else + const int Num_Of_Variables = 10; // Number of env. variables + 1 ++#endif + char** child_env = static_cast<char**>(malloc(sizeof(char*)*Num_Of_Variables)); + int n = 0; + if(term) child_env[n++]=StrConcat("TERM=", term); +@@ -576,6 +636,10 @@ + child_env[n++]=StrConcat("DISPLAY=", DisplayName); + child_env[n++]=StrConcat("MAIL=", maildir.c_str()); + child_env[n++]=StrConcat("XAUTHORITY=", xauthority.c_str()); ++#if USE_CONSOLEKIT ++ child_env[n++]=StrConcat("XDG_SESSION_COOKIE=", ck_connector_get_cookie(ckconnector)); ++ cerr << APPNAME << ": ck_connector has XDG_SESSION_COOKIE of " << ck_connector_get_cookie(ckconnector) << endl; ++#endif + child_env[n++]=0; + #endif + +@@ -617,6 +681,28 @@ + } + } + ++#ifdef USE_CONSOLEKIT ++ ++ //DBusError error; ++ ++ // if (!ckconnector) ++ //return; ++ ++ //dbus_error_init(&error); ++ if (!ck_connector_close_session(ckconnector, &error)) { ++ if (dbus_error_is_set(&error)) { ++ cerr << APPNAME << ": Dbus error: " << error.message << endl; ++ dbus_error_free(&error); ++ } else { ++ cerr << APPNAME << ": ConsoleKit close error" << endl; ++ } ++ cerr << APPNAME << ": console-kit-daemon not running?" << endl; ++ } ++ ck_connector_unref(ckconnector); ++ ckconnector = NULL; ++ //} ++#endif ++ + #ifdef USE_PAM + try{ + pam.close_session(); +@@ -881,12 +967,18 @@ + bool ok = false; + Cfg::string2int(server[i]+2, &ok); + if (ok) { ++#ifdef USE_CONSOLEKIT ++ sprintf(dpy_tty,"/dev/tty%d",atoi(server[i]+2)); ++#endif + hasVtSet = true; + } + } + } + + if (!hasVtSet && daemonmode) { ++#ifdef USE_CONSOLEKIT ++ sprintf(dpy_tty,"/dev/tty7"); ++#endif + server[argc++] = (char*)"vt07"; + } + server[argc] = NULL; +diff -Naur slim-1.3.2/app.h slim-1.3.2.new/app.h +--- slim-1.3.2/app.h 2011-12-14 14:33:45.000000000 -0500 ++++ slim-1.3.2.new/app.h 2011-12-14 11:51:39.000000000 -0500 +@@ -27,6 +27,10 @@ + #ifdef USE_PAM + #include "PAM.h" + #endif ++#ifdef USE_CONSOLEKIT ++#include <ck-connector.h> ++#include <dbus/dbus.h> ++#endif + + class App { + public: +@@ -81,6 +85,12 @@ + #ifdef USE_PAM + PAM::Authenticator pam; + #endif ++#ifdef USE_CONSOLEKIT ++ CkConnector *ckconnector; ++ int use_consolekit; ++ char dpy_tty[16]; ++#endif ++ + + // Options + char* DispName; +diff -Naur slim-1.3.2/Makefile slim-1.3.2.new/Makefile +--- slim-1.3.2/Makefile 2011-12-14 14:33:45.000000000 -0500 ++++ slim-1.3.2.new/Makefile 2011-12-14 11:43:02.000000000 -0500 +@@ -13,6 +13,11 @@ + LDFLAGS+= -lpam + CUSTOM+= -DUSE_PAM + endif ++ifdef USE_CONSOLEKIT ++LDFLAGS+= `pkg-config --libs ck-connector` ++CFLAGS+= `pkg-config --cflags ck-connector` ++CUSTOM+= -DUSE_CONSOLEKIT ++endif + PREFIX=/usr + CFGDIR=/etc + MANDIR=/usr/share/man |