mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-11 12:19:09 +02:00
Merge pull request #2822 from alexbelgium/codex/fix-claude-desktop-addon-startup-issues
Fix Claude Desktop Selkies startup by creating s6 envdir and XDG runtime dir
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 1.2 (07-07-2026)
|
||||||
|
|
||||||
|
- Fix Selkies startup by creating the s6 environment directory and XDG runtime directory before services start.
|
||||||
|
|
||||||
## 1.0 (07-07-2026)
|
## 1.0 (07-07-2026)
|
||||||
- Minor bugs fixed
|
- Minor bugs fixed
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|||||||
@@ -71,5 +71,5 @@ slug: claude_desktop
|
|||||||
tmpfs: true
|
tmpfs: true
|
||||||
udev: true
|
udev: true
|
||||||
url: https://github.com/alexbelgium/hassio-addons
|
url: https://github.com/alexbelgium/hassio-addons
|
||||||
version: "1.0"
|
version: "1.2"
|
||||||
video: true
|
video: true
|
||||||
|
|||||||
@@ -28,6 +28,17 @@ fi
|
|||||||
|
|
||||||
bashio::log.info "Setting data location to $LOCATION"
|
bashio::log.info "Setting data location to $LOCATION"
|
||||||
|
|
||||||
|
# LinuxServer Selkies services expect the s6 envdir at /run/s6/container_environment.
|
||||||
|
# Home Assistant add-on startup can run without s6-overlay PID1, so create the envdir
|
||||||
|
# ourselves before those services start and before scripts write required variables.
|
||||||
|
S6_ENVDIR="/run/s6/container_environment"
|
||||||
|
mkdir -p "$S6_ENVDIR"
|
||||||
|
chmod 755 /run/s6 "$S6_ENVDIR"
|
||||||
|
|
||||||
|
XDG_RUNTIME_DIR="/run/user/$PUID"
|
||||||
|
mkdir -p "$XDG_RUNTIME_DIR"
|
||||||
|
chmod 700 "$XDG_RUNTIME_DIR"
|
||||||
|
|
||||||
for file in /etc/s6-overlay/s6-rc.d/*/run; do
|
for file in /etc/s6-overlay/s6-rc.d/*/run; do
|
||||||
if [ "$(sed -n '1{/bash/p};q' "$file")" ] && ! grep -q '^export XDG_CACHE_HOME=/tmp/cache$' "$file"; then
|
if [ "$(sed -n '1{/bash/p};q' "$file")" ] && ! grep -q '^export XDG_CACHE_HOME=/tmp/cache$' "$file"; then
|
||||||
sed -i "1a export HOME=$LOCATION" "$file"
|
sed -i "1a export HOME=$LOCATION" "$file"
|
||||||
@@ -44,9 +55,10 @@ done
|
|||||||
|
|
||||||
sed -i "s|^\(abc:[^:]*:[^:]*:[^:]*:[^:]*:\)[^:]*|\1$LOCATION|" /etc/passwd
|
sed -i "s|^\(abc:[^:]*:[^:]*:[^:]*:[^:]*:\)[^:]*|\1$LOCATION|" /etc/passwd
|
||||||
|
|
||||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/HOME; fi
|
printf "%s" "$LOCATION" > "$S6_ENVDIR/HOME"
|
||||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/FM_HOME; fi
|
printf "%s" "$LOCATION" > "$S6_ENVDIR/FM_HOME"
|
||||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "/tmp/cache" > /var/run/s6/container_environment/XDG_CACHE_HOME; fi
|
printf "%s" "/tmp/cache" > "$S6_ENVDIR/XDG_CACHE_HOME"
|
||||||
|
printf "%s" "$XDG_RUNTIME_DIR" > "$S6_ENVDIR/XDG_RUNTIME_DIR"
|
||||||
grep -qxF "export HOME=\"$LOCATION\"" ~/.bashrc 2>/dev/null || {
|
grep -qxF "export HOME=\"$LOCATION\"" ~/.bashrc 2>/dev/null || {
|
||||||
printf "%s\n" "export HOME=\"$LOCATION\""
|
printf "%s\n" "export HOME=\"$LOCATION\""
|
||||||
printf "%s\n" "export FM_HOME=\"$LOCATION\""
|
printf "%s\n" "export FM_HOME=\"$LOCATION\""
|
||||||
@@ -54,8 +66,9 @@ grep -qxF "export HOME=\"$LOCATION\"" ~/.bashrc 2>/dev/null || {
|
|||||||
} >> ~/.bashrc
|
} >> ~/.bashrc
|
||||||
|
|
||||||
bashio::log.info "Creating $LOCATION"
|
bashio::log.info "Creating $LOCATION"
|
||||||
mkdir -p "$LOCATION" /tmp/cache
|
mkdir -p "$LOCATION" /tmp/cache "$XDG_RUNTIME_DIR"
|
||||||
chmod 755 /tmp/cache
|
chmod 755 /tmp/cache
|
||||||
|
chmod 700 "$XDG_RUNTIME_DIR"
|
||||||
|
|
||||||
if [ -e "$LOCATION/.cache" ] && [ ! -L "$LOCATION/.cache" ]; then
|
if [ -e "$LOCATION/.cache" ] && [ ! -L "$LOCATION/.cache" ]; then
|
||||||
rm -rf "$LOCATION/.cache"
|
rm -rf "$LOCATION/.cache"
|
||||||
@@ -63,5 +76,5 @@ fi
|
|||||||
ln -sfn /tmp/cache "$LOCATION/.cache"
|
ln -sfn /tmp/cache "$LOCATION/.cache"
|
||||||
|
|
||||||
bashio::log.info "Setting ownership to $PUID:$PGID"
|
bashio::log.info "Setting ownership to $PUID:$PGID"
|
||||||
chown -R "$PUID":"$PGID" "$LOCATION" /tmp/cache
|
chown -R "$PUID":"$PGID" "$LOCATION" /tmp/cache "$XDG_RUNTIME_DIR"
|
||||||
chmod -R 700 "$LOCATION"
|
chmod -R 700 "$LOCATION"
|
||||||
|
|||||||
Reference in New Issue
Block a user