#!/bin/bash

## This script generate alternavive data names (Required by some PCB manufacturers such as Pragoboard.cz)
##
## Usage:
##
## Run this script with prarameter of directory in which Gerber data is located.
##
## Example:
##
## ./gen_PragoBoard.sh /home/kaklik/svnMLAB/Modules/CommRF/GSM01A/CAM_PROFI/
##
## This comand generates new directory PragoBoard with these files:
## bot.gbr  mill.gbr  plt.gbr  pth.exc  smb.gbr  smt.gbr  top.gbr
##
##
## TODO: non plated drill is not properly handled. 
##

cd $1

mkdir ./PragoBoard/

# from MLAB standard file names generated mainly by PADS PCB software. 

#cp V1.PHO ./PragoBoard/top.gbr
#cp V2.PHO ./PragoBoard/bot.gbr
#cp M1.PHO ./PragoBoard/smt.gbr
#cp M2.PHO ./PragoBoard/smb.gbr
#cp T1.PHO ./PragoBoard/plt.gbr
#cp BOARD.PHO ./PragoBoard/mill.gbr
#cp DRILL.DRL ./PragoBoard/pth.exc
#cp nDRILL.DRL ./PragoBoard/npth.exc   #non plated holes

# sources generated by KiCAD software

cp $2-F_Cu.pho ./PragoBoard/top.gbr
cp $2-B_Cu.pho ./PragoBoard/bot.gbr
cp $2-F_Mask.pho ./PragoBoard/smt.gbr
cp $2-B_Mask.pho ./PragoBoard/smb.gbr
cp $2-F_SilkS.pho ./PragoBoard/plt.gbr
cp $2-Edge_Cuts.pho ./PragoBoard/mill.gbr
cp $2.drl ./PragoBoard/pth.exc
cp $2-NPTH.drl ./PragoBoard/npth.exc   #non plated holes