Add a plugins executor
This commit is contained in:
@@ -574,7 +574,7 @@ ENV \
|
|||||||
ENABLE_VNC_AUDIO="true" \
|
ENABLE_VNC_AUDIO="true" \
|
||||||
NEKO_PASSWORD=neko \
|
NEKO_PASSWORD=neko \
|
||||||
NEKO_PASSWORD_ADMIN=admin \
|
NEKO_PASSWORD_ADMIN=admin \
|
||||||
ENABLE_SUNSHINE="false" \
|
ENABLED_PLUGINS="" \
|
||||||
ENABLE_EVDEV_INPUTS="false"
|
ENABLE_EVDEV_INPUTS="false"
|
||||||
|
|
||||||
# Configure required ports
|
# Configure required ports
|
||||||
|
|||||||
16
overlay/etc/cont-init.d/90-configure_plugins.sh
Normal file
16
overlay/etc/cont-init.d/90-configure_plugins.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
echo "**** Configure Plugins ****"
|
||||||
|
|
||||||
|
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
|
||||||
|
if [ "X${ENABLED_PLUGINS:-}" != "X" ]; then
|
||||||
|
echo "Enable Plugins"
|
||||||
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/plugins.ini
|
||||||
|
chmod +x /usr/bin/start-plugins.sh
|
||||||
|
else
|
||||||
|
echo "Disable Plugins"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Plugins not available when container is run in 'secondary' mode"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "DONE"
|
||||||
16
overlay/etc/supervisor.d/plugins.ini
Normal file
16
overlay/etc/supervisor.d/plugins.ini
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
[program:plugins]
|
||||||
|
priority=50
|
||||||
|
autostart=false
|
||||||
|
autorestart=false
|
||||||
|
user=%(ENV_USER)s
|
||||||
|
directory=/home/%(ENV_USER)s
|
||||||
|
command=/usr/bin/start-plugins.sh
|
||||||
|
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
|
||||||
|
stopsignal=INT
|
||||||
|
stdout_logfile=/home/%(ENV_USER)s/.cache/log/plugins.log
|
||||||
|
stdout_logfile_maxbytes=10MB
|
||||||
|
stdout_logfile_backups=7
|
||||||
|
stderr_logfile=/home/%(ENV_USER)s/.cache/log/plugins.err.log
|
||||||
|
stderr_logfile_maxbytes=10MB
|
||||||
|
stderr_logfile_backups=7
|
||||||
59
overlay/usr/bin/start-plugins.sh
Executable file
59
overlay/usr/bin/start-plugins.sh
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
###
|
||||||
|
# File: start-plugins.sh
|
||||||
|
# Project: bin
|
||||||
|
# File Created: Sunday, 5th February 2023 10:07:02 pm
|
||||||
|
# Author: Josh.5 (jsunnex@gmail.com)
|
||||||
|
# -----
|
||||||
|
# Last Modified: Sunday, 5th February 2023 11:55:11 pm
|
||||||
|
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||||
|
###
|
||||||
|
set -e
|
||||||
|
source /usr/bin/common-functions.sh
|
||||||
|
|
||||||
|
|
||||||
|
# CATCH TERM SIGNAL:
|
||||||
|
_term() {
|
||||||
|
kill -TERM "$plugins_pid" 2>/dev/null
|
||||||
|
}
|
||||||
|
trap _term SIGTERM SIGINT
|
||||||
|
|
||||||
|
|
||||||
|
echo "USER: $USER"
|
||||||
|
echo "HOME: $HOME"
|
||||||
|
echo "ENABLED_PLUGINS: $ENABLED_PLUGINS"
|
||||||
|
|
||||||
|
# CONFIGURE:
|
||||||
|
# Set the plugins project directory
|
||||||
|
plugins_dir="/home/${USER}/.local/share/steam-headless-plugins2"
|
||||||
|
# Clone plugins project
|
||||||
|
mkdir -p "/home/${USER}/.local/share"
|
||||||
|
if [[ ! -d "${plugins_dir}" ]]; then
|
||||||
|
git clone --depth=1 \
|
||||||
|
https://github.com/Steam-Headless/plugins.git \
|
||||||
|
"${plugins_dir}"
|
||||||
|
fi
|
||||||
|
# Pull latest project
|
||||||
|
pushd "${plugins_dir}" &> /dev/null || exit 1
|
||||||
|
git clean -fdx
|
||||||
|
git checkout . 2> /dev/null
|
||||||
|
git checkout master 2> /dev/null
|
||||||
|
git pull origin master 2> /dev/null
|
||||||
|
popd &> /dev/null || exit 1
|
||||||
|
|
||||||
|
|
||||||
|
# EXECUTE PROCESS:
|
||||||
|
# Wait for the X server to start
|
||||||
|
wait_for_docker
|
||||||
|
pushd "${plugins_dir}" &> /dev/null || exit 1
|
||||||
|
## # Pull latest Docker images
|
||||||
|
## ${plugins_dir}/plugins-run pull
|
||||||
|
## # Run docker images (not in background)
|
||||||
|
## ${plugins_dir}/plugins-run up &
|
||||||
|
sleep 300
|
||||||
|
plugins_pid=$!
|
||||||
|
popd &> /dev/null || exit 1
|
||||||
|
|
||||||
|
|
||||||
|
# WAIT FOR CHILD PROCESS:
|
||||||
|
wait "$plugins_pid"
|
||||||
Reference in New Issue
Block a user