From fe0636774ad26bba35b28555fc2e80bc98d79dbf Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Fri, 13 Feb 2015 14:41:26 -0500 Subject: [PATCH] Add script to convert BOM with remote server --- bomgen/generate-bom-remote.sh | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 bomgen/generate-bom-remote.sh diff --git a/bomgen/generate-bom-remote.sh b/bomgen/generate-bom-remote.sh new file mode 100644 index 0000000..be0fbf0 --- /dev/null +++ b/bomgen/generate-bom-remote.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Number of cards to assemble +KITS=10 + +REMOTE="git.company.com" + +BOM_IN=$(find . -name \*.csv) +BOM_OUT=${BOM_IN%.csv}.xls +BOM_OUT_TXT=${BOM_IN%.csv}.txt + +INV=inventory.csv + +REMOTE_DIR=. + +OPTS="-t altium -r B -p BRD0056" + +if [ ! -f ${BOM_IN} ]; then + echo "Missing file: ${BOM_IN}" + exit 1 +fi + +# Send input BOM: +echo "put ${BOM_IN}" | sftp ${REMOTE}:${REMOTE_DIR} + +if [ -f ${INV} ]; then + # Send inventory file: + echo "put ${INV}" | sftp ${REMOTE}:${REMOTE_DIR} + INV_OPTS="-i ${REMOTE_DIR}/${INV}" +fi + +# Run remote command to generate Excel BOM: +echo "bomgen.php ${OPTS} ${REMOTE_DIR}/${BOM_IN}" | ssh ${REMOTE} + +# Run remote command to generate Digikey BOM: +echo "bomgen.php -k -n ${KITS} ${OPTS} ${INV_OPTS} ${REMOTE_DIR}/${BOM_IN}" | \ + ssh ${REMOTE} + +# Fetch Excel output BOM: +echo "get ${BOM_OUT}" | sftp ${REMOTE}:${REMOTE_DIR} + +# Fetch Digikey output BOM: +echo "get ${BOM_OUT_TXT}" | sftp ${REMOTE}:${REMOTE_DIR} + -- 2.20.1