diff --git a/recipes-core/images/base-image.inc b/recipes-core/images/base-image.inc index c98f908..9252d13 100644 --- a/recipes-core/images/base-image.inc +++ b/recipes-core/images/base-image.inc @@ -1,8 +1,6 @@ inherit extrausers -EXTRA_USERS_PARAMS = "groupadd xdg; \ - usermod -d /home/diya -p 2Pe/4xyFxsokE diya; \ - usermod -a -G xdg diya; \ +EXTRA_USERS_PARAMS = "usermod -d /home/diya -p 2Pe/4xyFxsokE diya; \ usermod -a -G video diya; \ usermod -a -G tty diya; \ usermod -a -G input diya; \ diff --git a/recipes-core/images/core-image-base.bbappend b/recipes-core/images/core-image-base.bbappend index 66190dc..6b54a06 100644 --- a/recipes-core/images/core-image-base.bbappend +++ b/recipes-core/images/core-image-base.bbappend @@ -2,7 +2,13 @@ DISTRO_FEATURES:append = " wayland " require base-image.inc -EXTRA_USERS_PARAMS:append = "usermod -a -G avahi diya" +EXTRA_USERS_PARAMS:append = "useradd xdg; \ + usermod -d /run/xdg xdg; \ + usermod -a -G video xdg; \ + usermod -a -G input xdg; \ + usermod -a -G tty xdg; \ + usermod -a -G avahi diya; \ + usermod -a -G xdg diya;" IMAGE_INSTALL:append = "pango \ seatd \ pixman \ @@ -21,6 +27,7 @@ IMAGE_INSTALL:append = "pango \ gdbserver gdb \ labwc \ wlr-randr \ + diya-session-manager \ " PACKAGE_EXCLUDE = " gtk+ gtk+3 adwaita-icon-theme " IMAGE_INSTALL:remove = " gtk+ gtk+3 adwaita-icon-theme " diff --git a/recipes-diya/diya-overlay/files/80_diya b/recipes-diya/diya-overlay/files/80_diya index 7afebec..26f49cc 100644 --- a/recipes-diya/diya-overlay/files/80_diya +++ b/recipes-diya/diya-overlay/files/80_diya @@ -1 +1,2 @@ d root root 0755 /run/root none +d xdg xdg 0755 /run/xdg none diff --git a/recipes-diya/diya-session-manager/diya-session-manager_git.bb b/recipes-diya/diya-session-manager/diya-session-manager_git.bb new file mode 100644 index 0000000..fc71cb8 --- /dev/null +++ b/recipes-diya/diya-session-manager/diya-session-manager_git.bb @@ -0,0 +1,40 @@ +DESCRIPTION = "Diya session manager" +DEPENDS = "glib-2.0" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI += "git://git.iohub.dev/dany/diya-session-manager.git;protocol=https;branch=master \ + file://daemon.conf \ + file://dbus-diya.conf \ + file://diya-session-launch \ + file://diya-sessiond" + +SRCREV = "${AUTOREV}" +PV = "0.1.0+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit meson pkgconfig + +# inherit update-rc.d +# INITSCRIPT_NAME = "diya-sessiond" +# INITSCRIPT_PARAMS = "start 30 5 . stop 10 0 1 6 ." + + +do_install:append() { + install -d ${D}/etc/diya + install -d ${D}/usr/bin + install -d ${D}/etc/dbus-1 + install -d ${D}/etc/dbus-1/system.d + install -d ${D}/etc/init.d + install -m 0755 ${WORKDIR}/build/diya-session-manager ${D}/usr/bin/ + install -m 0755 ${WORKDIR}/diya-sessiond ${D}/etc/init.d/ + install -m 0755 ${WORKDIR}/diya-session-launch ${D}/usr/bin/ + install -m 0644 ${WORKDIR}/daemon.conf ${D}/etc/diya/ + install -m 0644 ${WORKDIR}/dbus-diya.conf ${D}/etc/dbus-1/system.d/ +} + +FILES:${PN} = "/etc/diya \ + /etc/dbus-1/system.d/dbus-diya.conf \ + /usr/bin/diya-session-manager \ + /usr/bin/diya-session-launch \ + /etc/init.d/diya-sessiond" \ No newline at end of file diff --git a/recipes-diya/diya-session-manager/files/daemon.conf b/recipes-diya/diya-session-manager/files/daemon.conf new file mode 100644 index 0000000..824aa4c --- /dev/null +++ b/recipes-diya/diya-session-manager/files/daemon.conf @@ -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 \ No newline at end of file diff --git a/recipes-diya/diya-session-manager/files/dbus-diya.conf b/recipes-diya/diya-session-manager/files/dbus-diya.conf new file mode 100644 index 0000000..63ad460 --- /dev/null +++ b/recipes-diya/diya-session-manager/files/dbus-diya.conf @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipes-diya/diya-session-manager/files/diya-session-launch b/recipes-diya/diya-session-manager/files/diya-session-launch new file mode 100755 index 0000000..864fc96 --- /dev/null +++ b/recipes-diya/diya-session-manager/files/diya-session-launch @@ -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" \ No newline at end of file diff --git a/recipes-diya/diya-session-manager/files/diya-sessiond b/recipes-diya/diya-session-manager/files/diya-sessiond new file mode 100644 index 0000000..64d3ba4 --- /dev/null +++ b/recipes-diya/diya-session-manager/files/diya-sessiond @@ -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 \ No newline at end of file