Modified true-hitless scripts not to exit with error when the true-hitless package is not installed.
Modified emmc-true-hitless-enable.sh to check for the existence and enablement of the True Hitless package. If the package is absent, the script now exits with status 0 (success) instead of an error.
Fusion-Link: http://fusion2/ci/kokoro/prod%3Agbmc%2Ffirmware-build%2Ffirmware%2Fredacted_gbmc_platforms/activity/7fb76cb0-4603-4bdf-8c0d-246129fee2b6
Tested: Tested to build SPI image and tested it with true-hitless-image with no issues. "Nov 07 13:51:34 dddev9-nfd01.prod.google.com systemd[1]: Starting eMMC Available Postprocessing...
Nov 07 13:51:34 dddev9-nfd01.prod.google.com emmc-true-hitless-enable.sh[285]: True-hitless package is not installed (true-hitless directory not found at /var/google/true-hitless)
Nov 07 13:51:41 dddev9-nfd01.prod.google.com systemd[1]: Finished eMMC Available Postprocessing."
Google-Bug-Id: 455732077
Change-Id: Ia8d1822dc9871dbbe355baea352660bd7d6bbea9
Signed-off-by: Baicheng Zong <baichengz@google.com>
diff --git a/recipes-google/true-hitless/true-hitless/emmc-true-hitless-enable.sh b/recipes-google/true-hitless/true-hitless/emmc-true-hitless-enable.sh
index 2c0ed87..88b00f7 100644
--- a/recipes-google/true-hitless/true-hitless/emmc-true-hitless-enable.sh
+++ b/recipes-google/true-hitless/true-hitless/emmc-true-hitless-enable.sh
@@ -10,7 +10,9 @@
EMMC_TRUE_HITLESS_ROOTFS_DIR="${EMMC_TRUE_HITLESS_BASE_DIR}/rootfs"
EMMC_TRUE_HITLESS_SYSTEMD_DIR="${EMMC_TRUE_HITLESS_ROOTFS_DIR}/usr/lib/systemd/system"
# Persistent configuration paths
-PERSISTENT_IMAGE_CHECKSUM_FILE="/var/google/true-hitless/true-hitless-image.sha256sum"
+PERSISTENT_TRUE_HITLESS_CONFIG_DIR="/var/google/true-hitless"
+PERSISTENT_SERVICE_LIST_FILE="${PERSISTENT_TRUE_HITLESS_CONFIG_DIR}/true-hitless-service-list.txt"
+PERSISTENT_IMAGE_CHECKSUM_FILE="${PERSISTENT_TRUE_HITLESS_CONFIG_DIR}/true-hitless-image.sha256sum"
# Systemd runtime configuration
SYSTEMD_RUNTIME_OVERRIDE_DIR="/run/systemd/system"
EMMC_MANAGED_SERVICE_FILES="emmc-services-restart.service emmc-services-fallback.service"
@@ -24,6 +26,18 @@
VERSION_COMPATIBILITY_CHECK_SCRIPT="/usr/bin/true-hitless-version-check.sh"
changes_made=0
+# Verify true-hitless package installation and enablement
+if [ ! -d "${PERSISTENT_TRUE_HITLESS_CONFIG_DIR}" ]; then
+ echo "True-hitless package is not installed (true-hitless directory not found at ${PERSISTENT_TRUE_HITLESS_CONFIG_DIR})" >&2
+ exit 0
+fi
+if [ ! -f "${PERSISTENT_SERVICE_LIST_FILE}" ]; then
+ echo "True-hitless is not enabled (service list file not found at ${PERSISTENT_SERVICE_LIST_FILE})" >&2
+ exit 0
+fi
+echo "True-hitless is enabled" >&2
+echo "Starting emmc-available postprocessing..." >&2
+
# Check existence of true-hitless image for current machine
if [ ! -f "${EMMC_TRUE_HITLESS_IMAGE_FILE}" ]; then
echo "Error: True-hitless image not found: ${EMMC_TRUE_HITLESS_IMAGE_FILE}" >&2
diff --git a/recipes-google/true-hitless/true-hitless/true-hitless-initialize.sh b/recipes-google/true-hitless/true-hitless/true-hitless-initialize.sh
index 95bd6e8..c06619a 100644
--- a/recipes-google/true-hitless/true-hitless/true-hitless-initialize.sh
+++ b/recipes-google/true-hitless/true-hitless/true-hitless-initialize.sh
@@ -20,7 +20,7 @@
# 1. Verify true-hitless package installation and enablement
################################################################################
if [ ! -d "${PERSISTENT_TRUE_HITLESS_CONFIG_DIR}" ]; then
- echo "True-hitless package is not installed at ${PERSISTENT_TRUE_HITLESS_CONFIG_DIR}" >&2
+ echo "True-hitless package is not installed (true-hitless directory not found at ${PERSISTENT_TRUE_HITLESS_CONFIG_DIR})" >&2
exit 0
fi
if [ ! -f "${PERSISTENT_SERVICE_LIST_FILE}" ]; then