modified script for debian package
[svn/Prometheus-QoS/.git] / prometheus-debian.old
1 #!/bin/bash
2
3 MAINTAINER='Michael Polak <x@n.cz>'
4 DEB_PCK_NAME=prometheus
5 ARCHITECTURE=i386
6 DEBIAN_BASE=$DEB_PCK_NAME.tmp
7
8 # Adresare
9 rm -r $DEBIAN_BASE 2>/dev/null
10 mkdir -p $DEBIAN_BASE
11 mkdir -p $DEBIAN_BASE/usr
12 mkdir -p $DEBIAN_BASE/usr/sbin
13 mkdir -p $DEBIAN_BASE/usr/share
14 mkdir -p $DEBIAN_BASE/usr/share/man
15 mkdir -p $DEBIAN_BASE/usr/share/man/man1
16 mkdir -p $DEBIAN_BASE/usr/share/man/man5
17
18 mkdir -p $DEBIAN_BASE/DEBIAN
19 chmod 0755 $DEBIAN_BASE/DEBIAN
20
21 if ! [ -x prometheus ]; then
22 make main
23 fi
24
25 # Copy
26 cp prometheus $DEBIAN_BASE/usr/sbin
27 cp prometheus.1 $DEBIAN_BASE/usr/share/man/man1
28 cp prometheus.conf.5 $DEBIAN_BASE/usr/share/man/man5
29 cp -R etc $DEBIAN_BASE/etc
30
31 # .svn cleanup
32 rm -rf $DEBIAN_BASE/etc/.svn
33 rm -rf $DEBIAN_BASE/etc/*/.svn
34
35 # Chmod a+x scripts
36 chmod 755 $DEBIAN_BASE/etc/cron.d/prometheus
37 chmod 755 $DEBIAN_BASE/etc/init.d/prometheus
38
39 # Strip debug info from binary
40 strip $DEBIAN_BASE/usr/sbin/prometheus
41
42 # Zmeni uzivatele a skupinu
43 chown -R root:root $DEBIAN_BASE
44
45 # MD5 start
46 find $DEBIAN_BASE -type f -exec md5sum {} \; >> $DEBIAN_BASE/DEBIAN/_md5sum
47 # odstraneni $DEBIAN_BASE z adresare
48 sed -r "s:$DEBIAN_BASE::g" $DEBIAN_BASE/DEBIAN/_md5sum > $DEBIAN_BASE/DEBIAN/md5sum;
49 rm $DEBIAN_BASE/DEBIAN/_md5sum
50 # MD5 - end
51
52 # Control file
53 cp -R $DEB_PCK_NAME.control $DEBIAN_BASE/DEBIAN/control
54 if [ -f $DEB_PCK_NAME'.postinst' ]; then
55 cp -R $DEB_PCK_NAME.postinst $DEBIAN_BASE/DEBIAN/postinst
56 fi
57 if [ -f $DEB_PCK_NAME'.preinst' ]; then
58 cp -R $DEB_PCK_NAME.preinst $DEBIAN_BASE/DEBIAN/preinst
59 fi
60 if [ -f $DEB_PCK_NAME'.conffiles' ]; then
61 cp -R $DEB_PCK_NAME.conffiles $DEBIAN_BASE/DEBIAN/conffiles
62 fi
63 if [ -f $DEB_PCK_NAME'.prerm' ]; then
64 cp -R $DEB_PCK_NAME.prerm $DEBIAN_BASE/DEBIAN/prerm
65 fi
66 if [ -f $DEB_PCK_NAME'.postrm' ]; then
67 cp -R $DEB_PCK_NAME.postrm $DEBIAN_BASE/DEBIAN/postrm
68 fi
69
70 # Cleanup
71 for f in `find $DEBIAN_BASE/etc -path ".svn*"`
72 do
73 rm -R $f 2>/dev/null
74 done;
75
76 # Momentalne se nepouziva
77 #SIZEDU=`du -sk "$DEBIAN_BASE" | awk '{ print $1}'`
78 #SIZEDIR=`find "$DEBIAN_BASE" -type d | wc | awk '{print $1}'`
79 #SIZE=$[ $SIZEDU - $SIZEDIR ]
80
81 # Verze
82 VERSION=`grep "const char \*version" prometheus.c|cut -f 2 -d \"`
83
84 # Control file
85 sed -e "s/__VERSION__/$VERSION/" \
86 -e "s/__PACKAGE__/$DEB_PCK_NAME/" \
87 -e "s/__MAINTAINER__/$MAINTAINER/" \
88 -e "s/__ARCHITECTURE__/$ARCHITECTURE/" \
89 $DEB_PCK_NAME.control > $DEBIAN_BASE/DEBIAN/control
90
91 # Vytvori a prejmenuje balicek
92 dpkg --build $DEBIAN_BASE
93 dpkg-name -o $DEBIAN_BASE.deb
94 rm -rf $DEBIAN_BASE
This page took 0.566818 seconds and 4 git commands to generate.