Fix desktop and udev launch scripts
These services were not responding to a SIGTERM We need to catch the SIGTERM from the parent script and kill the child process
This commit is contained in:
@@ -7,7 +7,6 @@ directory=/
|
|||||||
user=%(ENV_USER)s
|
user=%(ENV_USER)s
|
||||||
command=dbus-daemon --config-file=/usr/share/dbus-1/system.conf --nofork --nopidfile
|
command=dbus-daemon --config-file=/usr/share/dbus-1/system.conf --nofork --nopidfile
|
||||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||||
autorestart=true
|
|
||||||
stopsignal=INT
|
stopsignal=INT
|
||||||
stdout_logfile=/var/log/supervisor/dbus.log
|
stdout_logfile=/var/log/supervisor/dbus.log
|
||||||
stdout_logfile_maxbytes=10MB
|
stdout_logfile_maxbytes=10MB
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ autorestart=true
|
|||||||
user=%(ENV_USER)s
|
user=%(ENV_USER)s
|
||||||
directory=/home/%(ENV_USER)s
|
directory=/home/%(ENV_USER)s
|
||||||
command=/usr/bin/start-desktop.sh
|
command=/usr/bin/start-desktop.sh
|
||||||
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
|
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s",XDG_RUNTIME_DIR="%(ENV_XDG_RUNTIME_DIR)s"
|
||||||
stopsignal=INT
|
stopsignal=INT
|
||||||
stdout_logfile=/home/%(ENV_USER)s/.cache/log/desktop.log
|
stdout_logfile=/home/%(ENV_USER)s/.cache/log/desktop.log
|
||||||
stdout_logfile_maxbytes=10MB
|
stdout_logfile_maxbytes=10MB
|
||||||
|
|||||||
28
overlay/usr/bin/start-desktop.sh
Normal file → Executable file
28
overlay/usr/bin/start-desktop.sh
Normal file → Executable file
@@ -12,7 +12,15 @@
|
|||||||
# I made this wrapper script so that I could easily try a range of desktop environments
|
# I made this wrapper script so that I could easily try a range of desktop environments
|
||||||
#
|
#
|
||||||
|
|
||||||
XDG_RUNTIME_DIR=/run/user/$(id -u ${USER})
|
# CATCH TERM SIGNAL:
|
||||||
|
_term() {
|
||||||
|
kill -TERM "$desktop_pid" 2>/dev/null
|
||||||
|
}
|
||||||
|
trap _term SIGTERM
|
||||||
|
|
||||||
|
|
||||||
|
# CONFIGURE:
|
||||||
|
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-:/tmp/.X11-unix/run}
|
||||||
#XAUTHORITY=${XDG_RUNTIME_DIR:-/home/${USER}/.xauthority}
|
#XAUTHORITY=${XDG_RUNTIME_DIR:-/home/${USER}/.xauthority}
|
||||||
XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"
|
XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"
|
||||||
export $(dbus-launch)
|
export $(dbus-launch)
|
||||||
@@ -21,13 +29,23 @@ export $(dbus-launch)
|
|||||||
mkdir -p /etc/alternatives
|
mkdir -p /etc/alternatives
|
||||||
ln -sf /usr/share/backgrounds/steam.jpg /etc/alternatives/desktop-background
|
ln -sf /usr/share/backgrounds/steam.jpg /etc/alternatives/desktop-background
|
||||||
|
|
||||||
|
|
||||||
|
# EXECUTE PROCESS:
|
||||||
# Run the desktop environment in order of priority
|
# Run the desktop environment in order of priority
|
||||||
if [[ -e /usr/bin/cinnamon-session ]]; then
|
if [[ -e /usr/bin/cinnamon-session ]]; then
|
||||||
/usr/bin/cinnamon-session --display=${DISPLAY}
|
/usr/bin/cinnamon-session --display=${DISPLAY} &
|
||||||
|
desktop_pid=$!
|
||||||
elif [[ -e /usr/bin/mate-session ]]; then
|
elif [[ -e /usr/bin/mate-session ]]; then
|
||||||
/usr/bin/mate-session
|
/usr/bin/mate-session &
|
||||||
|
desktop_pid=$!
|
||||||
elif [[ -e /usr/bin/startplasma-x11 ]]; then
|
elif [[ -e /usr/bin/startplasma-x11 ]]; then
|
||||||
/usr/bin/startplasma-x11
|
/usr/bin/startplasma-x11 &
|
||||||
|
desktop_pid=$!
|
||||||
elif [[ -e /usr/bin/startxfce4 ]]; then
|
elif [[ -e /usr/bin/startxfce4 ]]; then
|
||||||
/usr/bin/startxfce4
|
/usr/bin/startxfce4 &
|
||||||
|
desktop_pid=$!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# WAIT FOR CHILD PROCESS:
|
||||||
|
wait "$desktop_pid"
|
||||||
|
|||||||
32
overlay/usr/bin/start-udev.sh
Normal file → Executable file
32
overlay/usr/bin/start-udev.sh
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
###
|
###
|
||||||
# File: start-xorg.sh
|
# File: start-udev.sh
|
||||||
# Project: bin
|
# Project: bin
|
||||||
# File Created: Tuesday, 12th January 2022 8:46:47 am
|
# File Created: Tuesday, 12th January 2022 8:46:47 am
|
||||||
# Author: Josh.5 (jsunnex@gmail.com)
|
# Author: Josh.5 (jsunnex@gmail.com)
|
||||||
@@ -9,15 +9,33 @@
|
|||||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||||
###
|
###
|
||||||
|
|
||||||
|
# CATCH TERM SIGNAL:
|
||||||
|
_term() {
|
||||||
|
kill -TERM "$monitor_pid" 2>/dev/null
|
||||||
|
kill -TERM "$trigger_pid" 2>/dev/null
|
||||||
|
kill -TERM "$udevd_pid" 2>/dev/null
|
||||||
|
}
|
||||||
|
trap _term SIGTERM
|
||||||
|
|
||||||
|
|
||||||
|
# EXECUTE PROCESS:
|
||||||
# Start udev
|
# Start udev
|
||||||
# Source: https://github.com/balena-io-playground/balena-base-images/
|
# Source: https://github.com/balena-io-playground/balena-base-images/
|
||||||
if command -v udevd &> /dev/null; then
|
if command -v udevd &>/dev/null; then
|
||||||
unshare --net udevd --daemon &> /dev/null
|
unshare --net udevd --daemon &>/dev/null
|
||||||
|
udevd_pid=$!
|
||||||
else
|
else
|
||||||
unshare --net /lib/systemd/systemd-udevd --daemon &> /dev/null
|
unshare --net /lib/systemd/systemd-udevd --daemon &>/dev/null
|
||||||
|
udevd_pid=$!
|
||||||
fi
|
fi
|
||||||
udevadm trigger &> /dev/null
|
udevadm trigger &>/dev/null
|
||||||
|
trigger_pid=$!
|
||||||
|
# Monitor kernel uevents
|
||||||
|
udevadm monitor &
|
||||||
|
monitor_pid=$!
|
||||||
|
|
||||||
|
|
||||||
# Monitry kernel uevents
|
# WAIT FOR CHILD PROCESS:
|
||||||
udevadm monitor
|
wait "$monitor_pid"
|
||||||
|
wait "$trigger_pid"
|
||||||
|
wait "$udevd_pid"
|
||||||
|
|||||||
Reference in New Issue
Block a user