Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107918820
D48458.id149261.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D48458.id149261.diff
View Options
diff --git a/GIDs b/GIDs
--- a/GIDs
+++ b/GIDs
@@ -511,7 +511,7 @@
# free: 567
# free: 568
# free: 569
-# free: 570
+homeassistant:*:570:
# free: 571
# free: 572
# free: 573
diff --git a/UIDs b/UIDs
--- a/UIDs
+++ b/UIDs
@@ -517,7 +517,7 @@
# free: 567
# free: 568
# free: 569
-# free: 570
+homeassistant:*:570:570::0:0:Home Assistant:/var/db/homeassistant:/usr/sbin/nologin
# free: 571
# free: 572
# free: 573
diff --git a/www/Makefile b/www/Makefile
--- a/www/Makefile
+++ b/www/Makefile
@@ -1741,6 +1741,7 @@
SUBDIR += py-h2
SUBDIR += py-habanero
SUBDIR += py-hdfs
+ SUBDIR += py-homeassistant
SUBDIR += py-horizon
SUBDIR += py-hpack
SUBDIR += py-hstspreload
diff --git a/www/py-homeassistant/Makefile b/www/py-homeassistant/Makefile
new file mode 100644
--- /dev/null
+++ b/www/py-homeassistant/Makefile
@@ -0,0 +1,68 @@
+PORTNAME= homeassistant
+PORTVERSION= 2024.1.3
+CATEGORIES= www python
+MASTER_SITES= # nothing to extract
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTFILES= # nothing to extract
+EXTRACT_ONLY= # nothing to extract
+
+MAINTAINER= rozhuk.im@gmail.com
+COMMENT= Open-source home automation platform running on Python
+WWW= https://www.home-assistant.io/
+
+LICENSE= APACHE20
+
+# Real run deps.
+RUN_DEPENDS= ffmpeg:multimedia/ffmpeg \
+ ${PYTHON_PKGNAMEPREFIX}sqlite3>=0:databases/py-sqlite3@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pip>=0:devel/py-pip@${PY_FLAVOR}
+# VENV bootstrap deps.
+RUN_DEPENDS+= cmake:devel/cmake-core \
+ ninja:devel/ninja \
+ pkg-config:devel/pkgconf \
+ rustc:lang/rust \
+ git:devel/git
+
+USES= python:3.11
+USE_RC_SUBR= home-assistant
+
+NO_ARCH= yes
+NO_BUILD= yes
+
+SUB_LIST= PORTVERSION=${PORTVERSION} \
+ PYTHON_CMD=${PYTHON_CMD} \
+ PYTHON_VERSION=${PYTHON_VERSION}
+
+NO_WRKSUBDIR= yes
+
+USERS= homeassistant
+GROUPS= homeassistant
+
+OPTIONS_GROUP= DB
+OPTIONS_GROUP_DB= MSSQL MYSQL PYMYSQL PGSQL
+
+MYSQL_DESC= MySQL/MariaDB support
+PYMYSQL_DESC= MySQL/MariaDB support via pymysql
+
+MSSQL_SUB_LIST= MSSQLCLIENT=pymssql
+MSSQL_SUB_LIST_OFF= MSSQLCLIENT=""
+MYSQL_SUB_LIST= MYSQLCLIENT=mysqlclient
+MYSQL_SUB_LIST_OFF= MYSQLCLIENT=""
+PGSQL_SUB_LIST= PGSQLCLIENT=psycopg2
+PGSQL_SUB_LIST_OFF= PGSQLCLIENT=""
+PYMYSQL_SUB_LIST= PYMYSQLCLIENT=pymysql
+PYMYSQL_SUB_LIST_OFF= PYMYSQLCLIENT=""
+
+do-install:
+ @${MKDIR} ${STAGEDIR}/var/db/homeassistant
+
+post-stage:
+ @${ECHO_CMD} "@dir(homeassistant,homeassistant,) /var/db/homeassistant" >> ${TMPPLIST}
+ # Generate plist.
+ @${SETENV} ${CO_ENV} ${SH} ${SCRIPTSDIR}/check-stagedir.sh makeplist | \
+ ${GREP} -v ^\/ | \
+ ${SED} -e 's|%%PYTHON_SITELIBDIR%%|${PYTHONPREFIX_SITELIBDIR}|' \
+ -e 's|%%PYTHON_EXT_SUFFIX%%|${PYTHON_EXT_SUFFIX}|' \
+ > ${TMPPLIST}
+
+.include <bsd.port.mk>
diff --git a/www/py-homeassistant/distinfo b/www/py-homeassistant/distinfo
new file mode 100644
--- /dev/null
+++ b/www/py-homeassistant/distinfo
@@ -0,0 +1 @@
+TIMESTAMP = 1717244336
diff --git a/www/py-homeassistant/files/home-assistant.in b/www/py-homeassistant/files/home-assistant.in
new file mode 100644
--- /dev/null
+++ b/www/py-homeassistant/files/home-assistant.in
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# PROVIDE: home-assistant
+# REQUIRE: NETWORKING SYSLOG mysql
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable home-assistant:
+#
+#home_assistant_enable="YES"
+
+. /etc/rc.subr
+
+name="home_assistant"
+rcvar="home_assistant_enable"
+
+load_rc_config $name
+
+: ${home_assistant_enable:="NO"}
+: ${home_assistant_user:="homeassistant"}
+: ${home_assistant_group:="homeassistant"}
+: ${home_assistant_config_dir:="/var/db/homeassistant"}
+: ${home_assistant_log_file:="/var/log/homeassistant.log"}
+: ${home_assistant_log_days:="7"}
+: ${home_assistant_chdir:="${home_assistant_config_dir}"}
+: ${home_assistant_jobs:=`getconf NPROCESSORS_ONLN | tr -cd '[:print:]'`}
+: ${home_assistant_env:="HOME=\"${home_assistant_config_dir}\" XDG_CACHE_HOME=\"${home_assistant_config_dir}/.cache\" VIRTUAL_ENV=\"${home_assistant_config_dir}/\" PATH=\"${home_assistant_config_dir}/bin/:${PATH}:/usr/local/bin\" CPUCOUNT=${home_assistant_jobs}" MAKEFLAGS=\"-j${home_assistant_jobs}\"}
+
+
+pidfile="/var/run/${name}.pid"
+procname="${home_assistant_config_dir}/bin/%%PYTHON_VERSION%%"
+command="/usr/sbin/daemon"
+command_args="-S -t ${name} -T ${name} -p \"${pidfile}\" ${procname} -m homeassistant --log-no-color --log-file \"${home_assistant_log_file}\" --log-rotate-days \"${home_assistant_log_days}\" --config \"${home_assistant_config_dir}\""
+start_precmd="home_assistant_start_precmd"
+
+home_assistant_start_precmd() {
+ # create the file pid, and directory, with correct permissions
+ if [ ! -e "${pidfile}" ]; then
+ install -o "${home_assistant_user}" -g "${home_assistant_group}" /dev/null "${pidfile}";
+ else
+ chown "${home_assistant_user}:${home_assistant_group}" "${pidfile}";
+ fi
+ install -d -o "${home_assistant_user}" -g "${home_assistant_group}" -m 0700 "${home_assistant_config_dir}"
+ install -o "${home_assistant_user}" -g "${home_assistant_group}" -m 0600 /dev/null "${home_assistant_log_file}"
+ if [ -e "${home_assistant_config_dir}/pyver.txt" ]; then
+ __CUR_PY_VER=`cat "${home_assistant_config_dir}/pyver.txt" | tr -cd '[:print:]'`
+ if [ "${__CUR_PY_VER}" != "%%PYTHON_VERSION%%" ]; then
+ echo 'Python version change detected, rebuilding pyenv!'
+ rm -f "${home_assistant_config_dir}/pyvenv.cfg"
+ rm -rf "${home_assistant_config_dir}/bin" \
+ "${home_assistant_config_dir}/cache" \
+ "${home_assistant_config_dir}/deps" \
+ "${home_assistant_config_dir}/include" \
+ "${home_assistant_config_dir}/lib" \
+ "${home_assistant_config_dir}/lib64" \
+ "${home_assistant_config_dir}/share" \
+ "${home_assistant_config_dir}/tts"
+ fi
+ fi
+
+ #export PYTHONPATH="${PYTHONPATH}:/usr/local/lib/"
+ #export CFLAGS='-I/usr/local/include'
+ #export MAKEFLAGS="-j${home_assistant_jobs}" # CFLAGS=${CFLAGS}
+
+ if [ ! -e "${home_assistant_config_dir}/pyvenv.cfg" ]; then
+ echo 'Bootstaping venv.'
+ echo "%%PYTHON_VERSION%%" > "${home_assistant_config_dir}/pyver.txt"
+ su -m "${home_assistant_user}" -c "%%PYTHON_CMD%% -m venv \"${home_assistant_config_dir}\""
+ # _sqlite3 hack to avoid --system-site-packages.
+ mkdir -p "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/lib-dynload/"
+ cp -af %%LOCALBASE%%/lib/%%PYTHON_VERSION%%/lib-dynload/*sqlite3* "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/lib-dynload/"
+ # Install HA and some deps.
+ su -m "${home_assistant_user}" -c "env ${home_assistant_env} pip install numpy %%MSSQLCLIENT%% %%MYSQLCLIENT%% %%PYMYSQLCLIENT%% %%PGSQLCLIENT%% homeassistant==%%PORTVERSION%%"
+ # Enable FreeBSD support.
+ sed -i '.orig' \
+ -e 's|("darwin", "linux")|("darwin", "linux", "freebsd")|g' \
+ "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/site-packages/homeassistant/__main__.py"
+ # Disable broken deps.
+ ## PyTurboJPEG
+ sed -i '.orig' \
+ -e 's|.*PyTurboJPEG.*||g' \
+ "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/site-packages/homeassistant/package_constraints.txt"
+ sed -i '.orig' \
+ -e 's|.*PyTurboJPEG.*||g' \
+ -e 's|"internal",|"internal"|g' \
+ -e '/^[[:space:]]*$/d' \
+ "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/site-packages/homeassistant/components/camera/manifest.json" \
+ "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/site-packages/homeassistant/components/stream/manifest.json"
+ ## webrtc-noise-gain
+ sed -i '.orig' \
+ -e 's|.*webrtc-noise-gain.*||g' \
+ "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/site-packages/homeassistant/package_constraints.txt"
+ sed -i '.orig' \
+ -e 's|.*webrtc-noise-gain.*||g' \
+ -e 's|"internal",|"internal"|g' \
+ -e '/^[[:space:]]*$/d' \
+ "${home_assistant_config_dir}/lib/%%PYTHON_VERSION%%/site-packages/homeassistant/components/assist_pipeline/manifest.json"
+ fi
+ su -m "${home_assistant_user}" -c "env ${home_assistant_env} ${procname} -m homeassistant --config \"${home_assistant_config_dir}\" --script ensure_config"
+ su -m "${home_assistant_user}" -c "env ${home_assistant_env} ${procname} -m homeassistant --config \"${home_assistant_config_dir}\" --script check_config"
+}
+
+run_rc_command "$1"
diff --git a/www/py-homeassistant/pkg-descr b/www/py-homeassistant/pkg-descr
new file mode 100644
--- /dev/null
+++ b/www/py-homeassistant/pkg-descr
@@ -0,0 +1,3 @@
+Open source home automation that puts local control and privacy first.
+Powered by a worldwide community of tinkerers and DIY enthusiasts.
+Perfect to run on a Raspberry Pi or a local server.
diff --git a/www/py-homeassistant/pkg-message b/www/py-homeassistant/pkg-message
new file mode 100644
--- /dev/null
+++ b/www/py-homeassistant/pkg-message
@@ -0,0 +1,19 @@
+[
+{ type: install
+ message: <<EOM
+
+Installation Type: Home Assistant Core.
+
+This port uses Virtual Environment and will download and install via pip
+all required python packets on first service run or on some actions in
+WebUI.
+
+Some integrations was removed due bluetooth support not ported.
+Probably some integrations can be used without bluetooth, patches and
+tests required.
+
+$ service home-assistant forcerestart
+--- The Home Assistant can now be reached http://localhost:8123/
+EOM
+}
+]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 20, 10:27 AM (1 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15936013
Default Alt Text
D48458.id149261.diff (9 KB)
Attached To
Mode
D48458: [NEW-PORT] www/py-homeassistant: Open-source home automation plateform
Attached
Detach File
Event Timeline
Log In to Comment