summaryrefslogtreecommitdiffstats
path: root/templates/feature/agl-voiceagent-alexa-wakeword/50_setup.sh
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2021-02-01 18:06:35 -0500
committerScott Murray <scott.murray@konsulko.com>2021-02-01 18:06:35 -0500
commit3eb1a00c35bd817472067a153c793c9c7aef00a3 (patch)
tree369a89b53d82604c2775972016f671640cdd1995 /templates/feature/agl-voiceagent-alexa-wakeword/50_setup.sh
parente0d5ad833e89f47c88601e15158015319e568af8 (diff)
meta-speech-framework: Update Alexa Auto SDK wakeword support for v2.3
Update the agl-voiceagent-alexa-wakeword feature template for v2.3: - Added a scriptlet to handle installing and patching the amazonlite zip file contents. The amazonlite-2.3.zip file is now expected to be in the directory set with the XDG_DOWNLOAD_DIR environment variable, and if that is not set, it will use $HOME/Downloads (i.e. the same behavior as the rcar3 graphics support files). - Added a patch to tweak a couple of things in the amazonlite layer to fix building against Yocto dunfell. Bug-AGL: SPEC-3783 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I75783860e4ce332ba89e8a7768fe4ff7367bcd93
Diffstat (limited to 'templates/feature/agl-voiceagent-alexa-wakeword/50_setup.sh')
-rw-r--r--templates/feature/agl-voiceagent-alexa-wakeword/50_setup.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/templates/feature/agl-voiceagent-alexa-wakeword/50_setup.sh b/templates/feature/agl-voiceagent-alexa-wakeword/50_setup.sh
new file mode 100644
index 00000000..6e1d2503
--- /dev/null
+++ b/templates/feature/agl-voiceagent-alexa-wakeword/50_setup.sh
@@ -0,0 +1,45 @@
+# Install and patch Amazon Alexa Auto SDK "amazonlite" wakeword engine
+
+pushd $METADIR >/dev/null 2>&1
+
+WAKEWORD_FEATURE_DIR="$METADIR/meta-agl-devel/templates/feature/agl-voiceagent-alexa-wakeword"
+AMAZONLITE_VER="2.3"
+AMAZONLITE_PATCH="${WAKEWORD_FEATURE_DIR}/amazonlite-${AMAZONLITE_VER}.patch"
+AUTOSDK_EXTRAS_DIR="$METADIR/external/alexa-auto-sdk/extensions/extras"
+AMAZONLITE_DIR="${AUTOSDK_EXTRAS_DIR}/amazonlite"
+
+if [ -f "${AMAZONLITE_DIR}/README.md" ]; then
+ ver=`grep '^Unzip the' "${AMAZONLITE_DIR}/README.md" | sed 's/.*amazonlite-\([0-9]\+\.[0-9]\+\)\.zip.*/\1/'`
+ if [ "$ver" != ${AMAZONLITE_VER} ]; then
+ echo "ERROR: ${AMAZONLITE_DIR} does not contain version ${AMAZONLITE_VER}!" >&2
+ exit 1
+ fi
+fi
+
+test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && source ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
+DOWNLOAD_DIR=${XDG_DOWNLOAD_DIR:-$HOME/Downloads}
+
+if [ ! -f "${DOWNLOAD_DIR}/amazonlite-${AMAZONLITE_VER}.zip" ]; then
+ echo "ERROR: amazonlite-${AMAZONLITE_VER}.zip not found in ${DOWNLOAD_DIR}!" >&2
+ exit 1
+elif [ ! -d "${AUTOSDK_EXTRAS_DIR}" ]; then
+ echo "ERROR: Directory ${AUTOSDK_EXTRAS_DIR} not present!" >&2
+ exit 1
+fi
+cd "${AUTOSDK_EXTRAS_DIR}"
+if [ ! -d amazonlite ]; then
+ echo "Extracting ${DOWNLOAD_DIR}/amazonlite-${AMAZONLITE_VER}.zip"
+ unzip -q "${DOWNLOAD_DIR}/amazonlite-${AMAZONLITE_VER}.zip" || exit 1
+ cd amazonlite
+ echo "Patching ${AMAZONLITE_DIR}"
+ patch -p0 < "${AMAZONLITE_PATCH}"
+else
+ cat <<-EOF
+The amazonlite ${AMAZONLITE_VER} wakeword engine is already installed.
+To force reinstallation, manually remove the directory:
+ ${AMAZONLITE_DIR}
+
+EOF
+fi
+
+popd >/dev/null 2>&1