Update rauc 1.4 to fix mounted boot partition issue (#809)

* Update rauc 1.4 to fix mounted boot partition issue

* applay update

* fix characters

* fix CI

* Support old format

* fix mcopy prefix

* fix lint

* fix lint

* clean style

* Fix script

* fix syntax

* Support all system

* fix shell

* Fix script
This commit is contained in:
Pascal Vizeli
2020-08-06 19:37:52 +02:00
committed by GitHub
parent 701e4f78aa
commit 0c427d0dee
9 changed files with 76 additions and 28 deletions

View File

@@ -2,29 +2,47 @@
##
# Hooks
env
# Handle boot hocks
if [ "${RAUC_SLOT_CLASS}" = "boot" ]; then
BOOT_DATA=/tmp/boot-data
BOOT_TMP=/tmp/boot-tmp
BOOT_NEW=/tmp/boot-new
BOOT_MNT=/mnt/boot
mkdir -p ${BOOT_DATA}
if [ "${1}" = "slot-pre-install" ]; then
cp -f ${RAUC_SLOT_MOUNT_POINT}/*.txt ${BOOT_DATA}/
elif [ "${1}" = "slot-post-install" ]; then
cp -f ${BOOT_DATA}/*.txt ${RAUC_SLOT_MOUNT_POINT}/
mkdir -p "${BOOT_TMP}"
mkdir -p "${BOOT_NEW}"
mount "${RAUC_IMAGE_NAME}" "${BOOT_NEW}"
# Old systems
if ! systemctl -q is-active mnt-boot.mount; then
mount "${RAUC_SLOT_DEVICE}" "${BOOT_MNT}"
fi
# Backup boot config
cp -f "${BOOT_MNT}"/*.txt "${BOOT_TMP}/"
# Update
cp -rf "${BOOT_NEW}"/* "${BOOT_MNT}/"
# Restore boot config
cp -f "${BOOT_TMP}"/*.txt "${BOOT_MNT}/"
umount "${BOOT_NEW}"
rm -rf "${BOOT_TMP}" "${BOOT_NEW}"
fi
# Handle spl install
if [ "${RAUC_SLOT_CLASS}" = "spl" ]; then
DEVICE_CHILD="$(findfs LABEL="hassos-boot")"
DEVICE_ROOT="/dev/$(lsblk -no pkname ${DEVICE_CHILD})"
DEVICE_ROOT="/dev/$(lsblk -no pkname "${DEVICE_CHILD}")"
if sfdisk -dq ${DEVICE_ROOT} | grep -q 'label: gpt'; then
dd if=${RAUC_IMAGE_NAME} of=${DEVICE_ROOT} conv=notrunc bs=512 seek=2 skip=2
if sfdisk -dq "${DEVICE_ROOT}" | grep -q 'label: gpt'; then
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc bs=512 seek=2 skip=2
else
dd if=${RAUC_IMAGE_NAME} of=${DEVICE_ROOT} conv=notrunc bs=1 count=440
dd if=${RAUC_IMAGE_NAME} of=${DEVICE_ROOT} conv=notrunc bs=512 seek=1 skip=1
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc bs=1 count=440
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc bs=512 seek=1 skip=1
fi
fi

View File

@@ -1,3 +0,0 @@
#!/bin/sh
systemctl start mnt-boot.mount

View File

@@ -1,3 +0,0 @@
#!/bin/sh
systemctl stop mnt-boot.mount

View File

@@ -34,7 +34,7 @@ function create_ota_update() {
echo "filename=hook"
echo "[image.boot]"
echo "filename=boot.vfat"
echo "hooks=pre-install;post-install"
echo "hooks=install"
echo "[image.kernel]"
echo "filename=kernel.ext4"
echo "[image.rootfs]"

View File

@@ -4,15 +4,11 @@ set -e
function _create_rauc_header() {
(
echo "[system]"
echo "compatible=$(hassos_rauc_compatible)"
echo "compatible=$(hassos_rauc_compatible)"
echo "mountprefix=/run/rauc"
echo "statusfile=/mnt/data/rauc.db"
echo "bootloader=${BOOTLOADER}"
echo "[handlers]"
echo "pre-install=/usr/lib/rauc/pre-install"
echo "post-install=/usr/lib/rauc/post-install"
echo "[keyring]"
echo "path=/etc/rauc/keyring.pem"
) > "${TARGET_DIR}/etc/rauc/system.conf"
@@ -24,6 +20,7 @@ function _write_rauc_boot() {
echo "[slot.boot.0]"
echo "device=/dev/disk/by-partlabel/hassos-boot"
echo "type=vfat"
echo "allow-mounted=true"
) >> "${TARGET_DIR}/etc/rauc/system.conf"
# SPL