Skip to content
Merged
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
4 changes: 3 additions & 1 deletion root/etc/s6-overlay/s6-rc.d/init-selkies-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ done

# XDG Home
printf "$HOME/.XDG" > /run/s6/container_environment/XDG_RUNTIME_DIR
# svc-app-exit takes a new lock file as the sign that the app has started
rm -f "$HOME/.XDG/selkies-autostart.lock"
printf "$HOME/.XDG/Xauthority" > /run/s6/container_environment/XAUTHORITY
if [[ "${PIXELFLUX_WAYLAND,,}" == "true" ]]; then
printf "wayland-1" > /run/s6/container_environment/WAYLAND_DISPLAY
Expand Down Expand Up @@ -236,7 +238,7 @@ set_unset() {
export "$1=$2"
fi
}
if [[ ${RESTART_APP,,} == "true" ]]; then
if [[ ${RESTART_APP,,} == "true" ]] && [[ ${EXIT_ON_APP_CLOSE,,} != "true" ]]; then
set_unset SELKIES_APP_RESTART true
fi
if [[ ! -z ${NO_FULL+x} ]]; then
Expand Down
Empty file.
23 changes: 23 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-app-exit/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/with-contenv bash

if [[ ${EXIT_ON_APP_CLOSE,,} != "true" ]]; then
exec sleep infinity
fi

# selkies holds this lock until everything the app started has exited, only read it so selkies never finds it taken,
# by inode as lslocks cannot resolve the path inside a container
LOCK="${XDG_RUNTIME_DIR}/selkies-autostart.lock"
app_running() {
grep -qE "FLOCK +ADVISORY +WRITE +[0-9]+ [0-9a-f]+:[0-9a-f]+:$(stat -c %i "${LOCK}") " /proc/locks
}
until [[ -e "${LOCK}" ]]; do
sleep 1
done
# selkies creates the file just before it takes the lock
sleep 1
echo "[svc-app-exit] Application started, the container stops when it exits"
while app_running; do
sleep 1
done
echo "[svc-app-exit] Application has exited. Stopping the container..."
exec /run/s6/basedir/bin/halt
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-app-exit/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Loading