[401] | 1 | #!/bin/bash |
---|
| 2 | # |
---|
| 3 | # 2018/10/02 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/klask-XXXXXX) |
---|
| 11 | [ -n "${tmp_folder}" -a -d "${tmp_folder}" ] || exit 1 |
---|
| 12 | |
---|
| 13 | # Set Name and Version |
---|
| 14 | PKG_NAME=klask |
---|
| 15 | CODE_VERSION=$(grep 'version->declare' klask | cut -f 2 -d "'") #' |
---|
| 16 | PKG_VERSION=1 |
---|
| 17 | |
---|
| 18 | # Create future tree |
---|
| 19 | mkdir -p ${tmp_folder}/usr/bin |
---|
| 20 | mkdir -p ${tmp_folder}/usr/lib/klask |
---|
| 21 | mkdir -p ${tmp_folder}/usr/share/man/man1 |
---|
| 22 | mkdir -p ${tmp_folder}/usr/share/klask |
---|
| 23 | mkdir -p ${tmp_folder}/etc/klask |
---|
| 24 | mkdir -p ${tmp_folder}/etc/bash_completion.d |
---|
| 25 | cp klask ${tmp_folder}/usr/bin/ |
---|
| 26 | cp push-web ${tmp_folder}/usr/lib/klask/ |
---|
| 27 | cp klask-wrapper ${tmp_folder}/usr/lib/klask/ |
---|
| 28 | cp klask.1.gz ${tmp_folder}/usr/share/man/man1/ |
---|
| 29 | cp LICENSE.txt ${tmp_folder}/usr/share/klask/ |
---|
| 30 | cp sorttable-klask.js ${tmp_folder}/usr/share/klask/ |
---|
| 31 | cp style-klask.css ${tmp_folder}/usr/share/klask/ |
---|
| 32 | cp klask-sample.conf ${tmp_folder}/etc/klask/ |
---|
| 33 | cp push-web-sample.conf ${tmp_folder}/etc/klask/ |
---|
| 34 | cp klask.cron ${tmp_folder}/etc/klask/ |
---|
| 35 | cp klask.bash_completion ${tmp_folder}/etc/bash_completion.d/ |
---|
| 36 | chmod -R a+rx,go-w ${tmp_folder}/usr/bin/klask |
---|
| 37 | chmod -R a+rx,go-w ${tmp_folder}/usr/lib/klask/push-web |
---|
| 38 | chmod -R a+rx,go-w ${tmp_folder}/usr/lib/klask/klask-wrapper |
---|
| 39 | chmod -R a+rX,go-w ${tmp_folder}/usr |
---|
| 40 | chmod -R a+rX,go-w ${tmp_folder}/etc |
---|
| 41 | |
---|
| 42 | # Data archive |
---|
| 43 | rm -f ${tmp_folder}/data.tar.gz |
---|
| 44 | (cd ${tmp_folder}; tar --owner root --group root -czf data.tar.gz ./usr ./etc) |
---|
| 45 | |
---|
| 46 | # Control file |
---|
| 47 | cat <<END > ${tmp_folder}/control |
---|
| 48 | Package: ${PKG_NAME} |
---|
| 49 | Version: ${CODE_VERSION}-${PKG_VERSION} |
---|
| 50 | Section: utils |
---|
| 51 | Tag: implemented-in::perl, interface::commandline, role::program |
---|
| 52 | Priority: optional |
---|
| 53 | Depends: perl, perl-base, perl-modules, libnet-cidr-lite-perl, libnet-netmask-perl, libnet-snmp-perl, libnetaddr-ip-perl, libyaml-perl, libcrypt-des-perl, libcrypt-hcesha-perl, libdigest-hmac-perl, libtext-table-perl, snmp, arping, net-tools, fping, bind9-host, arpwatch |
---|
| 54 | Suggests: libyaml-shell-perl | yamllint, perl-doc |
---|
| 55 | Architecture: all |
---|
| 56 | Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) |
---|
| 57 | Maintainer: Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
[403] | 58 | Description: Klask maps your local network - Switches and Computers |
---|
[401] | 59 | Klask means search in Breton and that's exactly what we wanted. |
---|
| 60 | Klask is a tool whose two main functions are: |
---|
| 61 | * Find the connections between switches and draw a map of the |
---|
| 62 | active hardware on the local network; |
---|
| 63 | * Make an accurate inventory of the port and switch to which |
---|
| 64 | the local network machines are connected. |
---|
| 65 | Klask is a small tool, in the spirit of UNIX tools, to worry about |
---|
| 66 | connections on the local network. |
---|
| 67 | Homepage: http://servforge.legi.grenoble-inp.fr/projects/klask |
---|
| 68 | END |
---|
| 69 | |
---|
| 70 | # Control archive |
---|
| 71 | rm -f ${tmp_folder}/control.tar.gz |
---|
| 72 | (cd ${tmp_folder}; tar --owner root --group root -czf control.tar.gz control) |
---|
| 73 | |
---|
| 74 | # Format deb package |
---|
| 75 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
| 76 | |
---|
| 77 | # Create package (control before data) |
---|
| 78 | ar -r ${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz |
---|
| 79 | |
---|
| 80 | # Clean |
---|
| 81 | rm -rf ${tmp_folder} |
---|
| 82 | |
---|
| 83 | # Prepare reprepro upload |
---|
| 84 | echo "# Prepare reprepro upload" |
---|
| 85 | echo "( cd /srv/www/debian/ ; reprepro includedeb wheezy ~/wheezy/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
| 86 | echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
| 87 | echo "( cd /srv/www/debian/ ; reprepro includedeb stretch ~/stretch/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
| 88 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i klask" |
---|