Subversion Repositories OpenARM Single-board Computer

Rev

Rev 302 | Rev 304 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
252 jelle 1
#!/bin/bash
2
 
301 jelle 3
# date: 2008-11-02 / 2008-11-24
4
# version: v0.1.2j
252 jelle 5
# creator: Jelle de Jong <jelledejong@powercraft.nl>
6
# project: openarm sbc
7
# licence: gplv3
8
 
277 agaran 9
# this file wont work with no $DISPLAY and requires psnup
10
# so imho it should check for DISPLAY at least
11
# like that
12
 
13
if [ "x$DISPLAY" == "x" ]; then
301 jelle 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"
16
    echo "work unless you set one, even with xserver with dummy output i hope"
17
    exit
277 agaran 18
fi
19
 
252 jelle 20
echo ';; This file may be used to print gschem schematics from the
21
;; command line.  Typical usage is:
22
;;
23
;;   gschem -p -o mysch.ps -s /path/to/this/file/print.scm mysch.sch
24
;;
25
;; The schematic in "mysch.sch" will be printed to the file "mysch.ps"
26
;;
253 jelle 27
;; documentation: less /etc/gEDA/system-gschemrc
252 jelle 28
;; documentation: less /user/share/gEDA/scheme/print.scm
29
;;
30
 
31
(log-window "later")
32
 
33
(output-type "limits")
34
(paper-size 16.54 11.69)
35
(output-text "ps")
36
(output-type "extents")
37
(output-orientation "landscape")
38
(output-color "enabled")
39
 
40
; You need call this after you call any rc file function
41
(gschem-use-rc-values)
42
 
43
; filename is specified on the command line
44
(gschem-postscript "dummyfilename")
45
 
46
(gschem-exit)' > ~/openarm/working/gschem/pdf/print.scm
47
 
301 jelle 48
set -x
253 jelle 49
 
301 jelle 50
pdf_dir="$HOME/openarm/working/gschem/pdf"
51
sch_dir="$HOME/openarm/working/gschem/sch"
52
project="openarm-sbc"
252 jelle 53
 
301 jelle 54
for file in "$sch_dir"/*.sch
55
do
56
    if [ -f "$file" ]
57
    then
58
        filename=${file##*/}
59
        shortname=${filename%.*}
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
303 jelle 63
            /usr/bin/psnup -p a3 -l -m -1.20cm $pdf_dir/$shortname.ps $pdf_dir/$shortname-trimmed.ps
301 jelle 64
        fi
65
        if [ -x /usr/bin/ps2pdf14  ]
66
        then
67
            /usr/bin/ps2pdf14 -sPAPERSIZE=a3 $pdf_dir/$shortname-trimmed.ps $pdf_dir/$shortname.pdf
68
        fi
69
        if [ -e $pdf_dir/$shortname.ps ]
70
        then
71
            rm $pdf_dir/$shortname.ps
72
        fi
73
        if [ -e $pdf_dir/$shortname-trimmed.ps ]
74
        then
75
            rm $pdf_dir/$shortname-trimmed.ps
76
        fi
77
        if [ -e $pdf_dir/$shortname.pdf ]
78
        then
79
            pdf_query+=("$pdf_dir/$shortname.pdf")
252 jelle 80
 
301 jelle 81
        fi
82
    fi
83
done
252 jelle 84
 
301 jelle 85
if [ -n "$pdf_query" ]
86
then
87
    if [ -x /usr/bin/pdftk ]
88
    then
302 jelle 89
        /usr/bin/pdftk "${pdf_query[@]}" cat output $pdf_dir/$project-schematics.pdf
301 jelle 90
    fi
91
fi
252 jelle 92
 
93
exit