Last active
April 6, 2025 15:43
-
-
Save cemarriott/deef0af3b0251ddce276c4ee4d3fa004 to your computer and use it in GitHub Desktop.
homeassistant-docker-venv run script diff - modifications to run as the 'core' user in Fedora CoreOS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/run b/run | |
index 970dd83..8f4b234 100755 | |
--- a/run | |
+++ b/run | |
@@ -1,7 +1,7 @@ | |
#!/usr/bin/with-contenv bashio | |
# shellcheck shell=bash | |
-USER="homeassistant" | |
+USER="core" | |
GROUP="$USER" | |
PUID="${PUID:-1000}" | |
PGID="${PGID:-1000}" | |
@@ -23,10 +23,10 @@ CONFIG_PATH=/config | |
# Some HA commands seem to fail if we don't have an actual user. | |
# ie: shell_command would return error code 255 | |
-bashio::log.info "Creating user $USER with $PUID:$PGID" | |
+#bashio::log.info "Creating user $USER with $PUID:$PGID" | |
-deluser "$USER" >/dev/null 2>&1 || true | |
-delgroup "$GROUP" >/dev/null 2>&1 || true | |
+#deluser "$USER" >/dev/null 2>&1 || true | |
+#delgroup "$GROUP" >/dev/null 2>&1 || true | |
# Re-use existing group (can't delgroup a group that is in use) | |
group="$(getent group "$PGID" | cut -d: -f1 || true)" | |
@@ -39,11 +39,11 @@ fi | |
# Replace existing user (ensures correct shell and primary group) | |
user="$(getent passwd "$PUID" | cut -d: -f1 || true)" | |
-if [ -n "$user" ]; then | |
- bashio::log.notice "Replacing existing user with uid $PUID: $user" | |
- deluser "$user" | |
-fi | |
-adduser -G "$GROUP" -D -u "$PUID" "$USER" | |
+#if [ -n "$user" ]; then | |
+# bashio::log.notice "Replacing existing user with uid $PUID: $user" | |
+# deluser "$user" | |
+#fi | |
+#adduser -G "$GROUP" -D -u "$PUID" "$USER" | |
if [ -n "${EXTRA_GID:-}" ]; then | |
bashio::log.info "Resolving supplementary GIDs: $EXTRA_GID" | |
@@ -82,8 +82,10 @@ done | |
# | |
bashio::log.info "Initializing venv in $VENV_PATH" | |
-su "$USER" \ | |
- -c "python3 -m venv --system-site-packages '$VENV_PATH'" | |
+#su "$USER" \ | |
+# -c "python3 -m venv --system-site-packages '$VENV_PATH'" | |
+python3 -m venv --system-site-packages $VENV_PATH | |
+ | |
# | |
# Fix permissions | |
@@ -104,8 +106,9 @@ bashio::log.info "Activating venv" | |
export UV_SYSTEM_PYTHON=false | |
bashio::log.info "Installing uv into venv" | |
-uv --version && su "$USER" \ | |
- -c "uv pip freeze --system|grep ^uv=|xargs uv pip install" | |
+#uv --version && su "$USER" \ | |
+# -c "uv pip freeze --system|grep ^uv=|xargs uv pip install" | |
+uv --version && uv pip freeze --system|grep ^uv=|xargs uv pip install | |
bashio::log.info "Setting new \$HOME" | |
HOME="$( getent passwd "$USER" | cut -d: -f6 )" | |
@@ -122,6 +125,8 @@ if [[ -z "${DISABLE_JEMALLOC+x}" ]]; then | |
fi | |
bashio::log.info "Starting homeassistant" | |
-exec \ | |
- s6-setuidgid "$USER" \ | |
- python3 -m homeassistant --config "$CONFIG_PATH" | |
+#exec \ | |
+# s6-setuidgid "$USER" \ | |
+# python3 -m homeassistant --config "$CONFIG_PATH" | |
+python3 -m homeassistant --config "$CONFIG_PATH" | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment