+++ /dev/null
-LANG=en_CA.utf8
+++ /dev/null
-#!/bin/sh
-
-# To have the date/time displayed in 24h format:
-export LC_TIME=C
-FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
-
-SRC_URI:append = " \
- file://locale.conf \
- file://locale.sh \
-"
-
do_install:append () {
echo "hvmpd" > ${D}${sysconfdir}/hostname
# Maybe make this machine-specific in the future...
echo "${MACHINE} revA" > ${D}${sysconfdir}/hwrevision
- # /etc/locale.conf is systemd-specific.
- install -d ${D}${sysconfdir}
- install -m 0644 ${WORKDIR}/locale.conf ${D}${sysconfdir}
-
- install -d ${D}${sysconfdir}/profile.d
- install -m 0644 locale.sh ${D}${sysconfdir}/profile.d/
-
- echo "# Manually added entries for HV MPD server project:" >> \
- ${D}${sysconfdir}/fstab
-
# Note: mount points will be automatically created when using systemd.
- if [ x"${BOOT_PART_ID}" != x"" ]; then
- echo "${ROOT_PARENT_DEV}${ROOT_PART_PREFIX}${BOOT_PART_ID} /boot auto defaults 0 0" >> \
- ${D}${sysconfdir}/fstab
- fi
-
- if [ x"${DATA_PART_ID}" != x"" ]; then
- echo "${DATA_PART_ID} /mnt/data auto defaults 0 0" >> \
- ${D}${sysconfdir}/fstab
- fi
-
if [ "${NFS_SERVER}" != "" ]; then
echo "${NFS_SERVER}:${NFS_SERVER_DIR} ${NFS_MOUNT_POINT} nfs bg,nolock 0 0" >> \
${D}${sysconfdir}/fstab
+++ /dev/null
-
-# L'environnement U-Boot doit être valide pour utiliser ce script.
-# Après la programmation initiale avec uuu, il faut effectuer la sauvegarde
-# de l'environnement en mémoire non-volatile (ex: eMMC) dans U-boot avec
-# 'saveenv'. Sinon, fw_saveenv va utiliser l'environnement par défaut contenu
-# dans /etc/u-boot-initial-env
-if fw_printenv 2>&1 | grep -q 'Cannot read environment'; then
- echo "Warning: U-Boot environment cannot be read. Make sure you save the"
- echo " default environment to flash using these U-Boot commands:"
- echo " $> env default -a"
- echo " $> saveenv"
-fi
-
-# Return the partition device
-get_destination_partition_device()
-{
- # Find internal parent kernel device name of rootfs.
- # For example:
- # - /dev/sda1 --> /dev/sda
- # - /dev/mmcblk2p2 --> /dev/mmcblk2
- disk="/dev/$(lsblk -ndo pkname $(findmnt -n -o SOURCE /))"
-
- if [ ! -b "${disk}" ]; then
- log_err "Error: disk \"${disk}\" not found"
- fi
-
- update_dev="${disk}${next_part}"
-
- if [ ! -b "${update_dev}" ]; then
- log_err "Error: destination partition \"${update_dev}\" not found"
- fi
-
- echo "${update_dev}"
- return 0
-}
-
-mount_destination_partition()
-{
- update_dev=$(get_destination_partition_device)
-
- # Create temporary mount point:
- mnt_point=$(mktemp -q -d /tmp/swupdate-mount.XXXXXX)
- if [ ${?} -ne 0 ]; then
- log_err "Error: cannot create temporary file"
- fi
-
- # Mount update partition:
- mount -t ${FSTYPE} ${update_dev} ${mnt_point}
-}
-
-unmount_destination_partition()
-{
- if mount | grep -q ${mnt_point}; then
- umount ${mnt_point}
- fi
-
- if [ -d ${mnt_point} ]; then
- rmdir ${mnt_point}
- fi
-}
-
-do_preinst()
-{
- update_dev=$(get_destination_partition_device)
- log_info "Reformat destination partition: ${update_dev}"
-
- label="$(blkid -s LABEL -o value ${update_dev})"
-
- # Reformat destination partition:
- mkfs.${FSTYPE} ${update_dev} -L "${label}"
-
- exit 0
-}
-
-do_postinst()
-{
- mount_destination_partition
-
- # Perform migration of selected files/folders...
- log_info "migrating existing data..."
-
- # Migrate files:
- for f in ${SWU_PRESERVE_FILES}; do
- if [ ! -f ${f} ]; then
- log_warn "warning: missing source file: ${f} (skipping)"
- continue
- fi
-
- dst_folder="$(dirname ${mnt_point}/${f})"
-
- # Do not copy file if destination folder doesn't exist.
- # The destination folder need to be created in your new SWU archive
- # with the proper ownership and permissions (can be empty)
- if [ ! -d ${dst_folder} ]; then
- log_warn "warning: missing destination folder for file: ${f} (skipping)"
- continue
- fi
-
- # Copy old file to new partition:
- cp -a ${f} ${mnt_point}/${f}
- done
-
- # Migrate folders:
- for d in ${SWU_PRESERVE_FOLDERS}; do
- if [ ! -d ${d} ]; then
- log_warn "warning: missing source folder: ${d} (skipping)"
- continue
- fi
-
- if [ -d ${mnt_point}/${d} ]; then
- # Remove folder if it exists in new partition:
- rm -rf ${mnt_point}/${d}
- fi
-
- # Copy old folder to new partition:
- cp -a ${d} ${mnt_point}/${d}
- done
-
- unmount_destination_partition
-
- exit 0
-}
-
-next_part=${2}
-
-case "$1" in
- preinst)
- do_preinst
- ;;
- postinst)
- do_postinst
- ;;
- *)
- log_err "unsupported install mode: \"${1}\""
- ;;
-esac
+++ /dev/null
-#!/bin/sh
-set -e
-
-# Shell scripts are called via system command. SWUpdate scans for all scripts
-# and calls them before and after installing the images. SWUpdate passes
-# ‘preinst’ or ‘postinst’ as first argument to the script. If the data attribute
-# is defined, its value is passed as the last argument(s) to the script.
-
-trap 'catch $?' EXIT
-
-# Arg1: log message/string
-log_info() {
- printf "$(basename ${0}): ${*}\n"
-}
-
-log_warn() {
- printf >&2 "$(basename ${0}): ${*}\n"
-}
-
-log_err() {
- printf >&2 "$(basename ${0}): ${*}\n"
- exit 1
-}
-
-catch()
-{
- if [ "$1" != "0" ]; then
- # Error handling goes here
- printf >&2 "$(basename ${0}): Error $1 occurred\n"
-
- if [ -n "${mnt_point}" ]; then
- if mount | grep -q ${mnt_point}; then
- unmount_destination_partition
- fi
- fi
- fi
-}
-
-FSTYPE="ext4"
-
-log_info "arguments = \"${*}\""
-
-if [ $# -lt 2 ]; then
- exit 1;
-fi
-
-alias cp=cp
-
+++ /dev/null
-SUMMARY = "Deploy SWUpdate shell scripts to support A/B update mechanism"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-
-FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
-
-SRC_URI = " \
- file://update.header.sh \
- file://update.footer.sh \
-"
-
-inherit deploy
-
-# Default list of files/folders to preserve between updates, can be extended/overriden by BSP:
-SWU_PRESERVE_FILES ?= "\
- /etc/hostname \
- /etc/localtime \
-"
-SWU_PRESERVE_FOLDERS ?= ""
-
-DEST_SCR = "${DEPLOYDIR}/${PN}.sh"
-
-do_deploy() {
- cat ${WORKDIR}/update.header.sh > ${DEST_SCR}
-
- # Insert our variable(s) between header and footer:
- echo "SWU_PRESERVE_FILES=\"\\" >> ${DEST_SCR}
- for f in ${SWU_PRESERVE_FILES}; do
- echo " ${f} \\" >> ${DEST_SCR}
- done
- echo "\"" >> ${DEST_SCR}
-
- echo "SWU_PRESERVE_FOLDERS=\"\\" >> ${DEST_SCR}
- for f in ${SWU_PRESERVE_FOLDERS}; do
- echo " ${f} \\" >> ${DEST_SCR}
- done
- echo "\"" >> ${DEST_SCR}
-
- cat ${WORKDIR}/update.footer.sh >> ${DEST_SCR}
-}
-
-addtask deploy after do_install
+++ /dev/null
-#!/bin/sh
-
-# This file will be loaded when swupdate is started from a systemd service.
-
-# Find on which rootfs we are currently running (A or B):
-device="/dev/$(lsblk -ndo kname $(findmnt -n -o SOURCE /))"
-disk="/dev/$(lsblk -ndo pkname ${device})"
-
-part=$(echo "${device}" | sed "s@${disk}.*\([0-9]\+\)\$@\1@")
-
-if [ x"${part}" = x"@ROOT_PART_A_ID@" ]; then
- next_rootfs=B
-elif [ x"${part}" = x"@ROOT_PART_B_ID@" ]; then
- next_rootfs=A
-else
- echo "Error: cannot determine current A/B partition"
- exit 1
-fi
-
-SWUPDATE_EXTRA_ARGS="-e stable,rootfs${next_rootfs} -f /etc/swupdate.cfg"
-SWUPDATE_ARGS="-v ${SWUPDATE_EXTRA_ARGS}"
+++ /dev/null
-
-
-CONFIG_HAVE_DOT_CONFIG=y
-
-#
-# Swupdate Settings
-#
-
-#
-# General Configuration
-#
-# CONFIG_CURL is not set
-# CONFIG_CURL_SSL is not set
-CONFIG_SYSTEMD=y
-CONFIG_DEFAULT_CONFIG_FILE="/etc/swupdate.cfg"
-CONFIG_SCRIPTS=y
-CONFIG_HW_COMPATIBILITY=y
-CONFIG_HW_COMPATIBILITY_FILE="/etc/hwrevision"
-CONFIG_SW_VERSIONS_FILE="/etc/sw-versions"
-
-#
-# Socket Paths
-#
-CONFIG_SOCKET_CTRL_PATH=""
-CONFIG_SOCKET_PROGRESS_PATH=""
-CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY="/tmp/"
-CONFIG_MTD=y
-CONFIG_LUA=y
-CONFIG_LUAPKG="lua"
-# CONFIG_FEATURE_SYSLOG is not set
-
-#
-# Build Options
-#
-CONFIG_CROSS_COMPILE=""
-CONFIG_SYSROOT=""
-CONFIG_EXTRA_LDLIBS=""
-
-#
-# Debugging Options
-#
-# CONFIG_DEBUG is not set
-# CONFIG_WERROR is not set
-# CONFIG_NOCLEANUP is not set
-# CONFIG_BOOTLOADER_EBG is not set
-CONFIG_UBOOT=y
-# CONFIG_BOOTLOADER_NONE is not set
-# CONFIG_BOOTLOADER_GRUB is not set
-CONFIG_UBOOT_FWENV="/etc/fw_env.config"
-CONFIG_UBOOT_DEFAULTENV="/etc/u-boot-initial-env"
-# CONFIG_SSL_IMPL_NONE is not set
-CONFIG_SSL_IMPL_OPENSSL=y
-# CONFIG_SSL_IMPL_MBEDTLS is not set
-# CONFIG_DOWNLOAD is not set
-CONFIG_HASH_VERIFY=y
-# CONFIG_SIGNED_IMAGES is not set
-# CONFIG_ENCRYPTED_IMAGES is not set
-# CONFIG_SURICATTA is not set
-CONFIG_WEBSERVER=n
-
-#
-# Webserver Features
-#
-CONFIG_MONGOOSE=n
-
-#
-# Mongoose Feature
-#
-CONFIG_MONGOOSEIPV6=n
-CONFIG_MONGOOSESSL=n
-
-#
-# Archival Features
-#
-CONFIG_GUNZIP=y
-# CONFIG_ZSTD is not set
-
-#
-# Parser Features
-#
-CONFIG_LIBCONFIG=y
-CONFIG_PARSERROOT=""
-# CONFIG_JSON is not set
-# CONFIG_LUAEXTERNAL is not set
-# CONFIG_SETSWDESCRIPTION is not set
-
-#
-# Image Handlers
-#
-# CONFIG_UBIVOL is not set
-CONFIG_CFI=y
-# CONFIG_CFIHAMMING1 is not set
-# CONFIG_DISKPART is not set
-CONFIG_RAW=y
-# CONFIG_RDIFFHANDLER is not set
-CONFIG_LUASCRIPTHANDLER=y
-CONFIG_SHELLSCRIPTHANDLER=y
-# CONFIG_HANDLER_IN_LUA is not set
-CONFIG_ARCHIVE=y
-# CONFIG_REMOTE_HANDLER is not set
-# CONFIG_SWUFORWARDER_HANDLER is not set
-CONFIG_BOOTLOADERHANDLER=y
-# CONFIG_SSBLSWITCH is not set
-# CONFIG_UCFWHANDLER is not set
+++ /dev/null
-globals :
-{
- verbose = true;
- loglevel = 5;
- syslog = true;
-};
+++ /dev/null
-FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
-
-SRC_URI:append = " \
- file://defconfig \
- file://swupdate.cfg \
- file://99-hvmpd-args.in \
-"
-
-do_install:append() {
- install -d ${D}${libdir}/swupdate/conf.d/
-
- sed -e s/@ROOT_PART_A_ID@/${ROOT_PART_A_ID}/ \
- -e s/@ROOT_PART_B_ID@/${ROOT_PART_B_ID}/ \
- ${WORKDIR}/99-hvmpd-args.in > ${WORKDIR}/99-hvmpd-args
- install -m 644 ${WORKDIR}/99-hvmpd-args ${D}${libdir}/swupdate/conf.d/
-
- install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}/
-}