1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2025-12-24 20:35:31 +00:00
Files
operating-system/buildroot-external/package/hassio/create-data-partition.sh
Stefan Agner f169f78bb0 Add Kconfig option for Supervisor channel (#3618)
* Add Makefile variable for Supervisor channel

Allow to set the release channel pre-installed Home Assistant components
like Supervisor and add-on are fetched from. This channel is then also
used at runtime.

* Use choice instead of string variable

* Fix channel in Supervisor updater.json config

* Add newlines
2024-11-18 14:39:46 +01:00

34 lines
898 B
Bash
Executable File

#!/usr/bin/env bash
set -e
build_dir=$1
dst_dir=$2
channel=$3
data_img="${dst_dir}/data.ext4"
# Make image
rm -f "${data_img}"
truncate --size="1280M" "${data_img}"
mkfs.ext4 -L "hassos-data" -E lazy_itable_init=0,lazy_journal_init=0 "${data_img}"
# Mount / init file structs
mkdir -p "${build_dir}/data/"
sudo mount -o loop,discard "${data_img}" "${build_dir}/data/"
# Use official Docker in Docker images
# Ideally we use the same version as Buildroot is using in case the
# overlayfs2 storage format changes
container=$(docker run --privileged -e DOCKER_TLS_CERTDIR="" \
-v "${build_dir}/data/":/data \
-v "${build_dir}/data/docker/":/var/lib/docker \
-v "${build_dir}":/build \
-d docker:27.2-dind --storage-driver overlay2)
docker exec "${container}" sh /build/dind-import-containers.sh "${channel}"
docker stop "${container}"
# Unmount data image
sudo umount "${build_dir}/data/"