Subversion Repositories OpenARM Single-board Computer

Rev

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
 
315 jelle 3
# date: 2008-11-02 / 2008-11-24 / 2008-12-16
4
# version: v0.1.3j
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
 
315 jelle 20
pdf_dir="$HOME/openarm/working/gschem/pdf"
21
sch_dir="$HOME/openarm/working/gschem/sch"
22
project="openarm-sbc"
23
 
252 jelle 24
echo ';; This file may be used to print gschem schematics from the
25
;; command line.  Typical usage is:
26
;;
27
;;   gschem -p -o mysch.ps -s /path/to/this/file/print.scm mysch.sch
28
;;
29
;; The schematic in "mysch.sch" will be printed to the file "mysch.ps"
30
;;
253 jelle 31
;; documentation: less /etc/gEDA/system-gschemrc
252 jelle 32
;; documentation: less /user/share/gEDA/scheme/print.scm
33
;;
34
 
35
(log-window "later")
36
 
37
(output-type "limits")
38
(paper-size 16.54 11.69)
39
(output-text "ps")
40
(output-type "extents")
41
(output-orientation "landscape")
42
(output-color "enabled")
43
 
44
; You need call this after you call any rc file function
45
(gschem-use-rc-values)
46
 
47
; filename is specified on the command line
48
(gschem-postscript "dummyfilename")
49
 
315 jelle 50
(gschem-exit)' > $pdf_dir/print.scm
252 jelle 51
 
301 jelle 52
for file in "$sch_dir"/*.sch
53
do
54
    if [ -f "$file" ]
55
    then
56
        filename=${file##*/}
57
        shortname=${filename%.*}
58
        gschem -p -o $pdf_dir/$shortname.ps -s $pdf_dir/print.scm $sch_dir/$shortname.sch
59
        if [ -x /usr/bin/psnup ]
60
        then
303 jelle 61
            /usr/bin/psnup -p a3 -l -m -1.20cm $pdf_dir/$shortname.ps $pdf_dir/$shortname-trimmed.ps
301 jelle 62
        fi
63
        if [ -x /usr/bin/ps2pdf14  ]
64
        then
65
            /usr/bin/ps2pdf14 -sPAPERSIZE=a3 $pdf_dir/$shortname-trimmed.ps $pdf_dir/$shortname.pdf
66
        fi
67
        if [ -e $pdf_dir/$shortname.ps ]
68
        then
69
            rm $pdf_dir/$shortname.ps
70
        fi
71
        if [ -e $pdf_dir/$shortname-trimmed.ps ]
72
        then
73
            rm $pdf_dir/$shortname-trimmed.ps
74
        fi
75
        if [ -e $pdf_dir/$shortname.pdf ]
76
        then
77
            pdf_query+=("$pdf_dir/$shortname.pdf")
252 jelle 78
 
301 jelle 79
        fi
80
    fi
81
done
252 jelle 82
 
301 jelle 83
if [ -n "$pdf_query" ]
84
then
85
    if [ -x /usr/bin/pdftk ]
86
    then
302 jelle 87
        /usr/bin/pdftk "${pdf_query[@]}" cat output $pdf_dir/$project-schematics.pdf
301 jelle 88
    fi
89
fi
252 jelle 90
 
91
exit