pinouts process is broken but also green #2942

This commit is contained in:
Andrey 2021-07-10 10:12:22 -04:00
parent 89410992fa
commit 724127f466
3 changed files with 18 additions and 3 deletions

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
I_AM="gen_upload_pinouts.sh:"
if [ -z $1 ] ; then if [ -z $1 ] ; then
echo "Specific yaml parameter not specified, searching for */connectors/*.yaml" echo "Specific yaml parameter not specified, searching for */connectors/*.yaml"
CONNECTORS=$(find -path "./firmware/config/boards/*/connectors/*.yaml") CONNECTORS=$(find -path "./firmware/config/boards/*/connectors/*.yaml")
@ -8,19 +10,24 @@ else
echo "Processing $CONNECTORS" echo "Processing $CONNECTORS"
fi fi
# yq 3 and 4 have incompatible syntax. We use yq 4. # yq 3 and 4 have incompatible syntax. We use yq 4.
echo ${I_AM} invoking yq version
yq -V yq -V
for c in $CONNECTORS; do for c in $CONNECTORS; do
echo "processing "$c echo "${I_AM} processing "$c
DIR="pinouts/"$(echo $c | tr '/' '\n' | tail -n +5 | head -n -2 | tr '\n' '/') DIR="pinouts/"$(echo $c | tr '/' '\n' | tail -n +5 | head -n -2 | tr '\n' '/')
echo "DIR "$DIR echo "${I_AM} DIR "$DIR
NAME=$(basename $c .yaml) NAME=$(basename $c .yaml)
echo "NAME "$NAME echo "${I_AM} NAME "$NAME
mkdir -p $DIR mkdir -p $DIR
if [ -f $DIR/index.html ]; then if [ -f $DIR/index.html ]; then
bash misc/pinout-gen/append.sh "$(yq -j e $c)" $DIR/index.html bash misc/pinout-gen/append.sh "$(yq -j e $c)" $DIR/index.html
else else
bash misc/pinout-gen/gen.sh "$(yq -j e $c)" $DIR/index.html bash misc/pinout-gen/gen.sh "$(yq -j e $c)" $DIR/index.html
fi fi
if [ $? -ne 0 ]; then
echo "${I_AM} something is broken"
exit 1;
fi
file $DIR/index.html file $DIR/index.html
IMG=$(yq e '.info.image.file' $c) IMG=$(yq e '.info.image.file' $c)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then

View File

@ -2,4 +2,8 @@
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/" DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/"
TEXT=$(sed -e "/\/\/\/DATA\/\/\//{a \ \`$1\ \`,\n///DATA///" -e "d}" $2) TEXT=$(sed -e "/\/\/\/DATA\/\/\//{a \ \`$1\ \`,\n///DATA///" -e "d}" $2)
if [ $? -ne 0 ]; then
echo "Error in append.sh"
exit 1;
fi
echo "$TEXT" > $2 echo "$TEXT" > $2

View File

@ -2,4 +2,8 @@
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/" 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\/\/\//") 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\/\/\//")
if [ $? -ne 0 ]; then
echo "Error in gen.sh"
exit 1;
fi
echo "$TEXT" > $2 echo "$TEXT" > $2