Rev 277 | Rev 302 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 277 | Rev 301 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | #!/bin/bash
|
1 | #!/bin/bash
|
| 2 | 2 | ||
| 3 | # date: 2008-11-02
|
3 | # date: 2008-11-02 / 2008-11-24
|
| 4 | # version: v0.1.1j
|
4 | # version: v0.1.2j
|
| 5 | # creator: Jelle de Jong <jelledejong@powercraft.nl>
|
5 | # creator: Jelle de Jong <jelledejong@powercraft.nl>
|
| 6 | # project: openarm sbc
|
6 | # project: openarm sbc
|
| 7 | # licence: gplv3
|
7 | # licence: gplv3
|
| 8 | 8 | ||
| 9 | # this file wont work with no $DISPLAY and requires psnup
|
9 | # this file wont work with no $DISPLAY and requires psnup
|
| 10 | # so imho it should check for DISPLAY at least
|
10 | # so imho it should check for DISPLAY at least
|
| 11 | # like that
|
11 | # like that
|
| 12 | 12 | ||
| 13 | if [ "x$DISPLAY" == "x" ]; then |
13 | if [ "x$DISPLAY" == "x" ]; then |
| 14 | echo "Its quite possible that you aren't executing this script from X system, or" |
14 | echo "Its quite possible that you aren't executing this script from X system, or" |
| 15 | echo "you don't have DISPLAY env variable set. I cannot continue because gschem won't" |
15 | echo "you don't have DISPLAY env variable set. I cannot continue because gschem won't" |
| 16 | echo "work unless you set one, even with xserver with dummy output i hope" |
16 | echo "work unless you set one, even with xserver with dummy output i hope" |
| 17 | exit
|
17 | exit
|
| 18 | fi
|
18 | fi
|
| 19 | 19 | ||
| 20 | echo ';; This file may be used to print gschem schematics from the |
20 | echo ';; This file may be used to print gschem schematics from the |
| 21 | ;; command line. Typical usage is:
|
21 | ;; command line. Typical usage is:
|
| 22 | ;;
|
22 | ;;
|
| Line 43... | Line 43... | ||
| 43 | ; filename is specified on the command line
|
43 | ; filename is specified on the command line
|
| 44 | (gschem-postscript "dummyfilename")
|
44 | (gschem-postscript "dummyfilename")
|
| 45 | 45 | ||
| 46 | (gschem-exit)' > ~/openarm/working/gschem/pdf/print.scm |
46 | (gschem-exit)' > ~/openarm/working/gschem/pdf/print.scm |
| 47 | 47 | ||
| 48 | psnup -p A4 -l -m0.5cm infile.ps outfile.ps |
48 | set -x |
| 49 | 49 | ||
| 50 | gschem -p -o ~/openarm/working/gschem/pdf/01-power-supply.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/01-power-supply.sch |
50 | pdf_dir="$HOME/openarm/working/gschem/pdf" |
| 51 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/01-power-supply.ps ~/openarm/working/gschem/pdf/01-power-supply.pdf |
51 | sch_dir="$HOME/openarm/working/gschem/sch" |
| - | 52 | project="openarm-sbc" |
|
| 52 | 53 | ||
| 53 | gschem -p -o ~/openarm/working/gschem/pdf/02-power-on-reset.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/02-power-on-reset.sch |
- | |
| 54 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/02-power-on-reset.ps ~/openarm/working/gschem/pdf/02-power-on-reset.pdf |
54 | for file in "$sch_dir"/*.sch |
| 55 | 55 | do
|
|
| - | 56 | if [ -f "$file" ] |
|
| - | 57 | then
|
|
| 56 | gschem -p -o ~/openarm/working/gschem/pdf/03-jtag.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/03-jtag.sch |
58 | filename=${file##*/} |
| 57 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/03-jtag.ps ~/openarm/working/gschem/pdf/03-jtag.pdf |
59 | shortname=${filename%.*} |
| 58 | - | ||
| 59 | gschem -p -o ~/openarm/working/gschem/pdf/04-sdram.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/04-sdram.sch |
60 | gschem -p -o $pdf_dir/$shortname.ps -s $pdf_dir/print.scm $sch_dir/$shortname.sch |
| - | 61 | if [ -x /usr/bin/psnup ] |
|
| - | 62 | then
|
|
| 60 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/04-sdram.ps ~/openarm/working/gschem/pdf/04-sdram.pdf |
63 | /usr/bin/psnup -p a3 -l -m -1.25cm $pdf_dir/$shortname.ps $pdf_dir/$shortname-trimmed.ps |
| 61 | 64 | fi
|
|
| 62 | gschem -p -o ~/openarm/working/gschem/pdf/05-flash.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/05-flash.sch |
65 | if [ -x /usr/bin/ps2pdf14 ] |
| - | 66 | then
|
|
| 63 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/05-flash.ps ~/openarm/working/gschem/pdf/05-flash.pdf |
67 | /usr/bin/ps2pdf14 -sPAPERSIZE=a3 $pdf_dir/$shortname-trimmed.ps $pdf_dir/$shortname.pdf |
| 64 | 68 | fi
|
|
| 65 | gschem -p -o ~/openarm/working/gschem/pdf/06-micro-sd.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/06-micro-sd.sch |
69 | if [ -e $pdf_dir/$shortname.ps ] |
| - | 70 | then
|
|
| 66 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/06-micro-sd.ps ~/openarm/working/gschem/pdf/06-micro-sd.pdf |
71 | rm $pdf_dir/$shortname.ps |
| 67 | 72 | fi
|
|
| 68 | gschem -p -o ~/openarm/working/gschem/pdf/07-ethernet.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/07-ethernet.sch |
73 | if [ -e $pdf_dir/$shortname-trimmed.ps ] |
| - | 74 | then
|
|
| 69 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/07-ethernet.ps ~/openarm/working/gschem/pdf/07-ethernet.pdf |
75 | rm $pdf_dir/$shortname-trimmed.ps |
| 70 | 76 | fi
|
|
| 71 | gschem -p -o ~/openarm/working/gschem/pdf/08-rs232.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/08-rs232.sch |
77 | if [ -e $pdf_dir/$shortname.pdf ] |
| - | 78 | then
|
|
| 72 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/08-rs232.ps ~/openarm/working/gschem/pdf/08-rs232.pdf |
79 | pdf_query+=("$pdf_dir/$shortname.pdf") |
| 73 | 80 | ||
| 74 | gschem -p -o ~/openarm/working/gschem/pdf/09-oscillators.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/09-oscillators.sch |
- | |
| 75 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/09-oscillators.ps ~/openarm/working/gschem/pdf/09-oscillators.pdf |
- | |
| - | 81 | fi
|
|
| 76 | 82 | fi
|
|
| 77 | gschem -p -o ~/openarm/working/gschem/pdf/10-usb.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/10-usb.sch |
- | |
| 78 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/10-usb.ps ~/openarm/working/gschem/pdf/10-usb.pdf |
- | |
| 79 | 83 | done
|
|
| 80 | gschem -p -o ~/openarm/working/gschem/pdf/11-connectors.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/11-connectors.sch |
- | |
| 81 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/11-connectors.ps ~/openarm/working/gschem/pdf/11-connectors.pdf |
- | |
| 82 | 84 | ||
| 83 | gschem -p -o ~/openarm/working/gschem/pdf/12-lpc3180-power.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/12-lpc3180-power.sch |
- | |
| 84 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/12-lpc3180-power.ps ~/openarm/working/gschem/pdf/12-lpc3180-power.pdf |
85 | if [ -n "$pdf_query" ] |
| 85 | 86 | then
|
|
| 86 | gschem -p -o ~/openarm/working/gschem/pdf/13-can.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/13-can.sch |
87 | if [ -x /usr/bin/pdftk ] |
| - | 88 | then
|
|
| 87 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/13-can.ps ~/openarm/working/gschem/pdf/13-can.pdf |
89 | /usr/bin/pdftk "${pdf_query[@]}" cat output $pdf_dir/00-$project-combined.pdf |
| - | 90 | fi
|
|
| 88 | 91 | fi
|
|
| 89 | gschem -p -o ~/openarm/working/gschem/pdf/14-spi.ps -s ~/openarm/working/gschem/pdf/print.scm ~/openarm/working/gschem/sch/14-spi.sch |
- | |
| 90 | ps2pdf14 -sPAPERSIZE=a3 ~/openarm/working/gschem/pdf/14-spi.ps ~/openarm/working/gschem/pdf/14-spi.pdf |
- | |
| 91 | 92 | ||
| 92 | exit
|
93 | exit
|