@@ -39,16 +39,16 @@ if ! test -r $KB; then
3939fi
4040
4141# Make sure we're running under bash so brace expansion works
42- if ! test " ` echo A{B,C}` " = " AB AC" ; then
42+ if ! test " $( echo A{B,C}) " = " AB AC" ; then
4343 echo " Error, not running under bash"
4444 exit 1
4545fi
4646
4747if git diff | grep -q . ; then
4848 spec=xxxxxxxx
4949else
50- spec=` git rev-parse --short=8 HEAD`
51- SOURCE_DATE_EPOCH=` git log -1 --pretty=%ct`
50+ spec=$( git rev-parse --short=8 HEAD)
51+ SOURCE_DATE_EPOCH=$( git log -1 --pretty=%ct)
5252 # see https://reproducible-builds.org/docs/source-date-epoch/
5353fi
5454zipfile=marble-${spec} -fab.zip
@@ -61,7 +61,7 @@ rm -f marble*.dat
6161die=0
6262for f in $A .{d356,xml}; do
6363 if ! test -r " $f " ; then echo " missing: $f " ; die=1;
64- elif ! test " $f " = " ` find \" $f \" -newer $A .kicad_pcb` " ; then echo " stale: $f " ; die=1; else
64+ elif ! test " $f " = " $( find $f -newer $A .kicad_pcb) " ; then echo " stale: $f " ; die=1; else
6565 echo " OK: $f " ; fi
6666done
6767if test $die = 1; then echo Aborting; exit 1; fi
@@ -74,7 +74,7 @@ python3 scripts/kicad_exporter.py --layers 10 $A.kicad_pcb PCB_layers
7474die=0
7575for f in PCB_layers/$A -all.pos PCB_layers/$A -{B_Cu,B_Mask,B_Paste,B_SilkS,Edge_Cuts,F_Cu,F_Mask,F_Paste,F_SilkS,In{1,2,3,4,5,6,7,8,9,10}_Cu}.gbr PCB_layers/$A -{,N}PTH.drl; do
7676 if ! test -r " $f " ; then echo " missing: $f " ; die=1;
77- elif ! test " $f " = " ` find \" $f \" -newer $A .kicad_pcb` " ; then echo " stale: $f " ; die=1; else
77+ elif ! test " $f " = " $( find $f -newer $A .kicad_pcb) " ; then echo " stale: $f " ; die=1; else
7878 echo " OK: $f " ; fi
7979done
8080if test $die = 1; then echo Aborting; exit 1; fi
@@ -90,7 +90,7 @@ bomfile=${A}_BOM.csv
9090bomfile2=${A} _BOMa.csv
9191echo " $bomfile "
9292test -r " $bomfile "
93- test " $bomfile " = " ` find " $bomfile " -newer $A .xml` "
93+ test " $bomfile " = " $( find " $bomfile " -newer $A .xml) "
9494echo generated files are OK
9595echo starting post-processing
9696
@@ -113,14 +113,30 @@ rm -rf fab
113113mkdir fab
114114cd PCB_layers
115115for f in * .gbr; do
116- sed -e ' /TF.CreationDate/d' -e ' /Created by KiCad/s/ date .*/*/' < $f > ../fab/marble${f# $A }
116+ sed \
117+ -e ' /TF.CreationDate/d' \
118+ -e ' /Created by KiCad/s/ date .*/*/' \
119+ -e ' /GenerationSoftware/s/Pcbnew,5\.1\.1.\*/Pcbnew,5.1.x\*/' \
120+ -e ' /Created by KiCad/s/(PCBNEW 5\.1\.1.)/PCBNEW 5.1.x)/' \
121+ < " $f " > " ../fab/marble${f# $A } "
117122done
118123for f in * .drl; do
119- sed -e ' /TF.CreationDate/d' -e ' / DRILL file /s/ date .*//' < $f > ../fab/marble${f# $A }
124+ sed \
125+ -e ' /TF.CreationDate/d' \
126+ -e ' / DRILL file /s/ date .*//' \
127+ -e ' /GenerationSoftware/s/Pcbnew,5\.1\.1.$/Pcbnew,5.1.x/' \
128+ -e ' /DRILL file/s/{KiCad 5\.1\.1.}/{KiCad 5.1.x}/' \
129+ < " $f " > " ../fab/marble${f# $A } "
120130done
121131cd ..
122- sed -e ' /Module positions/s/ - created on .*/ ###/' -e ' /Module positions/s/ for .*/ ###/' < marble-xy.pos > fab/marble-xy.pos
123- sed -e ' /^BoM Date:/d' < " $bomfile2 " > fab/marble-bom.csv
132+ sed \
133+ -e ' /Module positions/s/ - created on .*/ ###/' \
134+ -e ' /Module positions/s/ for .*/ ###/' \
135+ < marble-xy.pos > fab/marble-xy.pos
136+ sed \
137+ -e ' /^BoM Date:/d' \
138+ -e ' /KiCad Version/s/Eeschema 5\.1\.1.$/Eeschema 5.1.x/' \
139+ < " $bomfile2 " > fab/marble-bom.csv
124140mv marble-stuff.log fab/
125141cp $A .d356 fab/marble-ipc-d-356.txt
126142cp marble-stack.txt fab/marble-stack.txt
@@ -129,23 +145,23 @@ cp scripts/testpoint_map.gvp fab/testpoint_map.gvp
129145mv testpoint_map.gbr fab/testpoint_map.gbr
130146
131147# Fancy file integrity feature, presumably nobody besides Larry will care
132- (cd fab && sha256sum * > marble-sha256.txt)
148+ (cd fab && sha256sum -- * > marble-sha256.txt)
133149(cat ../docs/README_fab.txt; cd fab; sha256sum marble-sha256.txt) > fab/README_fab.txt
134150
135151# Create the final zip file
136- rm -f $zipfile
152+ rm -f " $zipfile "
137153if test -n " $SOURCE_DATE_EPOCH " ; then
138154 echo " Forcing timestamp $SOURCE_DATE_EPOCH "
139- touch --date=@$SOURCE_DATE_EPOCH fab/*
140- zip --latest-time $zipfile fab/*
155+ touch --date=" @$SOURCE_DATE_EPOCH " fab/*
156+ zip --latest-time " $zipfile " fab/*
141157else
142- zip $zipfile fab/*
158+ zip " $zipfile " fab/*
143159fi
144160
145161if [ " $1 " != " debug" ]; then # clean-up step, can skip when debugging
146162 rm -f marble* .dat marble-xy.pos $A .d356 $A .xml " $bomfile " " ${bomfile} .tmp" " $bomfile2 "
147163 rm -rf PCB_layers fab
148164fi
149165# marble-${spec}-fab.zip is the only generated file that should remain
150- ls -l $zipfile
166+ ls -l " $zipfile "
151167echo DONE
0 commit comments