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