From: Hugo Villeneuve Date: Fri, 13 Feb 2015 19:41:26 +0000 (-0500) Subject: Add script to convert BOM with remote server X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=fe0636774ad26bba35b28555fc2e80bc98d79dbf;p=eda-utils.git Add script to convert BOM with remote server --- 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} +