From 8a62e7c50ff25ff46684649d9fbfe87d9bc870d0 Mon Sep 17 00:00:00 2001 From: Milosz Wasilewski Date: Mon, 15 Jan 2024 13:48:25 +0000 Subject: [PATCH] automated: linux: use modular toml in factory-reset This change aligns factory reset test with all OTA tests in using modular approach to .toml files. Signed-off-by: Milosz Wasilewski --- automated/linux/factory-reset/prepare-reset.sh | 9 ++++++--- automated/linux/factory-reset/verify-reboot.sh | 3 ++- automated/linux/factory-reset/z-99-aklite-callback.toml | 5 +---- .../linux/factory-reset/z-99-aklite-disable-reboot.toml | 1 + automated/linux/ota-apps/update-apps.sh | 2 +- automated/linux/ota-rollback/download-update.sh | 3 +-- automated/linux/ota-update/download-update.sh | 2 +- automated/linux/ota-update/static-delta.sh | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) mode change 100644 => 120000 automated/linux/factory-reset/z-99-aklite-callback.toml create mode 120000 automated/linux/factory-reset/z-99-aklite-disable-reboot.toml diff --git a/automated/linux/factory-reset/prepare-reset.sh b/automated/linux/factory-reset/prepare-reset.sh index d098bea88..3290d978d 100755 --- a/automated/linux/factory-reset/prepare-reset.sh +++ b/automated/linux/factory-reset/prepare-reset.sh @@ -10,6 +10,7 @@ export RESULT_FILE TYPE="factory_reset" ADDITIONAL_TYPE="" LABEL="" +SOTA_CONFDIR="/etc/sota/conf.d" usage() { echo "\ @@ -47,10 +48,12 @@ create_out_dir "${OUTPUT}" cp aklite-callback.sh /var/sota/ chmod 755 /var/sota/aklite-callback.sh -mkdir -p /etc/sota/conf.d -cp z-99-aklite-callback.toml /etc/sota/conf.d/ +mkdir -p "${SOTA_CONFDIR}" +cp z-99-aklite-callback.toml "${SOTA_CONFDIR}" +cp z-99-aklite-disable-reboot.toml "${SOTA_CONFDIR}" if [ -n "${LABEL}" ]; then - echo "${LABEL}" >> /etc/sota/tag + echo "[pacman]" > "${SOTA_CONFDIR}"/z-99-aklite-tag.toml + echo "tags = ${LABEL}" >> "${SOTA_CONFDIR}"/z-99-aklite-tag.toml fi # create signal files touch /var/sota/ota.signal diff --git a/automated/linux/factory-reset/verify-reboot.sh b/automated/linux/factory-reset/verify-reboot.sh index 6359cd66b..c3575963f 100755 --- a/automated/linux/factory-reset/verify-reboot.sh +++ b/automated/linux/factory-reset/verify-reboot.sh @@ -8,6 +8,7 @@ OUTPUT="$(pwd)/output" RESULT_FILE="${OUTPUT}/result.txt" export RESULT_FILE TYPE="factory_reset" +SOTA_CONFDIR="/etc/sota/conf.d" usage() { echo "\ @@ -36,7 +37,7 @@ create_out_dir "${OUTPUT}" ls -l /etc/ ls -l /var/sota -if [ -f /etc/sota/conf.d/z-99-aklite-callback.toml ]; then +if [ -f "${SOTA_CONFDIR}/z-99-aklite-callback.toml" ]; then report_fail "${TYPE}-reset-aklite-callback-exists" else report_pass "${TYPE}-reset-aklite-callback-exists" diff --git a/automated/linux/factory-reset/z-99-aklite-callback.toml b/automated/linux/factory-reset/z-99-aklite-callback.toml deleted file mode 100644 index 86247d583..000000000 --- a/automated/linux/factory-reset/z-99-aklite-callback.toml +++ /dev/null @@ -1,4 +0,0 @@ -[bootloader] -reboot_command = "/bin/true" -[pacman] -callback_program = "/var/sota/aklite-callback.sh" diff --git a/automated/linux/factory-reset/z-99-aklite-callback.toml b/automated/linux/factory-reset/z-99-aklite-callback.toml new file mode 120000 index 000000000..cd6827328 --- /dev/null +++ b/automated/linux/factory-reset/z-99-aklite-callback.toml @@ -0,0 +1 @@ +../ota-update/z-99-aklite-callback.toml \ No newline at end of file diff --git a/automated/linux/factory-reset/z-99-aklite-disable-reboot.toml b/automated/linux/factory-reset/z-99-aklite-disable-reboot.toml new file mode 120000 index 000000000..d3cbf7c8d --- /dev/null +++ b/automated/linux/factory-reset/z-99-aklite-disable-reboot.toml @@ -0,0 +1 @@ +../ota-update/z-99-aklite-disable-reboot.toml \ No newline at end of file diff --git a/automated/linux/ota-apps/update-apps.sh b/automated/linux/ota-apps/update-apps.sh index 16ba67757..0df506b8b 100755 --- a/automated/linux/ota-apps/update-apps.sh +++ b/automated/linux/ota-apps/update-apps.sh @@ -11,7 +11,7 @@ TYPE="regular" APPNAME="" VERSION="" DEBUG="false" -SOTA_CONFDIR="/etc/sota/conf.d/" +SOTA_CONFDIR="/etc/sota/conf.d" usage() { echo "\ diff --git a/automated/linux/ota-rollback/download-update.sh b/automated/linux/ota-rollback/download-update.sh index ff43160f1..acb776121 100755 --- a/automated/linux/ota-rollback/download-update.sh +++ b/automated/linux/ota-rollback/download-update.sh @@ -15,7 +15,7 @@ export UBOOT_VAR_SET_TOOL PACMAN_TYPE="ostree+compose_apps" UBOOT_IMAGE_NAME="u-boot.itb" DEBUG="false" -SOTA_CONFDIR="/etc/sota/conf.d/" +SOTA_CONFDIR="/etc/sota/conf.d" usage() { echo "\ @@ -93,7 +93,6 @@ cp z-99-aklite-disable-reboot.toml "${SOTA_CONFDIR}" if [ "${PACMAN_TYPE}" = "ostree" ]; then cp z-99-ostree.toml "${SOTA_CONFDIR}" fi - report_pass "${TYPE}-create-aklite-callback" # create signal files touch /var/sota/ota.signal diff --git a/automated/linux/ota-update/download-update.sh b/automated/linux/ota-update/download-update.sh index 010dda4a7..1e422e39d 100755 --- a/automated/linux/ota-update/download-update.sh +++ b/automated/linux/ota-update/download-update.sh @@ -16,7 +16,7 @@ PACMAN_TYPE="ostree+compose_apps" U_BOOT_VARIABLE_NAME="foobar" U_BOOT_VARIABLE_VALUE="baz" DEBUG="false" -SOTA_CONFDIR="/etc/sota/conf.d/" +SOTA_CONFDIR="/etc/sota/conf.d" usage() { echo "\ diff --git a/automated/linux/ota-update/static-delta.sh b/automated/linux/ota-update/static-delta.sh index 68c247520..b32442e87 100755 --- a/automated/linux/ota-update/static-delta.sh +++ b/automated/linux/ota-update/static-delta.sh @@ -16,7 +16,7 @@ OTA_THRESHOLD=90 # than 100 means there should not be enough space for the # OTA update FILL_SIZE=99 -SOTA_CONFDIR="/etc/sota/conf.d/" +SOTA_CONFDIR="/etc/sota/conf.d" usage() { echo "\