2021-02-06 10:43:43 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-07-10 07:12:22 -07:00
|
|
|
I_AM="gen_upload_pinouts.sh:"
|
|
|
|
|
2021-02-19 14:00:30 -08:00
|
|
|
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
|
2021-06-30 07:45:23 -07:00
|
|
|
# yq 3 and 4 have incompatible syntax. We use yq 4.
|
2021-07-10 07:12:22 -07:00
|
|
|
echo ${I_AM} invoking yq version
|
2021-06-29 14:49:49 -07:00
|
|
|
yq -V
|
2021-02-06 10:43:43 -08:00
|
|
|
for c in $CONNECTORS; do
|
2021-07-10 07:12:22 -07:00
|
|
|
echo "${I_AM} processing "$c
|
2021-02-06 10:43:43 -08:00
|
|
|
DIR="pinouts/"$(echo $c | tr '/' '\n' | tail -n +5 | head -n -2 | tr '\n' '/')
|
2021-07-10 07:12:22 -07:00
|
|
|
echo "${I_AM} DIR "$DIR
|
2021-02-06 10:43:43 -08:00
|
|
|
NAME=$(basename $c .yaml)
|
2021-07-10 07:12:22 -07:00
|
|
|
echo "${I_AM} NAME "$NAME
|
2021-02-06 10:43:43 -08:00
|
|
|
mkdir -p $DIR
|
2021-02-10 15:52:19 -08:00
|
|
|
if [ -f $DIR/index.html ]; then
|
2021-06-30 07:08:19 -07:00
|
|
|
bash misc/pinout-gen/append.sh "$(yq -j e $c)" $DIR/index.html
|
2021-02-10 15:52:19 -08:00
|
|
|
else
|
2021-06-30 07:08:19 -07:00
|
|
|
bash misc/pinout-gen/gen.sh "$(yq -j e $c)" $DIR/index.html
|
2021-02-10 15:52:19 -08:00
|
|
|
fi
|
2021-07-10 07:12:22 -07:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "${I_AM} something is broken"
|
|
|
|
exit 1;
|
|
|
|
fi
|
2021-02-10 15:52:19 -08:00
|
|
|
file $DIR/index.html
|
2021-06-30 07:08:19 -07:00
|
|
|
IMG=$(yq e '.info.image.file' $c)
|
2021-05-06 20:41:28 -07:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1;
|
|
|
|
fi
|
2021-02-06 10:43:43 -08:00
|
|
|
echo "IMG "$IMG
|
2021-07-10 08:27:41 -07:00
|
|
|
if [ "$IMG" != "null" ]; then
|
2021-02-06 10:43:43 -08:00
|
|
|
cp $(dirname $c)/$IMG $DIR
|
|
|
|
fi
|
|
|
|
ls $DIR
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$RUSEFI_FTP_SERVER" ]; then
|
2021-04-27 17:27:29 -07:00
|
|
|
echo "Uploading Pinouts..."
|
2021-10-09 06:44:11 -07:00
|
|
|
ncftpput -r 999 -m -R -z -v -u "$RUSEFI_DOXYGEN_FTP_USER" -p "$RUSEFI_DOXYGEN_FTP_PASS" "$RUSEFI_FTP_SERVER" / pinouts
|
2021-04-27 17:27:29 -07:00
|
|
|
echo "Uploaded!"
|
2021-02-06 10:43:43 -08:00
|
|
|
fi
|
|
|
|
[ $? -eq 0 ] || { echo "upload FAILED"; exit 1; }
|