Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6fdd892aaf | ||
|
|
90dc5b54c0 | ||
|
|
5b68cf097a | ||
|
|
b50df06358 | ||
|
|
84500a88d1 | ||
|
|
854202a1b8 | ||
|
|
e51a0811a1 | ||
|
|
15fc1f447e | ||
|
|
26b5f910b5 |
@@ -3,7 +3,7 @@ test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3
|
|||||||
test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3
|
test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3
|
||||||
|
|
||||||
# HassOS bootargs
|
# HassOS bootargs
|
||||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait"
|
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait cgroup_enable=memory"
|
||||||
|
|
||||||
# HassOS system A/B
|
# HassOS system A/B
|
||||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro"
|
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3
|
|||||||
test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3
|
test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3
|
||||||
|
|
||||||
# HassOS bootargs
|
# HassOS bootargs
|
||||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait"
|
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait cgroup_enable=memory"
|
||||||
|
|
||||||
# HassOS system A/B
|
# HassOS system A/B
|
||||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro"
|
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
VERSION_MAJOR=1
|
VERSION_MAJOR=1
|
||||||
VERSION_BUILD=1
|
VERSION_BUILD=2
|
||||||
|
|
||||||
HASSOS_NAME="HassOS"
|
HASSOS_NAME="HassOS"
|
||||||
HASSOS_ID="hassos"
|
HASSOS_ID="hassos"
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/hassos-persists-journald.service
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=HassOS persists journald
|
||||||
|
Requires=var-log-journal.mount
|
||||||
|
After=sysinit.target systemd-journald.service
|
||||||
|
RefuseManualStart=true
|
||||||
|
RefuseManualStop=true
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/sbin/hassos-persists-journald
|
||||||
|
RemainAfterExit=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -6,7 +6,6 @@ CONFIG_FILE=/mnt/data/hassos.json
|
|||||||
CLI="$(jq --raw-output '.cli' ${CONFIG_FILE})"
|
CLI="$(jq --raw-output '.cli' ${CONFIG_FILE})"
|
||||||
DOCKER_ARGS="$(jq --raw-output '.cli_args // empty' ${CONFIG_FILE})"
|
DOCKER_ARGS="$(jq --raw-output '.cli_args // empty' ${CONFIG_FILE})"
|
||||||
APPARMOR="$(jq --raw-output '.cli_apparmor // "docker-default"' ${CONFIG_FILE})"
|
APPARMOR="$(jq --raw-output '.cli_apparmor // "docker-default"' ${CONFIG_FILE})"
|
||||||
MACHINE_ID="$(cat /etc/machine-id)"
|
|
||||||
|
|
||||||
CLI_DATA=/mnt/data/cli
|
CLI_DATA=/mnt/data/cli
|
||||||
mkdir -p ${CLI_DATA}
|
mkdir -p ${CLI_DATA}
|
||||||
@@ -16,7 +15,7 @@ docker run \
|
|||||||
--rm -ti --init \
|
--rm -ti --init \
|
||||||
--security-opt apparmor="${APPARMOR}" \
|
--security-opt apparmor="${APPARMOR}" \
|
||||||
-v ${CLI_DATA}:/data \
|
-v ${CLI_DATA}:/data \
|
||||||
-e MACHINE_ID=${MACHINE_ID} \
|
-v /etc/machine-id:/etc/machine-id:ro \
|
||||||
$DOCKER_ARGS \
|
$DOCKER_ARGS \
|
||||||
${CLI}
|
${CLI}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if ! findfs LABEL="config" > /dev/null; then
|
if ! findfs LABEL="CONFIG" > /dev/null; then
|
||||||
echo "[Warning] No config partition found"
|
echo "[Warning] No config partition found"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -19,6 +19,7 @@ if [ -d /mnt/config/network ]; then
|
|||||||
|
|
||||||
rm -rf /etc/NetworkManager/system-connections/*
|
rm -rf /etc/NetworkManager/system-connections/*
|
||||||
cp -f /mnt/config/network/* /etc/NetworkManager/system-connections/
|
cp -f /mnt/config/network/* /etc/NetworkManager/system-connections/
|
||||||
|
chmod 600 /etc/NetworkManager/system-connections/*
|
||||||
|
|
||||||
nmcli con reload
|
nmcli con reload
|
||||||
fi
|
fi
|
||||||
@@ -48,7 +49,8 @@ fi
|
|||||||
|
|
||||||
##
|
##
|
||||||
# Firmware update
|
# Firmware update
|
||||||
if ls /mnt/config/*.raucb > /dev/null; then
|
UPTIME=$(awk '{printf "%0.f", $1}' /proc/uptime)
|
||||||
|
if ls /mnt/config/*.raucb > /dev/null && [ ${UPTIME} -ge 180 ]; then
|
||||||
echo "[Info] Performe a firmware update"
|
echo "[Info] Performe a firmware update"
|
||||||
|
|
||||||
rauc_filename=$(ls /mnt/config/*.raucb | head -n 1)
|
rauc_filename=$(ls /mnt/config/*.raucb | head -n 1)
|
||||||
|
|||||||
21
buildroot-external/rootfs-overlay/usr/sbin/hassos-persists-journald
Executable file
21
buildroot-external/rootfs-overlay/usr/sbin/hassos-persists-journald
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
MACHINE_ID=$(cat /etc/machine-id)
|
||||||
|
CURRENT_LOGS=/var/log/journal/${MACHINE_ID}
|
||||||
|
|
||||||
|
# Loop all logs folder and move
|
||||||
|
for log_folder in /var/log/journal/*; do
|
||||||
|
# Not a log folder
|
||||||
|
if [ ! -d ${log_folder} ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Current log folder
|
||||||
|
if (echo ${log_folder} | grep ${MACHINE_ID}); then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf ${log_folder}
|
||||||
|
done
|
||||||
|
|
||||||
@@ -7,7 +7,6 @@ CONFIG_FILE=/mnt/data/hassos.json
|
|||||||
SUPERVISOR="$(jq --raw-output '.supervisor' ${CONFIG_FILE})"
|
SUPERVISOR="$(jq --raw-output '.supervisor' ${CONFIG_FILE})"
|
||||||
DOCKER_ARGS="$(jq --raw-output '.supervisor_args // empty' ${CONFIG_FILE})"
|
DOCKER_ARGS="$(jq --raw-output '.supervisor_args // empty' ${CONFIG_FILE})"
|
||||||
APPARMOR="$(jq --raw-output '.supervisor_apparmor // "docker-default"' ${CONFIG_FILE})"
|
APPARMOR="$(jq --raw-output '.supervisor_apparmor // "docker-default"' ${CONFIG_FILE})"
|
||||||
MACHINE_ID="$(cat /etc/machine-id)"
|
|
||||||
|
|
||||||
# Init supervisor
|
# Init supervisor
|
||||||
HASSOS_DATA=/mnt/data/supervisor
|
HASSOS_DATA=/mnt/data/supervisor
|
||||||
@@ -25,10 +24,10 @@ runSupervisor() {
|
|||||||
--security-opt apparmor="${APPARMOR}" \
|
--security-opt apparmor="${APPARMOR}" \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v /var/run/dbus:/var/run/dbus \
|
-v /var/run/dbus:/var/run/dbus \
|
||||||
|
-v /etc/machine-id:/etc/machine-id:ro \
|
||||||
-v ${HASSOS_DATA}:/data \
|
-v ${HASSOS_DATA}:/data \
|
||||||
-e SUPERVISOR_SHARE=${HASSOS_DATA} \
|
-e SUPERVISOR_SHARE=${HASSOS_DATA} \
|
||||||
-e SUPERVISOR_NAME=hassos_supervisor \
|
-e SUPERVISOR_NAME=hassos_supervisor \
|
||||||
-e MACHINE_ID=${MACHINE_ID} \
|
|
||||||
$DOCKER_ARGS \
|
$DOCKER_ARGS \
|
||||||
${SUPERVISOR}
|
${SUPERVISOR}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user