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 "'") #' |
---|
15 | LOCAL_VERSION=1 |
---|
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/ |
---|
27 | |
---|
28 | # Data archive |
---|
29 | rm -f ${tmp_folder}/data.tar.gz |
---|
30 | (cd ${tmp_folder}; tar czf data.tar.gz ./usr ./etc) |
---|
31 | |
---|
32 | # Control file |
---|
33 | cat <<END > ${tmp_folder}/control |
---|
34 | Package: ddt |
---|
35 | Version: ${DDT_VERSION}-${LOCAL_VERSION} |
---|
36 | Section: utils |
---|
37 | Tag: implemented-in::perl, interface::commandline, role::program |
---|
38 | Priority: optional |
---|
39 | Depends: perl, perl-base, perl-modules, libyaml-syck-perl, libnet-netmask-perl, libreadonly-perl, libfile-touch-perl |
---|
40 | Suggests: libyaml-shell-perl | yamllint, perl-doc |
---|
41 | Architecture: amd64 |
---|
42 | Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) |
---|
43 | Maintainer: Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
44 | Description: ddt - management of computer names and IP addresses |
---|
45 | ddt (dhcp-dns-tools) is a small tool to maintain a set of computers/IP. |
---|
46 | In order to help you in this task, ddt command has a set of action |
---|
47 | to generated DHCP and DNS configuration files. |
---|
48 | Homepage: http://servforge.legi.grenoble-inp.fr/projects/soft-trokata/wiki/SoftWare/DDT |
---|
49 | END |
---|
50 | |
---|
51 | # Control archive |
---|
52 | rm -f ${tmp_folder}/control.tar.gz |
---|
53 | (cd ${tmp_folder}; tar czf control.tar.gz control) |
---|
54 | |
---|
55 | # Format deb package |
---|
56 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
57 | |
---|
58 | # Create package (control before data) |
---|
59 | ar -r ddt_${DDT_VERSION}-${LOCAL_VERSION}_amd64.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz |
---|
60 | |
---|
61 | # Clean |
---|
62 | rm -rf ${tmp_folder} |
---|
63 | |
---|
64 | # Prepare reprepro upload |
---|
65 | echo "# Prepare reprepro upload" |
---|
66 | echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/ddt_${DDT_VERSION}-${LOCAL_VERSION}_amd64.deb )" |
---|
67 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i ddt" |
---|