-
Notifications
You must be signed in to change notification settings - Fork 0
/
makebuild.sh
executable file
·88 lines (75 loc) · 1.82 KB
/
makebuild.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
#!/bin/sh
FILES="djvu2pdf djvu2pdf.1.gz changelog INSTALL copyright"
OUTPUT=djvu2pdf
VERSION=$(grep VERSION= djvu2pdf | sed 's/VERSION=//g; s/ *//g')
write_control() {
cat > $FINAL/DEBIAN/control <<End-of-message
Package: djvu2pdf
Version: $VERSION
Section: utils
Priority: extra
Architecture: all
Depends: bash (>= 1.0)
Maintainer: Christoph Sieghart <[email protected]>
Description: A script to convert Djvu files to PDF files
A script to convert Djvu
files to PDF files.
End-of-message
}
if [ -z $VERSION ]; then
echo -e "Error: $0: Found no valid version info";
exit 1
else
echo "Found version info: $VERSION"
fi
if [ 1 -ne $# ]; then
echo -e "Error: $0: Specifiy either 'debian' or 'source' as an argument"
exit 1
else
if [ "$1" = "debian" ] || [ "$1" = "source" ]; then
PACKAGE=$1
else
echo -e "Error: $0: Specifiy either 'debian' or 'source' as an argument"
exit 1
fi
fi
FINAL=$OUTPUT-$VERSION
if [ -e $FINAL ]; then
echo -e "Error: $0: The output directory '$FINAL' already exists"
exit 1
fi
mkdir $FINAL
case $PACKAGE in
debian)
if [ "root" == $(whoami) ]; then
mkdir $FINAL/DEBIAN
mkdir -p $FINAL/usr/bin/
mkdir -p $FINAL/usr/share/man/man1/
mkdir -p $FINAL/usr/share/doc/djvu2pdf
cp djvu2pdf $FINAL/usr/bin/
cp djvu2pdf.1.gz $FINAL/usr/share/man/man1
cp copyright $FINAL/usr/share/doc/djvu2pdf
gzip -c -9 changelog > changelog.gz
cp changelog.gz $FINAL/usr/share/doc/djvu2pdf
write_control
dpkg --build $FINAL .
#lintian *.deb
rm -rf $FINAL changelog.gz
else
echo "Error: $0: You must be root to build for debian"
rm -rf $FINAL
exit 1
fi
;;
source)
cp $FILES $FINAL
tar -c $FINAL | gzip > ${FINAL}.tar.gz
echo "Created tar with following content"
tar -tf $FINAL.tar.gz
rm -rf $FINAL
;;
*)
echo "How the hell did you get here?"
exit 1
;;
esac