Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] [morty] Run Xserver as user #115

Open
wants to merge 2 commits into
base: morty
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions recipes-core/base-files/base-files/profile.serialtty
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

PATH="/usr/local/bin:/usr/bin:/bin"
EDITOR="vi" # needed for packages like cron, git-commit
test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc.

if [ "$HOME" = "ROOTHOME" ]; then
PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
fi
if [ "$PS1" ]; then
# works for bash and ash (no other shells known to be in use here)
PS1='\u@\h:\w\$ '
fi

if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh ; do
if [ -f $i -a -r $i ]; then
. $i
fi
done
unset i
fi

if [ -x /usr/bin/resize ] && termpath="`tty`"; then
# Make sure we are on a serial console (i.e. the device used starts with /dev/tty),
# otherwise we confuse e.g. the eclipse launcher which tries do use ssh
case "$termpath" in
/dev/tty[A-z]*) resize >/dev/null
esac
fi

export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM

umask 022
8 changes: 8 additions & 0 deletions recipes-core/base-files/base-files_3.0.%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SRC_URI += "file://profile.serialtty"

do_install_append() {
install -m 0644 ${WORKDIR}/profile.serialtty ${D}${sysconfdir}/profile
sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
}

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="[email protected]"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[Unit]
Description=Xserver startup with a display manager (on tty7)
RequiresMountsFor=/run
[email protected] plymouth-quit.service
After=systemd-user-sessions.service [email protected] plymouth-quit-wait.service

[Service]
User=%i
PermissionsStartOnly=true

# Log us in via PAM so we get our XDG & co. environment and
# are treated as logged in so we can use the tty:
PAMName=login

# Grab tty7
UtmpIdentifier=tty7
TTYPath=/dev/tty7
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes

# stderr to journal so our logging doesn't get thrown into /dev/null
StandardOutput=tty
StandardInput=tty
StandardError=journal

EnvironmentFile=-/etc/default/xserver-nodm
ExecStart=/etc/X11/Xserver -logfile ${XDG_RUNTIME_DIR}/Xorg.log vt7 $OPTARGS

#[Install]
#Alias=display-manager.service
24 changes: 24 additions & 0 deletions recipes-graphics/xserver-nodm-init/xserver-nodm-init_2.%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SRC_URI += "file://[email protected] \
file://71-xserver-drm.rules \
"

do_install_append() {
# Remove upstream xserver-nodm.service
rm ${D}${systemd_unitdir}/system/xserver-nodm.service

# Install Xserver systemd service and accompanying udev rule
install -D -p -m0644 ${WORKDIR}/[email protected] \
${D}${systemd_unitdir}/system/[email protected]
sed -i -e s:/etc:${sysconfdir}:g \
-e s:/usr/bin:${bindir}:g \
-e s:/var:${localstatedir}:g \
${D}${systemd_unitdir}/system/[email protected]
install -D -p -m0644 ${WORKDIR}/71-xserver-drm.rules \
${D}${sysconfdir}/udev/rules.d/71-xserver-drm.rules
}

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
FILES_${PN} += "${systemd_unitdir}/system/[email protected]"

SYSTEMD_SERVICE_${PN} = "xserver-nodm@%i.service"
SYSTEMD_AUTO_ENABLE = "disable"