source: trunk/ddt/make-package-debian

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