Skip to content

Commit

Permalink
preserve /usr/local in Home Assistant - binding to /data (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelnu authored Jan 25, 2021
1 parent 24c5ac1 commit b19ca29
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
25 changes: 18 additions & 7 deletions buildroot-external/overlay/base/etc/init.d/S06InitSystem
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,24 @@ init_system() {
mkdir -p /var/empty
chmod 0700 /var/empty

DEV_HOST="/dev_host"
if [ -d "${DEV_HOST}" ]; then
# To avoid sharing the whole host /dev with container it is mounted in a /dev_host
# This means we have to manually symlink the dynamic devices
for device in mmd_bidcos mmd_hmip usb; do
ln -s "${DEV_HOST}/${device}" "/dev/${device}"
done
if [[ "${HM_HOST}" == "oci" ]]; then

DEV_HOST="/dev_host"
if [ -d "${DEV_HOST}" ]; then
# To avoid sharing the whole host /dev with container it is mounted in a /dev_host
# This means we have to manually symlink the dynamic devices
for device in mmd_bidcos mmd_hmip usb; do
ln -s "${DEV_HOST}/${device}" "/dev/${device}"
done
fi

HOME_ASSISTANT_ADDON_DATA="/data"
if [ -n "${RUNNING_IN_HA}" ] && [ -f "${HOME_ASSISTANT_ADDON_DATA}/options.json" ]; then
# Home Assistant expects persinstent data to be stored in /data
echo "Storing user data in ${HOME_ASSISTANT_ADDON_DATA} (Home Assistant Add-On)"
mount -o bind ${HOME_ASSISTANT_ADDON_DATA} /usr/local
fi

fi

# create /media/usbX directories for automounting USB devices
Expand Down
4 changes: 4 additions & 0 deletions home-assistant-addon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changelog

- [releases](https://github.com/jens-maus/RaspberryMatic/releases)
- [Development commits](https://github.com/jens-maus/RaspberryMatic/commits/master)
5 changes: 4 additions & 1 deletion home-assistant-addon/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@
"environment": {
"RUNNING_IN_HA": "1"
},
"full_access": true
"full_access": true,
"privileged": [
"SYS_ADMIN"
]
}

0 comments on commit b19ca29

Please sign in to comment.