add wayland session manager

This commit is contained in:
DanyLE
2025-03-08 21:52:32 +01:00
parent e7fbad271f
commit 4ec5c71110
8 changed files with 205 additions and 4 deletions

View File

@ -0,0 +1,24 @@
# this file is the configuration file for the SessionMaganer daemon
# daemon
# By default, the daemon will look for this file in the following locations
# /etc/diya/daemon.conf
# or it can be specified using the -c option
# example: diya-session-manager -c /path/to/daemon.conf
# Login session command
# The command to run to start a login session
# this command will handle the user input and send user
# credentials to the daemon via Dbus message
login_session_command = diya-session-launch diyac -x diya-login-shell
# login session user
# The user that owns the login session, root by default
# if this setting is not set
login_session_user = xdg
# User session command
# The command to run to start a user session after the
# login session is successful
# the logged in user will own this session
user_session_command = diya-session-launch diyac -x diya-shell

View File

@ -0,0 +1,27 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only root can own the service -->
<policy user="root">
<allow own="dev.iohub.diya.SessionManager"/>
</policy>
<!--deny all access from another user-->
<policy context="default">
<deny send_destination="dev.iohub.diya.SessionManager"/>
<deny receive_sender="dev.iohub.diya.SessionManager"/>
</policy>
<policy user="xdg">
<allow send_destination="dev.iohub.diya.SessionManager"/>
<allow receive_sender="dev.iohub.diya.SessionManager"/>
</policy>
<policy user="root">
<allow send_destination="dev.iohub.diya.SessionManager"/>
<allow receive_sender="dev.iohub.diya.SessionManager"/>
</policy>
</busconfig>

View File

@ -0,0 +1,26 @@
#! /bin/sh
handle()
{
echo "SIGINT detected. continue."
}
# start dbus session and get env:
#
# DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/dbus-...
# export DBUS_SESSION_BUS_ADDRESS;
# DBUS_SESSION_BUS_PID=3598;
# shellcheck disable=SC1091
. /etc/profile
eval "$(dbus-launch --auto-syntax)"
# trap the sigint
trap 'handle' INT
"$@"
# stop the
kill -9 "$DBUS_SESSION_BUS_PID"
echo "Session closed"

View File

@ -0,0 +1,78 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: diya
# Short-Description: simple session manager
# Description: session manager that allows user login and
# start user session
### END INIT INFO
#
# -*- coding: utf-8 -*-
# set -e
# shellcheck disable=SC1091
. /etc/init.d/functions
DAEMON=/usr/bin/diya-session-manager
NAME=diya-sessiond
PIDFILE=/var/run/diya/sessiond.pid
DESC="Diya session manager"
DAEMONUSER="root"
PARAMS="-c /etc/diya/daemon.conf"
test -x $DAEMON || exit 0
start_it_up()
{
mkdir -p "$(dirname $PIDFILE)"
if [ -e $PIDFILE ]; then
PIDDIR=/proc/$(cat $PIDFILE)
if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
echo "$DESC already started; not starting."
else
echo "Removing stale PID file $PIDFILE."
rm -f $PIDFILE
fi
fi
echo -n "Starting $DESC: "
start-stop-daemon -o --start --quiet --pidfile $PIDFILE \
--user $DAEMONUSER --exec $DAEMON -- $PARAMS
echo "$NAME."
}
shut_it_down()
{
echo -n "Stopping $DESC: "
start-stop-daemon -o --stop --quiet --pidfile $PIDFILE \
--user $DAEMONUSER
# We no longer include these arguments so that start-stop-daemon
# can do its job even given that we may have been upgraded.
# We rely on the pidfile being sanely managed
# --exec $DAEMON -- --system $PARAMS
echo "$NAME."
rm -f $PIDFILE
}
case "$1" in
start)
start_it_up
;;
stop)
shut_it_down
;;
status)
status $DAEMON
exit $?
;;
restart)
shut_it_down
sleep 1
start_it_up
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|status|restart}" >&2
exit 1
;;
esac
exit 0