1 |
#!/bin/bash |
2 |
|
3 |
#This script produced with the aid of "The Debian System concepts and techniques" By Martin F. Krafft |
4 |
# Its purpose is to produce a .deb for escript |
5 |
|
6 |
VERSION=~2.0-1 |
7 |
SRCDIR=`pwd` |
8 |
WRAPPERNAME=escript |
9 |
ALTWRAPPERNAME=finleypython |
10 |
OUTPUTROOT=$SRCDIR/build/package/lenny/escript |
11 |
LIBOUT=$OUTPUTROOT/usr/lib/escript |
12 |
BINOUT=$OUTPUTROOT/usr/bin |
13 |
PKGFILES=$SRCDIR/packaging/lenny |
14 |
|
15 |
# check to be sure we are running from the project root and that we look like the root user |
16 |
|
17 |
if [ `whoami` != 'root' ] |
18 |
then |
19 |
echo "Please execute this script under fakeroot." |
20 |
echo "fakeroot $0" |
21 |
exit 1 |
22 |
fi |
23 |
|
24 |
if [ ! -d escript/src ] |
25 |
then |
26 |
echo "Please execute this script from the root of the project" |
27 |
exit 3 |
28 |
fi |
29 |
|
30 |
if [ -d $OUTPUTROOT ] |
31 |
then |
32 |
rm -rf $OUTPUTROOT || (echo "Error could not clean build area";exit 2) |
33 |
fi |
34 |
|
35 |
mkdir -p $OUTPUTROOT |
36 |
|
37 |
#First copy debian skeleton |
38 |
cp -r $PKGFILES/escript/* $OUTPUTROOT |
39 |
|
40 |
|
41 |
mkdir -p $OUTPUTROOT/usr/share/man/man1 |
42 |
|
43 |
#copy the man page |
44 |
cp $SRCDIR/doc/manpage/man1/$WRAPPERNAME.1 $OUTPUTROOT/usr/share/man/man1 |
45 |
cp $SRCDIR/doc/manpage/man1/$WRAPPERNAME.1 $OUTPUTROOT/usr/share/man/man1/$ALTWRAPPERNAME.1 |
46 |
gzip $OUTPUTROOT/usr/share/man/man1/$WRAPPERNAME.1 |
47 |
gzip $OUTPUTROOT/usr/share/man/man1/$ALTWRAPPERNAME.1 |
48 |
|
49 |
#copy the documentation |
50 |
cp $SRCDIR/release/doc/escript_examples.tar.gz $OUTPUTROOT/usr/share/doc/escript/ |
51 |
cp $SRCDIR/release/doc/install/install.pdf $OUTPUTROOT/usr/share/doc/escript |
52 |
cp $SRCDIR/release/doc/user/guide.pdf $OUTPUTROOT/usr/share/doc/escript |
53 |
cp -r $SRCDIR/release/doc/epydoc $OUTPUTROOT/usr/share/doc/escript/python_html |
54 |
|
55 |
mkdir -p $LIBOUT/lib |
56 |
mkdir -p $BINOUT |
57 |
#Should be using install here? |
58 |
cp $SRCDIR/lib/* $LIBOUT/lib |
59 |
cp -r $SRCDIR/esys $LIBOUT |
60 |
|
61 |
# content from finley_wrapper_writer.sh |
62 |
# Not calling the original script because it polutes the environment eg explicit python path |
63 |
|
64 |
# We should be using the standard python |
65 |
export PYTHON_CMD=python |
66 |
export ESCRIPT_ROOT=/usr/lib/escript |
67 |
|
68 |
sed -e "s%@@ESCRIPT_ROOT@@%$ESCRIPT_ROOT%" \ |
69 |
-e "s%@@LD_LIBRARY_PATH@@%\$ESCRIPT_ROOT/lib:\$LD_LIBRARY_PATH%" \ |
70 |
-e "s%@@PYTHONPATH@@%\$ESCRIPT_ROOT:\$PYTHONPATH%" \ |
71 |
-e "s%@@PYTHON_CMD@@%$PYTHON_CMD%" \ |
72 |
-e "s%@@PATH@@%\$PATH%" \ |
73 |
-e "s%STDLOCATION=0%STDLOCATION=1%" \ |
74 |
< $SRCDIR/scripts/finley_wrapper_template > $BINOUT/$WRAPPERNAME |
75 |
|
76 |
#end content from finley_wrapper_writer.sh |
77 |
|
78 |
cd $BINOUT |
79 |
ln -s $WRAPPERNAME $ALTWRAPPERNAME |
80 |
cd $SRCDIR |
81 |
|
82 |
#Nuke any svn stuff that made it in |
83 |
find $OUTPUTROOT -name ".svn" | xargs rm -rf |
84 |
|
85 |
|
86 |
#Say what version of debian packaging we are using: |
87 |
echo 2.0 > $OUTPUTROOT/../debian-binary |
88 |
|
89 |
#Check some permissions |
90 |
chmod og=rx $BINOUT/$WRAPPERNAME |
91 |
if [ -f $LIBOUT/pythonMPI ] |
92 |
then |
93 |
chmod og=rx $LIBOUT/pythonMPI |
94 |
fi |
95 |
|
96 |
cd $OUTPUTROOT |
97 |
|
98 |
cd usr/share/doc/escript/ |
99 |
gzip changelog.Debian |
100 |
|
101 |
cd $OUTPUTROOT |
102 |
#Fix directory perms |
103 |
chmod -R og-w . |
104 |
|
105 |
cd DEBIAN |
106 |
tar czf control.tar.gz . |
107 |
mv control.tar.gz ../../ |
108 |
cd .. |
109 |
tar czf data.tar.gz usr |
110 |
mv data.tar.gz .. |
111 |
cd .. |
112 |
|
113 |
ar rcu escript$VERSION.deb debian-binary control.tar.gz data.tar.gz |
114 |
|
115 |
|
116 |
|
117 |
|