From 875602d1fc7692a178b5ac357409516763b5ab61 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 13 Oct 2021 21:04:02 -0400 Subject: [PATCH] Move pinouts to pages.rusefi.com #170 --- misc/actions/pinouts-create.sh | 43 +++++++++++++++++++ misc/actions/pinouts-install.sh | 1 + .../generate_pinouts/gen_upload_pinouts.sh | 40 +---------------- 3 files changed, 45 insertions(+), 39 deletions(-) create mode 100755 misc/actions/pinouts-create.sh diff --git a/misc/actions/pinouts-create.sh b/misc/actions/pinouts-create.sh new file mode 100755 index 0000000000..aa55b8d2ea --- /dev/null +++ b/misc/actions/pinouts-create.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +I_AM="pinouts-create.sh:" + +I_AM="gen_upload_pinouts.sh:" + +if [ -z $1 ] ; then + echo "Specific yaml parameter not specified, searching for */connectors/*.yaml" + CONNECTORS=$(find -path "./firmware/config/boards/*/connectors/*.yaml") +else + CONNECTORS=$1 + echo "Processing $CONNECTORS" +fi +# yq 3 and 4 have incompatible syntax. We use yq 4. +echo ${I_AM} invoking yq version +yq -V +for c in $CONNECTORS; do + echo "${I_AM} processing "$c + DIR="pinouts/"$(echo $c | tr '/' '\n' | tail -n +5 | head -n -2 | tr '\n' '/') + echo "${I_AM} DIR "$DIR + NAME=$(basename $c .yaml) + echo "${I_AM} NAME "$NAME + mkdir -p $DIR + if [ -f $DIR/index.html ]; then + bash misc/pinout-gen/append.sh "$(yq -j e $c)" $DIR/index.html + else + bash misc/pinout-gen/gen.sh "$(yq -j e $c)" $DIR/index.html + fi + if [ $? -ne 0 ]; then + echo "${I_AM} something is broken" + exit 1; + fi + file $DIR/index.html + IMG=$(yq e '.info.image.file' $c) + if [ $? -ne 0 ]; then + exit 1; + fi + echo "IMG "$IMG + if [ "$IMG" != "null" ]; then + cp $(dirname $c)/$IMG $DIR + fi + ls $DIR +done diff --git a/misc/actions/pinouts-install.sh b/misc/actions/pinouts-install.sh index 1b27ebfe7f..ba63b42785 100755 --- a/misc/actions/pinouts-install.sh +++ b/misc/actions/pinouts-install.sh @@ -4,5 +4,6 @@ sudo apt-get install ncftp wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 chmod a+x yq_linux_amd64 + rm -rf yqdir mkdir yqdir mv yq_linux_amd64 yqdir/yq diff --git a/misc/jenkins/generate_pinouts/gen_upload_pinouts.sh b/misc/jenkins/generate_pinouts/gen_upload_pinouts.sh index 0b173d9dd8..85058c2414 100644 --- a/misc/jenkins/generate_pinouts/gen_upload_pinouts.sh +++ b/misc/jenkins/generate_pinouts/gen_upload_pinouts.sh @@ -1,44 +1,6 @@ #!/bin/bash -I_AM="gen_upload_pinouts.sh:" - -if [ -z $1 ] ; then - echo "Specific yaml parameter not specified, searching for */connectors/*.yaml" - CONNECTORS=$(find -path "./firmware/config/boards/*/connectors/*.yaml") -else - CONNECTORS=$1 - echo "Processing $CONNECTORS" -fi -# yq 3 and 4 have incompatible syntax. We use yq 4. -echo ${I_AM} invoking yq version -yq -V -for c in $CONNECTORS; do - echo "${I_AM} processing "$c - DIR="pinouts/"$(echo $c | tr '/' '\n' | tail -n +5 | head -n -2 | tr '\n' '/') - echo "${I_AM} DIR "$DIR - NAME=$(basename $c .yaml) - echo "${I_AM} NAME "$NAME - mkdir -p $DIR - if [ -f $DIR/index.html ]; then - bash misc/pinout-gen/append.sh "$(yq -j e $c)" $DIR/index.html - else - bash misc/pinout-gen/gen.sh "$(yq -j e $c)" $DIR/index.html - fi - if [ $? -ne 0 ]; then - echo "${I_AM} something is broken" - exit 1; - fi - file $DIR/index.html - IMG=$(yq e '.info.image.file' $c) - if [ $? -ne 0 ]; then - exit 1; - fi - echo "IMG "$IMG - if [ "$IMG" != "null" ]; then - cp $(dirname $c)/$IMG $DIR - fi - ls $DIR -done +misc/actions/pinouts-create.sh if [ -n "$RUSEFI_FTP_SERVER" ]; then echo "Uploading Pinouts..."