-
Notifications
You must be signed in to change notification settings - Fork 1
/
makedeb.sh
executable file
·105 lines (90 loc) · 2.67 KB
/
makedeb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/sh
#
# $1 = version number
# $2 = postfix
#
#
# Build up this directory tree/files
#
# update/debian/
# /DEBIAN/
# control
# postinst.bibutils
# postrm.bibutils
# /usr/local/bibutils-${1}/
# programs
#
# Then run dpkg on this to build a .deb package
#
programs="biblatex2xml bib2xml copac2xml ebi2xml end2xml endx2xml isi2xml med2xml modsclean ris2xml wordbib2xml xml2ads xml2bib xml2end xml2isi xml2ris xml2wordbib"
VERSION=$1
POSTFIX=$2
if [ "$2" = "_i386" ] ; then
ARCH="i386"
elif [ "$2" = "_amd64" ] ; then
ARCH="i386"
elif [ "$2" = "_osx" ] ; then
ARCH="darwin-powerpc"
else
echo "Can only accept _i386 _amd64 and _osx as postfixes."
echo "Skipping make deb for this architecture."
exit
fi
#
# Clean up any old version
#
if [ -e update/debian ] ; then
rm -r update/debian
fi
if [ -e update/bibutils-${VERSION}.deb ] ; then
rm -f update/*.deb
fi
mkdir -p update/debian/DEBIAN
cd update
OUTDIR="debian"
PKGDIR="debian/DEBIAN"
#
# Build control file
#
CNTRL="${PKGDIR}/control"
echo "Package: bibutils" > ${CNTRL}
echo "Version:" ${VERSION} >> ${CNTRL}
echo "Essential: no" >> ${CNTRL}
echo "Maintainer: Chris Putnam [[email protected]]" >> ${CNTRL}
echo "Provides: bibutils" >> ${CNTRL}
echo "Architecture: ${ARCH}" >> ${CNTRL}
echo "Description: Bibutils converts between bibliography formats" >> ${CNTRL}
echo " including BibTeX, RIS, Endnote (Refer), ISI," >> ${CNTRL}
echo " COPAC, and Medline XML using a MODS v3.0 XML intermediate." >> ${CNTRL}
#
# Build post-install script
#
POSTINST="${PKGDIR}/postinst.bibutils"
echo '#!/bin/sh' > ${POSTINST}
#
# Build un-install script
#
POSTRM="${PKGDIR}/postrm.bibutils"
echo '#!/bin/sh' > ${POSTRM}
#
# Build binaries directory
#
# Fink installs on MacOSX install to /sw/bin
#
if [ "${POSTFIX}" = "_i386" ] ; then
BINARYDIR="${OUTDIR}/usr/local/bin"
elif [ "${POSTFIX}" = "_amd64" ] ; then
BINARYDIR="${OUTDIR}/usr/local/bin"
elif [ "${POSTFIX}" = "_osx" ] ; then
BINARYDIR="${OUTDIR}/sw/bin"
fi
mkdir -p ${BINARYDIR}
for program in ${programs} ; do
cp ../bin/${program} ${BINARYDIR}/.
done
#
# Build update
#
PATH=${PATH}:/sw/bin/:~/src/bibutils/dpkg-1.10.28/main:~/src/bibutils/dpkg-1.10.28/dpkg-deb
dpkg --build ${OUTDIR} bibutils-${VERSION}${POSTFIX}.deb
rm -r ${OUTDIR}