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 |
SRCDIR=`pwd` |
7 |
WRAPPERNAME=finleypython |
8 |
OUTPUTROOT=$SRCDIR/build/package/lenny/escript |
9 |
LIBOUT=$OUTPUTROOT/usr/lib/escript |
10 |
BINOUT=$OUTPUTROOT/usr/bin |
11 |
PKGFILES=$SRCDIR/packaging/lenny |
12 |
|
13 |
# check to be sure we are running from the project root and that we look like the root user |
14 |
|
15 |
if [ `whoami` != 'root' ] |
16 |
then |
17 |
echo "Please execute this script under fakeroot." |
18 |
echo "fakeroot $0" |
19 |
exit 1 |
20 |
fi |
21 |
|
22 |
if [ ! -d escript/src ] |
23 |
then |
24 |
echo "Please execute this script from the root of the project" |
25 |
exit 3 |
26 |
fi |
27 |
|
28 |
if [ -d $OUTPUTROOT ] |
29 |
then |
30 |
rm -rf $OUTPUTROOT || (echo "Error could not clean build area";exit 2) |
31 |
fi |
32 |
|
33 |
|
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/$WRAPPERNAME.1 $OUTPUTROOT/usr/share/man/man1 |
45 |
|
46 |
mkdir -p $LIBOUT/lib |
47 |
mkdir -p $BINOUT |
48 |
#Should be using install here? |
49 |
cp $SRCDIR/lib/* $LIBOUT/lib |
50 |
cp -r $SRCDIR/esys $LIBOUT |
51 |
|
52 |
# content from finley_wrapper_writer.sh |
53 |
# Not calling the original script because it polutes the environment eg explicit python path |
54 |
|
55 |
# We should be using the standard python |
56 |
export PYTHON_CMD=python |
57 |
export ESCRIPT_ROOT=/usr/lib/escript |
58 |
|
59 |
sed -e "s%@@ESCRIPT_ROOT@@%$ESCRIPT_ROOT%" \ |
60 |
-e "s%@@LD_LIBRARY_PATH@@%\$ESCRIPT_ROOT/lib:\$LD_LIBRARY_PATH%" \ |
61 |
-e "s%@@PYTHONPATH@@%\$ESCRIPT_ROOT:\$PYTHONPATH%" \ |
62 |
-e "s%@@PYTHON_CMD@@%$PYTHON_CMD%" \ |
63 |
-e "s%@@PATH@@%\$PATH%" \ |
64 |
< $SRCDIR/scripts/finley_wrapper_template > $BINOUT/$WRAPPERNAME |
65 |
|
66 |
#end content from finley_wrapper_writer.sh |
67 |
|
68 |
#Nuke any svn stuff that made it in |
69 |
find $OUTPUTROOT -name ".svn" | xargs rm -rf |
70 |
|
71 |
|
72 |
#Say what version of debian packaging we are using: |
73 |
echo 2.0 > $OUTPUTROOT/../debian-binary |
74 |
|
75 |
#Check some permissions |
76 |
chmod og=rx $BINOUT/$WRAPPERNAME |
77 |
if [ -f $LIBOUT/pythonMPI ] |
78 |
then |
79 |
chmod og=rx $LIBOUT/pythonMPI |
80 |
fi |
81 |
|
82 |
cd $OUTPUTROOT |
83 |
|
84 |
cd usr/share/doc/escript/ |
85 |
gzip changelog.Debian |
86 |
|
87 |
cd $OUTPUTROOT |
88 |
#Fix directory perms |
89 |
chmod -R og-w . |
90 |
|
91 |
cd DEBIAN |
92 |
tar czf control.tar.gz . |
93 |
mv control.tar.gz ../../ |
94 |
cd .. |
95 |
tar czf data.tar.gz usr |
96 |
mv data.tar.gz .. |
97 |
cd .. |
98 |
|
99 |
ar rcu escript.deb debian-binary control.tar.gz data.tar.gz |
100 |
|
101 |
|
102 |
|
103 |
|