[223] | 1 | #!/bin/bash |
---|
| 2 | # |
---|
| 3 | # 2018/06/19 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/ddt-XXXXXX) |
---|
| 11 | [ -n "${tmp_folder}" -a -d "${tmp_folder}" ] || exit 1 |
---|
| 12 | |
---|
| 13 | # Set Version |
---|
| 14 | DDT_VERSION=$(grep 'version->declare' ddt | cut -f 2 -d "'") #' |
---|
[231] | 15 | LOCAL_VERSION=5 |
---|
[223] | 16 | |
---|
| 17 | # Create future tree |
---|
| 18 | mkdir -p ${tmp_folder}/usr/bin |
---|
| 19 | mkdir -p ${tmp_folder}/usr/share/man/man1 |
---|
| 20 | mkdir -p ${tmp_folder}/usr/share/ddt |
---|
| 21 | mkdir -p ${tmp_folder}/etc/bash_completion.d |
---|
| 22 | cp ddt ${tmp_folder}/usr/bin/ |
---|
| 23 | cp ddt.1.gz ${tmp_folder}/usr/share/man/man1/ |
---|
| 24 | cp LICENSE.txt ${tmp_folder}/usr/share/ddt/ |
---|
| 25 | cp config.sample.yml ${tmp_folder}/usr/share/ddt/ |
---|
| 26 | cp ddt.bash_completion ${tmp_folder}/etc/bash_completion.d/ |
---|
[228] | 27 | (cd ${tmp_folder}/usr/bin; ln -s ddt dhcp-dns-tools) |
---|
| 28 | (cd ${tmp_folder}/usr/share/man/man1; ln -s ddt.1.gz dhcp-dns-tools.1.gz) |
---|
[223] | 29 | |
---|
| 30 | # Data archive |
---|
| 31 | rm -f ${tmp_folder}/data.tar.gz |
---|
| 32 | (cd ${tmp_folder}; tar czf data.tar.gz ./usr ./etc) |
---|
| 33 | |
---|
| 34 | # Control file |
---|
| 35 | cat <<END > ${tmp_folder}/control |
---|
| 36 | Package: ddt |
---|
| 37 | Version: ${DDT_VERSION}-${LOCAL_VERSION} |
---|
| 38 | Section: utils |
---|
| 39 | Tag: implemented-in::perl, interface::commandline, role::program |
---|
| 40 | Priority: optional |
---|
| 41 | Depends: perl, perl-base, perl-modules, libyaml-syck-perl, libnet-netmask-perl, libreadonly-perl, libfile-touch-perl |
---|
[233] | 42 | Suggests: libyaml-shell-perl | yamllint, perl-doc, isc-dhcp-server, bind9 |
---|
[226] | 43 | Architecture: all |
---|
[223] | 44 | Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) |
---|
| 45 | Maintainer: Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
[228] | 46 | Description: dhcp-dns-tools management of computer names and IP addresses |
---|
[229] | 47 | DDT is an acronym for DHCP-DNS-Tools. |
---|
| 48 | In practise, DDT is an IP Address Management (IPAM) service. |
---|
| 49 | It has been used in the LEGI laboratory for over 10 years. |
---|
| 50 | ddt (dhcp-dns-tools) is a small tool to maintain a set of computers/IP. |
---|
| 51 | In order to help you in this task, ddt command has a set of action |
---|
| 52 | to generated DHCP and DNS configuration files. |
---|
[230] | 53 | . |
---|
[229] | 54 | The tool is quite effective and tries to keep things simple |
---|
| 55 | but easily configurable for your site like a swiss army knife. |
---|
| 56 | Everything is saved in a YAML database |
---|
[231] | 57 | and entries could be added, deleted, or modified by the command line. |
---|
[223] | 58 | Homepage: http://servforge.legi.grenoble-inp.fr/projects/soft-trokata/wiki/SoftWare/DDT |
---|
| 59 | END |
---|
| 60 | |
---|
| 61 | # Control archive |
---|
| 62 | rm -f ${tmp_folder}/control.tar.gz |
---|
| 63 | (cd ${tmp_folder}; tar czf control.tar.gz control) |
---|
| 64 | |
---|
| 65 | # Format deb package |
---|
| 66 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
| 67 | |
---|
| 68 | # Create package (control before data) |
---|
[226] | 69 | ar -r ddt_${DDT_VERSION}-${LOCAL_VERSION}_all.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz |
---|
[223] | 70 | |
---|
| 71 | # Clean |
---|
| 72 | rm -rf ${tmp_folder} |
---|
| 73 | |
---|
| 74 | # Prepare reprepro upload |
---|
| 75 | echo "# Prepare reprepro upload" |
---|
[226] | 76 | echo "( cd /srv/www/debian/ ; reprepro includedeb wheezy ~/wheezy/ddt_${DDT_VERSION}-${LOCAL_VERSION}_all.deb )" |
---|
| 77 | echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/ddt_${DDT_VERSION}-${LOCAL_VERSION}_all.deb )" |
---|
| 78 | echo "( cd /srv/www/debian/ ; reprepro includedeb stretch ~/stretch/ddt_${DDT_VERSION}-${LOCAL_VERSION}_all.deb )" |
---|
[223] | 79 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i ddt" |
---|