mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-28 11:36:32 +00:00
commit
81e1227a7b
@ -16,7 +16,7 @@ from ..const import (
|
|||||||
FILE_HASSIO_ADDONS, ATTR_NAME, ATTR_VERSION, ATTR_SLUG, ATTR_DESCRIPTON,
|
FILE_HASSIO_ADDONS, ATTR_NAME, ATTR_VERSION, ATTR_SLUG, ATTR_DESCRIPTON,
|
||||||
ATTR_STARTUP, ATTR_BOOT, ATTR_MAP, ATTR_OPTIONS, ATTR_PORTS, BOOT_AUTO,
|
ATTR_STARTUP, ATTR_BOOT, ATTR_MAP, ATTR_OPTIONS, ATTR_PORTS, BOOT_AUTO,
|
||||||
ATTR_SCHEMA, ATTR_IMAGE, ATTR_REPOSITORY, ATTR_URL, ATTR_ARCH,
|
ATTR_SCHEMA, ATTR_IMAGE, ATTR_REPOSITORY, ATTR_URL, ATTR_ARCH,
|
||||||
ATTR_LOCATON, ATTR_DEVICES)
|
ATTR_LOCATON, ATTR_DEVICES, ATTR_ENVIRONMENT)
|
||||||
from ..config import Config
|
from ..config import Config
|
||||||
from ..tools import read_json_file, write_json_file
|
from ..tools import read_json_file, write_json_file
|
||||||
|
|
||||||
@ -298,6 +298,10 @@ class AddonsData(Config):
|
|||||||
"""Return devices of addon."""
|
"""Return devices of addon."""
|
||||||
return self._system_data[addon].get(ATTR_DEVICES)
|
return self._system_data[addon].get(ATTR_DEVICES)
|
||||||
|
|
||||||
|
def get_environment(self, addon):
|
||||||
|
"""Return environment of addon."""
|
||||||
|
return self._system_data[addon].get(ATTR_ENVIRONMENT)
|
||||||
|
|
||||||
def get_url(self, addon):
|
def get_url(self, addon):
|
||||||
"""Return url of addon."""
|
"""Return url of addon."""
|
||||||
if addon in self._addons_cache:
|
if addon in self._addons_cache:
|
||||||
|
@ -5,11 +5,11 @@ from ..const import (
|
|||||||
ATTR_NAME, ATTR_VERSION, ATTR_SLUG, ATTR_DESCRIPTON, ATTR_STARTUP,
|
ATTR_NAME, ATTR_VERSION, ATTR_SLUG, ATTR_DESCRIPTON, ATTR_STARTUP,
|
||||||
ATTR_BOOT, ATTR_MAP, ATTR_OPTIONS, ATTR_PORTS, STARTUP_ONCE, STARTUP_AFTER,
|
ATTR_BOOT, ATTR_MAP, ATTR_OPTIONS, ATTR_PORTS, STARTUP_ONCE, STARTUP_AFTER,
|
||||||
STARTUP_BEFORE, BOOT_AUTO, BOOT_MANUAL, ATTR_SCHEMA, ATTR_IMAGE,
|
STARTUP_BEFORE, BOOT_AUTO, BOOT_MANUAL, ATTR_SCHEMA, ATTR_IMAGE,
|
||||||
ATTR_URL, ATTR_MAINTAINER, ATTR_ARCH, ATTR_DEVICES, ARCH_ARMHF,
|
ATTR_URL, ATTR_MAINTAINER, ATTR_ARCH, ATTR_DEVICES, ATTR_ENVIRONMENT,
|
||||||
ARCH_AARCH64, ARCH_AMD64, ARCH_I386)
|
ARCH_ARMHF, ARCH_AARCH64, ARCH_AMD64, ARCH_I386)
|
||||||
|
|
||||||
|
|
||||||
MAP_VOLUME = r"^(config|ssl|addons|backup)(?::(rw|:ro))?$"
|
MAP_VOLUME = r"^(config|ssl|addons|backup|share|mnt)(?::(rw|:ro))?$"
|
||||||
|
|
||||||
V_STR = 'str'
|
V_STR = 'str'
|
||||||
V_INT = 'int'
|
V_INT = 'int'
|
||||||
@ -39,6 +39,7 @@ SCHEMA_ADDON_CONFIG = vol.Schema({
|
|||||||
vol.Optional(ATTR_PORTS): dict,
|
vol.Optional(ATTR_PORTS): dict,
|
||||||
vol.Optional(ATTR_DEVICES): [vol.Match(r"^(.*):(.*):([rwm]{1,3})$")],
|
vol.Optional(ATTR_DEVICES): [vol.Match(r"^(.*):(.*):([rwm]{1,3})$")],
|
||||||
vol.Optional(ATTR_MAP, default=[]): [vol.Match(MAP_VOLUME)],
|
vol.Optional(ATTR_MAP, default=[]): [vol.Match(MAP_VOLUME)],
|
||||||
|
vol.Optional(ATTR_ENVIRONMENT): {vol.Match(r"\w*"): vol.Coerce(str)},
|
||||||
vol.Required(ATTR_OPTIONS): dict,
|
vol.Required(ATTR_OPTIONS): dict,
|
||||||
vol.Required(ATTR_SCHEMA): {
|
vol.Required(ATTR_SCHEMA): {
|
||||||
vol.Coerce(str): vol.Any(ADDON_ELEMENT, [
|
vol.Coerce(str): vol.Any(ADDON_ELEMENT, [
|
||||||
|
@ -21,24 +21,24 @@ def initialize_system_data(websession):
|
|||||||
"Create Home-Assistant config folder %s", config.path_config)
|
"Create Home-Assistant config folder %s", config.path_config)
|
||||||
config.path_config.mkdir()
|
config.path_config.mkdir()
|
||||||
|
|
||||||
# homeassistant ssl folder
|
# hassio ssl folder
|
||||||
if not config.path_ssl.is_dir():
|
if not config.path_ssl.is_dir():
|
||||||
_LOGGER.info("Create Home-Assistant ssl folder %s", config.path_ssl)
|
_LOGGER.info("Create hassio ssl folder %s", config.path_ssl)
|
||||||
config.path_ssl.mkdir()
|
config.path_ssl.mkdir()
|
||||||
|
|
||||||
# homeassistant addon data folder
|
# hassio addon data folder
|
||||||
if not config.path_addons_data.is_dir():
|
if not config.path_addons_data.is_dir():
|
||||||
_LOGGER.info("Create Home-Assistant addon data folder %s",
|
_LOGGER.info(
|
||||||
config.path_addons_data)
|
"Create hassio addon data folder %s", config.path_addons_data)
|
||||||
config.path_addons_data.mkdir(parents=True)
|
config.path_addons_data.mkdir(parents=True)
|
||||||
|
|
||||||
if not config.path_addons_local.is_dir():
|
if not config.path_addons_local.is_dir():
|
||||||
_LOGGER.info("Create Home-Assistant addon local repository folder %s",
|
_LOGGER.info("Create hassio addon local repository folder %s",
|
||||||
config.path_addons_local)
|
config.path_addons_local)
|
||||||
config.path_addons_local.mkdir(parents=True)
|
config.path_addons_local.mkdir(parents=True)
|
||||||
|
|
||||||
if not config.path_addons_git.is_dir():
|
if not config.path_addons_git.is_dir():
|
||||||
_LOGGER.info("Create Home-Assistant addon git repositories folder %s",
|
_LOGGER.info("Create hassio addon git repositories folder %s",
|
||||||
config.path_addons_git)
|
config.path_addons_git)
|
||||||
config.path_addons_git.mkdir(parents=True)
|
config.path_addons_git.mkdir(parents=True)
|
||||||
|
|
||||||
@ -47,12 +47,16 @@ def initialize_system_data(websession):
|
|||||||
config.path_addons_build)
|
config.path_addons_build)
|
||||||
config.path_addons_build.mkdir(parents=True)
|
config.path_addons_build.mkdir(parents=True)
|
||||||
|
|
||||||
# homeassistant backup folder
|
# hassio backup folder
|
||||||
if not config.path_backup.is_dir():
|
if not config.path_backup.is_dir():
|
||||||
_LOGGER.info("Create Home-Assistant backup folder %s",
|
_LOGGER.info("Create hassio backup folder %s", config.path_backup)
|
||||||
config.path_backup)
|
|
||||||
config.path_backup.mkdir()
|
config.path_backup.mkdir()
|
||||||
|
|
||||||
|
# share folder
|
||||||
|
if not config.path_share.is_dir():
|
||||||
|
_LOGGER.info("Create hassio share folder %s", config.path_share)
|
||||||
|
config.path_share.mkdir()
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ ADDONS_CUSTOM_LIST = 'addons_custom_list'
|
|||||||
|
|
||||||
BACKUP_DATA = PurePath("backup")
|
BACKUP_DATA = PurePath("backup")
|
||||||
|
|
||||||
|
SHARE_DATA = PurePath("share")
|
||||||
|
|
||||||
UPSTREAM_BETA = 'upstream_beta'
|
UPSTREAM_BETA = 'upstream_beta'
|
||||||
|
|
||||||
API_ENDPOINT = 'api_endpoint'
|
API_ENDPOINT = 'api_endpoint'
|
||||||
@ -233,6 +235,16 @@ class CoreConfig(Config):
|
|||||||
"""Return root backup data folder extern for docker."""
|
"""Return root backup data folder extern for docker."""
|
||||||
return PurePath(self.path_extern_hassio, BACKUP_DATA)
|
return PurePath(self.path_extern_hassio, BACKUP_DATA)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def path_share(self):
|
||||||
|
"""Return root share data folder."""
|
||||||
|
return Path(HASSIO_SHARE, SHARE_DATA)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def path_extern_share(self):
|
||||||
|
"""Return root share data folder extern for docker."""
|
||||||
|
return PurePath(self.path_extern_hassio, SHARE_DATA)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def addons_repositories(self):
|
def addons_repositories(self):
|
||||||
"""Return list of addons custom repositories."""
|
"""Return list of addons custom repositories."""
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Const file for HassIO."""
|
"""Const file for HassIO."""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
HASSIO_VERSION = '0.28'
|
HASSIO_VERSION = '0.29'
|
||||||
|
|
||||||
URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/'
|
URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/'
|
||||||
'hassio/master/version.json')
|
'hassio/master/version.json')
|
||||||
@ -76,6 +76,7 @@ ATTR_SESSION = 'session'
|
|||||||
ATTR_LOCATON = 'location'
|
ATTR_LOCATON = 'location'
|
||||||
ATTR_BUILD = 'build'
|
ATTR_BUILD = 'build'
|
||||||
ATTR_DEVICES = 'devices'
|
ATTR_DEVICES = 'devices'
|
||||||
|
ATTR_ENVIRONMENT = 'environment'
|
||||||
|
|
||||||
STARTUP_BEFORE = 'before'
|
STARTUP_BEFORE = 'before'
|
||||||
STARTUP_AFTER = 'after'
|
STARTUP_AFTER = 'after'
|
||||||
@ -91,6 +92,8 @@ MAP_CONFIG = 'config'
|
|||||||
MAP_SSL = 'ssl'
|
MAP_SSL = 'ssl'
|
||||||
MAP_ADDONS = 'addons'
|
MAP_ADDONS = 'addons'
|
||||||
MAP_BACKUP = 'backup'
|
MAP_BACKUP = 'backup'
|
||||||
|
MAP_SHARE = 'share'
|
||||||
|
MAP_MNT = 'mnt'
|
||||||
|
|
||||||
ARCH_ARMHF = 'armhf'
|
ARCH_ARMHF = 'armhf'
|
||||||
ARCH_AARCH64 = 'aarch64'
|
ARCH_AARCH64 = 'aarch64'
|
||||||
|
@ -7,7 +7,9 @@ import docker
|
|||||||
|
|
||||||
from . import DockerBase
|
from . import DockerBase
|
||||||
from .util import dockerfile_template
|
from .util import dockerfile_template
|
||||||
from ..const import META_ADDON, MAP_CONFIG, MAP_SSL, MAP_ADDONS, MAP_BACKUP
|
from ..const import (
|
||||||
|
META_ADDON, MAP_CONFIG, MAP_SSL, MAP_ADDONS, MAP_BACKUP, MAP_SHARE,
|
||||||
|
MAP_MNT)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -61,6 +63,18 @@ class DockerAddon(DockerBase):
|
|||||||
'bind': '/backup', 'mode': addon_mapping[MAP_BACKUP]
|
'bind': '/backup', 'mode': addon_mapping[MAP_BACKUP]
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
if MAP_SHARE in addon_mapping:
|
||||||
|
volumes.update({
|
||||||
|
str(self.config.path_extern_share): {
|
||||||
|
'bind': '/share', 'mode': addon_mapping[MAP_SHARE]
|
||||||
|
}})
|
||||||
|
|
||||||
|
if MAP_MNT in addon_mapping:
|
||||||
|
volumes.update({
|
||||||
|
'/mnt': {
|
||||||
|
'bind': '/mnt', 'mode': addon_mapping[MAP_MNT]
|
||||||
|
}})
|
||||||
|
|
||||||
return volumes
|
return volumes
|
||||||
|
|
||||||
def _run(self):
|
def _run(self):
|
||||||
@ -82,6 +96,7 @@ class DockerAddon(DockerBase):
|
|||||||
network_mode='bridge',
|
network_mode='bridge',
|
||||||
ports=self.addons_data.get_ports(self.addon),
|
ports=self.addons_data.get_ports(self.addon),
|
||||||
devices=self.addons_data.get_devices(self.addon),
|
devices=self.addons_data.get_devices(self.addon),
|
||||||
|
environment=self.addons_data.get_environment(self.addon),
|
||||||
volumes=self.volumes,
|
volumes=self.volumes,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,7 +47,9 @@ class DockerHomeAssistant(DockerBase):
|
|||||||
str(self.config.path_extern_config):
|
str(self.config.path_extern_config):
|
||||||
{'bind': '/config', 'mode': 'rw'},
|
{'bind': '/config', 'mode': 'rw'},
|
||||||
str(self.config.path_extern_ssl):
|
str(self.config.path_extern_ssl):
|
||||||
{'bind': '/ssl', 'mode': 'rw'},
|
{'bind': '/ssl', 'mode': 'ro'},
|
||||||
|
str(self.config.path_extern_share):
|
||||||
|
{'bind': '/share', 'mode': 'rw'},
|
||||||
})
|
})
|
||||||
|
|
||||||
self.process_metadata()
|
self.process_metadata()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"hassio": "0.28",
|
"hassio": "0.29",
|
||||||
"homeassistant": "0.44.2",
|
"homeassistant": "0.44.2",
|
||||||
"resinos": "0.7",
|
"resinos": "0.7",
|
||||||
"resinhup": "0.1",
|
"resinhup": "0.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user