1 | #!/bin/bash |
---|
2 | # |
---|
3 | # 2018/06/23 Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
4 | |
---|
5 | trap '[ -n "${tmp_folder}" -a -d "${tmp_folder}" ] && rm -rf "${tmp_folder}"' QUIT |
---|
6 | |
---|
7 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin |
---|
8 | export LANG=C |
---|
9 | |
---|
10 | tmp_folder=$(mktemp --directory /tmp/nagios3-velvice-XXXXXX) |
---|
11 | [ -n "${tmp_folder}" -a -d "${tmp_folder}" ] || exit 1 |
---|
12 | |
---|
13 | # Set Version |
---|
14 | VELVICE_VERSION=$(grep 'version->declare' velvice.cgi | cut -f 2 -d "'") #' |
---|
15 | LOCAL_VERSION=1 |
---|
16 | |
---|
17 | # Create future tree |
---|
18 | mkdir -p ${tmp_folder}/etc/nagios3 |
---|
19 | mkdir -p ${tmp_folder}/usr/lib/cgi-bin/nagios3 |
---|
20 | mkdir -p ${tmp_folder}/usr/share/doc/nagios3-velvice |
---|
21 | mkdir -p ${tmp_folder}/usr/share/man/man1 |
---|
22 | cp LICENSE.txt ${tmp_folder}/usr/share/doc/nagios3-velvice/ |
---|
23 | cp velvice.1.gz ${tmp_folder}/usr/share/man/man1/ |
---|
24 | cp velvice.cgi ${tmp_folder}/usr/lib/cgi-bin/nagios3/ |
---|
25 | cp velvice.sample.yml ${tmp_folder}/etc/nagios3/ |
---|
26 | |
---|
27 | # Data archive |
---|
28 | rm -f ${tmp_folder}/data.tar.gz |
---|
29 | (cd ${tmp_folder}; tar czf data.tar.gz ./usr ./etc) |
---|
30 | |
---|
31 | # Control file |
---|
32 | cat <<END > ${tmp_folder}/control |
---|
33 | Package: nagios3-velvice |
---|
34 | Version: ${VELVICE_VERSION}-${LOCAL_VERSION} |
---|
35 | Section: utils |
---|
36 | Tag: implemented-in::perl, interface::commandline, role::program |
---|
37 | Priority: optional |
---|
38 | Depends: perl, perl-base, libnagios-object-perl libhtml-parser-perl perl-modules liburi-encode-perl libcolor-calc-perl libyaml-syck-perl libhash-merge-perl |
---|
39 | Suggests: libyaml-shell-perl | yamllint, nagios3, nagios3-cgi |
---|
40 | Architecture: all |
---|
41 | Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) |
---|
42 | Maintainer: Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
43 | Description: Nagios Velvice Alert Panel (CGI) |
---|
44 | Nagios VELVICE is an acronym for "Nagios leVEL serVICE status". |
---|
45 | Homepage: http://servforge.legi.grenoble-inp.fr/projects/soft-trokata/wiki/SoftWare/NagiosVelvice |
---|
46 | END |
---|
47 | |
---|
48 | # Control archive |
---|
49 | rm -f ${tmp_folder}/control.tar.gz |
---|
50 | (cd ${tmp_folder}; tar czf control.tar.gz control) |
---|
51 | |
---|
52 | # Format deb package |
---|
53 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
54 | |
---|
55 | # Create package (control before data) |
---|
56 | ar -r nagios3-velvice_${VELVICE_VERSION}-${LOCAL_VERSION}_all.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz |
---|
57 | |
---|
58 | # Clean |
---|
59 | rm -rf ${tmp_folder} |
---|
60 | |
---|
61 | # Prepare reprepro upload |
---|
62 | echo "# Prepare reprepro upload" |
---|
63 | echo "( cd /srv/www/debian/ ; reprepro includedeb wheezy ~/wheezy/nagios3-velvice_${VELVICE_VERSION}-${LOCAL_VERSION}_all.deb )" |
---|
64 | echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/nagios3-velvice_${VELVICE_VERSION}-${LOCAL_VERSION}_all.deb )" |
---|
65 | echo "( cd /srv/www/debian/ ; reprepro includedeb stretch ~/stretch/nagios3-velvice_${VELVICE_VERSION}-${LOCAL_VERSION}_all.deb )" |
---|
66 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i nagios3-velvice" |
---|