From 0add69e5f0d74baac43a52b2d6137f801069acf9 Mon Sep 17 00:00:00 2001 From: David Holdeman Date: Tue, 17 Jan 2023 22:08:41 -0600 Subject: [PATCH] Update yq, fix bug in pinout generation (#4977) * update yq * multiply backslashes so they don't get swallowed --- misc/actions/pinouts-create.sh | 4 ++-- misc/actions/pinouts-install.sh | 2 +- misc/pinout-gen/gen.sh | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/misc/actions/pinouts-create.sh b/misc/actions/pinouts-create.sh index 9347b54e8f..d6c5c8fe08 100755 --- a/misc/actions/pinouts-create.sh +++ b/misc/actions/pinouts-create.sh @@ -33,9 +33,9 @@ for c in $CONNECTORS; do # todo fail once all pages are compliant exit 1 fi if [ -f $DIR/index.html ]; then - bash misc/pinout-gen/append.sh "$(yqdir/yq -j e $c)" $DIR/index.html + bash misc/pinout-gen/append.sh "$(yqdir/yq -o=json e $c)" $DIR/index.html else - bash misc/pinout-gen/gen.sh "$(yqdir/yq -j e $c)" $DIR/index.html + bash misc/pinout-gen/gen.sh "$(yqdir/yq -o=json e $c)" $DIR/index.html fi if [ $? -ne 0 ]; then echo "${I_AM} something is broken" diff --git a/misc/actions/pinouts-install.sh b/misc/actions/pinouts-install.sh index 294b421c78..207c818a96 100755 --- a/misc/actions/pinouts-install.sh +++ b/misc/actions/pinouts-install.sh @@ -2,7 +2,7 @@ sudo apt-get update sudo apt-get install sshpass - wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 + wget https://github.com/mikefarah/yq/releases/download/v4.30.8/yq_linux_amd64 chmod a+x yq_linux_amd64 rm -rf yqdir mkdir yqdir diff --git a/misc/pinout-gen/gen.sh b/misc/pinout-gen/gen.sh index af80b50eb0..7953b7fe25 100644 --- a/misc/pinout-gen/gen.sh +++ b/misc/pinout-gen/gen.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/" -TEXT=$(sed -e "/###CSS###/{r ${DIR}style.css" -e 'd}' -e "/###JS###/{r ${DIR}script.js" -e 'd}' ${DIR}pinout.html | sed -e "s/\/\/\/DATA\/\/\//\`$(echo ${1//\//\\/} | tr -d '\n')\`,\n\/\/\/DATA\/\/\//") +JSON="$(echo $1 | sed 's/\\/\\\\\\\\/g')" +TEXT=$(sed -e "/###CSS###/{r ${DIR}style.css" -e 'd}' -e "/###JS###/{r ${DIR}script.js" -e 'd}' ${DIR}pinout.html | sed -e "s/\/\/\/DATA\/\/\//\`$(echo ${JSON//\//\\/} | tr -d '\n')\`,\n\/\/\/DATA\/\/\//") if [ $? -ne 0 ]; then echo "Error in gen.sh" exit 1;