[243] | 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 | |
---|
[253] | 13 | # Set Name and Version |
---|
| 14 | PKG_NAME=nagios3-velvice |
---|
| 15 | CODE_VERSION=$(grep 'version->declare' velvice.cgi | cut -f 2 -d "'") #' |
---|
[255] | 16 | PKG_VERSION=1 |
---|
[243] | 17 | |
---|
| 18 | # Create future tree |
---|
[263] | 19 | mkdir -p ${tmp_folder}/etc/nagios3/stylesheets |
---|
[243] | 20 | mkdir -p ${tmp_folder}/usr/lib/cgi-bin/nagios3 |
---|
[244] | 21 | mkdir -p ${tmp_folder}/usr/share/doc/nagios3-velvice |
---|
[243] | 22 | mkdir -p ${tmp_folder}/usr/share/man/man1 |
---|
[244] | 23 | cp LICENSE.txt ${tmp_folder}/usr/share/doc/nagios3-velvice/ |
---|
[263] | 24 | cp velvice.html ${tmp_folder}/usr/share/doc/nagios3-velvice/ |
---|
| 25 | cp velvice.sample.yml ${tmp_folder}/usr/share/doc/nagios3-velvice/ |
---|
[244] | 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/ |
---|
[263] | 29 | cp velvice.css ${tmp_folder}/etc/nagios3/stylesheets/ |
---|
[251] | 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 |
---|
[243] | 33 | |
---|
| 34 | # Data archive |
---|
| 35 | rm -f ${tmp_folder}/data.tar.gz |
---|
[252] | 36 | (cd ${tmp_folder}; tar --owner root --group root -czf data.tar.gz ./usr ./etc) |
---|
[243] | 37 | |
---|
| 38 | # Control file |
---|
| 39 | cat <<END > ${tmp_folder}/control |
---|
[253] | 40 | Package: ${PKG_NAME} |
---|
| 41 | Version: ${CODE_VERSION}-${PKG_VERSION} |
---|
[243] | 42 | Section: utils |
---|
| 43 | Tag: implemented-in::perl, interface::commandline, role::program |
---|
| 44 | Priority: optional |
---|
[322] | 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 |
---|
[243] | 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 |
---|
[252] | 57 | (cd ${tmp_folder}; tar --owner root --group root -czf control.tar.gz control) |
---|
[243] | 58 | |
---|
| 59 | # Format deb package |
---|
| 60 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
| 61 | |
---|
| 62 | # Create package (control before data) |
---|
[253] | 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 |
---|
[243] | 64 | |
---|
| 65 | # Clean |
---|
| 66 | rm -rf ${tmp_folder} |
---|
| 67 | |
---|
| 68 | # Prepare reprepro upload |
---|
| 69 | echo "# Prepare reprepro upload" |
---|
[253] | 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 )" |
---|
[243] | 73 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i nagios3-velvice" |
---|