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 Name and Version |
---|
14 | PKG_NAME=nagios3-velvice |
---|
15 | CODE_VERSION=$(grep 'version->declare' velvice.cgi | cut -f 2 -d "'") #' |
---|
16 | PKG_VERSION=1 |
---|
17 | |
---|
18 | # Create future tree |
---|
19 | mkdir -p ${tmp_folder}/etc/nagios3/stylesheets |
---|
20 | mkdir -p ${tmp_folder}/usr/lib/cgi-bin/nagios3 |
---|
21 | mkdir -p ${tmp_folder}/usr/share/doc/nagios3-velvice |
---|
22 | mkdir -p ${tmp_folder}/usr/share/man/man1 |
---|
23 | cp LICENSE.txt ${tmp_folder}/usr/share/doc/nagios3-velvice/ |
---|
24 | cp velvice.html ${tmp_folder}/usr/share/doc/nagios3-velvice/ |
---|
25 | cp velvice.sample.yml ${tmp_folder}/usr/share/doc/nagios3-velvice/ |
---|
26 | cp velvice.1.gz ${tmp_folder}/usr/share/man/man1/ |
---|
27 | cp velvice.cgi ${tmp_folder}/usr/lib/cgi-bin/nagios3/ |
---|
28 | cp velvice.sample.yml ${tmp_folder}/etc/nagios3/ |
---|
29 | cp velvice.css ${tmp_folder}/etc/nagios3/stylesheets/ |
---|
30 | chmod ugo+rx ${tmp_folder}/usr/lib/cgi-bin/nagios3/velvice.cgi |
---|
31 | chmod -R a+rX,go-w ${tmp_folder}/usr |
---|
32 | chmod -R a+rX,go-w ${tmp_folder}/etc |
---|
33 | |
---|
34 | # Data archive |
---|
35 | rm -f ${tmp_folder}/data.tar.gz |
---|
36 | (cd ${tmp_folder}; tar --owner root --group root -czf data.tar.gz ./usr ./etc) |
---|
37 | |
---|
38 | # Control file |
---|
39 | cat <<END > ${tmp_folder}/control |
---|
40 | Package: ${PKG_NAME} |
---|
41 | Version: ${CODE_VERSION}-${PKG_VERSION} |
---|
42 | Section: utils |
---|
43 | Tag: implemented-in::perl, interface::commandline, role::program |
---|
44 | Priority: optional |
---|
45 | Depends: perl, perl-base, perl-modules, libnagios-object-perl, libhtml-parser-perl, liburi-encode-perl, libcolor-calc-perl, libyaml-syck-perl, libdatetime-event-recurrence-perl, libdatetime-set-perl |
---|
46 | Suggests: libyaml-shell-perl | yamllint, nagios3, nagios3-cgi |
---|
47 | Architecture: all |
---|
48 | Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) |
---|
49 | Maintainer: Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
50 | Description: Nagios Velvice Alert Panel (CGI) |
---|
51 | Nagios VELVICE is an acronym for "Nagios leVEL serVICE status". |
---|
52 | Homepage: http://servforge.legi.grenoble-inp.fr/projects/soft-trokata/wiki/SoftWare/NagiosVelvice |
---|
53 | END |
---|
54 | |
---|
55 | # Control archive |
---|
56 | rm -f ${tmp_folder}/control.tar.gz |
---|
57 | (cd ${tmp_folder}; tar --owner root --group root -czf control.tar.gz control) |
---|
58 | |
---|
59 | # Format deb package |
---|
60 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
61 | |
---|
62 | # Create package (control before data) |
---|
63 | ar -r ${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz |
---|
64 | |
---|
65 | # Clean |
---|
66 | rm -rf ${tmp_folder} |
---|
67 | |
---|
68 | # Prepare reprepro upload |
---|
69 | echo "# Prepare reprepro upload" |
---|
70 | echo "( cd /srv/www/debian/ ; reprepro includedeb wheezy ~/wheezy/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
71 | echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
72 | echo "( cd /srv/www/debian/ ; reprepro includedeb stretch ~/stretch/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
73 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i nagios3-velvice" |
---|