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