diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml index a86b2b133..998f14198 100644 --- a/azure-pipelines-ci.yml +++ b/azure-pipelines-ci.yml @@ -46,8 +46,8 @@ jobs: scripts/*.sh \ buildroot-external/scripts/*.sh \ buildroot-external/board/**/*.sh \ + buildroot-external/ota/rauc-hook \ buildroot-external/rootfs-overlay/usr/bin/* \ buildroot-external/rootfs-overlay/usr/sbin/* \ buildroot-external/rootfs-overlay/usr/libexec/* \ - buildroot-external/rootfs-overlay/usr/lib/rauc/* displayName: 'Run ShellCheck' diff --git a/buildroot-external/ota/rauc-hook b/buildroot-external/ota/rauc-hook index de24bf499..13783f6ae 100755 --- a/buildroot-external/ota/rauc-hook +++ b/buildroot-external/ota/rauc-hook @@ -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 diff --git a/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install b/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install deleted file mode 100755 index b552daafc..000000000 --- a/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -systemctl start mnt-boot.mount diff --git a/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install b/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install deleted file mode 100755 index 71b4b94b3..000000000 --- a/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -systemctl stop mnt-boot.mount diff --git a/buildroot-external/scripts/ota.sh b/buildroot-external/scripts/ota.sh index 3e95801ae..21c7c587f 100755 --- a/buildroot-external/scripts/ota.sh +++ b/buildroot-external/scripts/ota.sh @@ -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]" diff --git a/buildroot-external/scripts/rauc.sh b/buildroot-external/scripts/rauc.sh index 0fadf6554..4e092bded 100755 --- a/buildroot-external/scripts/rauc.sh +++ b/buildroot-external/scripts/rauc.sh @@ -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 diff --git a/buildroot-patches/0011-package-rauc-bump-version-to-1.4.patch b/buildroot-patches/0011-package-rauc-bump-version-to-1.4.patch new file mode 100644 index 000000000..8d2534988 --- /dev/null +++ b/buildroot-patches/0011-package-rauc-bump-version-to-1.4.patch @@ -0,0 +1,39 @@ +From 921d8ba2bd2cedf30582d9be8fb4dcf57061f42d Mon Sep 17 00:00:00 2001 +From: Pascal Vizeli +Date: Thu, 6 Aug 2020 10:15:32 +0000 +Subject: [PATCH 1/1] package/rauc: bump version to 1.4 + +Signed-off-by: Pascal Vizeli +--- + package/rauc/rauc.hash | 6 +++--- + package/rauc/rauc.mk | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/package/rauc/rauc.hash b/package/rauc/rauc.hash +index 54760347c7..51f37f6cb8 100644 +--- a/package/rauc/rauc.hash ++++ b/package/rauc/rauc.hash +@@ -1,4 +1,4 @@ + # Locally calculated, after verifying against +-# https://github.com/rauc/rauc/releases/download/v1.2/rauc-1.2.tar.xz.asc +-sha256 224683fc1fac50ccb89128aa786445cd8e26bb25deafd4410e0807187376e661 rauc-1.2.tar.xz +-sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING ++# https://github.com/rauc/rauc/releases/download/v1.3/rauc-1.4.tar.xz.asc ++sha256 85aabf214cd93a37f7ad0b3aaad89eb94facf0f3ebf6e2edca945acbca9b0967 rauc-1.4.tar.xz ++sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING +diff --git a/package/rauc/rauc.mk b/package/rauc/rauc.mk +index 5a208e07ae..1915c783aa 100644 +--- a/package/rauc/rauc.mk ++++ b/package/rauc/rauc.mk +@@ -4,7 +4,7 @@ + # + ################################################################################ + +-RAUC_VERSION = 1.2 ++RAUC_VERSION = 1.4 + RAUC_SITE = https://github.com/rauc/rauc/releases/download/v$(RAUC_VERSION) + RAUC_SOURCE = rauc-$(RAUC_VERSION).tar.xz + RAUC_LICENSE = LGPL-2.1 +-- +2.17.1 + diff --git a/buildroot/package/rauc/rauc.hash b/buildroot/package/rauc/rauc.hash index 54760347c..51f37f6cb 100644 --- a/buildroot/package/rauc/rauc.hash +++ b/buildroot/package/rauc/rauc.hash @@ -1,4 +1,4 @@ # Locally calculated, after verifying against -# https://github.com/rauc/rauc/releases/download/v1.2/rauc-1.2.tar.xz.asc -sha256 224683fc1fac50ccb89128aa786445cd8e26bb25deafd4410e0807187376e661 rauc-1.2.tar.xz -sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING +# https://github.com/rauc/rauc/releases/download/v1.3/rauc-1.4.tar.xz.asc +sha256 85aabf214cd93a37f7ad0b3aaad89eb94facf0f3ebf6e2edca945acbca9b0967 rauc-1.4.tar.xz +sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING diff --git a/buildroot/package/rauc/rauc.mk b/buildroot/package/rauc/rauc.mk index 5a208e07a..1915c783a 100644 --- a/buildroot/package/rauc/rauc.mk +++ b/buildroot/package/rauc/rauc.mk @@ -4,7 +4,7 @@ # ################################################################################ -RAUC_VERSION = 1.2 +RAUC_VERSION = 1.4 RAUC_SITE = https://github.com/rauc/rauc/releases/download/v$(RAUC_VERSION) RAUC_SOURCE = rauc-$(RAUC_VERSION).tar.xz RAUC_LICENSE = LGPL-2.1