#!/bin/bash # # 2018/04/29 Gabriel Moreau trap '[ -n "${tmp_folder}" -a -d "${tmp_folder}" ] && rm -rf "${tmp_folder}"' QUIT export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin export LANG=C tmp_folder=$(mktemp --directory /tmp/project-meta-XXXXXX) [ -n "${tmp_folder}" -a -d "${tmp_folder}" ] || exit 1 # Set Version PROJECT_META_VERSION=$(grep 'version->declare' project-meta | cut -f 2 -d "'") LOCAL_VERSION=1 # Create future tree mkdir -p ${tmp_folder}/usr/bin mkdir -p ${tmp_folder}/usr/share/man/man1 mkdir -p ${tmp_folder}/usr/share/project-meta/license.d mkdir -p ${tmp_folder}/usr/share/project-meta/template.d mkdir -p ${tmp_folder}/etc/bash_completion.d cp project-meta ${tmp_folder}/usr/bin/ cp project-meta.1.gz ${tmp_folder}/usr/share/man/man1/ cp LICENSE.txt ${tmp_folder}/usr/share/project-meta/ cp PROJECT-META.sample.yml ${tmp_folder}/usr/share/project-meta/ cp license.d/*.txt ${tmp_folder}/usr/share/project-meta/license.d/ cp template.d/*.tt ${tmp_folder}/usr/share/project-meta/template.d/ cp project-meta.bash_completion ${tmp_folder}/etc/bash_completion.d/ # Data archive rm -f ${tmp_folder}/data.tar.gz (cd ${tmp_folder}; tar czf data.tar.gz ./usr ./etc) # Control file cat < ${tmp_folder}/control Package: project-meta Version: ${PROJECT_META_VERSION}-${LOCAL_VERSION} Section: utils Tag: implemented-in::perl, interface::commandline, role::program, works-with-format::zip, works-with::archive, works-with::file Priority: optional Depends: perl, libyaml-syck-perl, libtemplate-perl, libarchive-zip-perl, coreutils, findutils Suggests: libyaml-shell-perl | yamllint Architecture: amd64 Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) Maintainer: Gabriel Moreau Description: Project-Meta - opendata project metafile manager Project-Meta is a small tool to maintain a set of open data files. In order to help you in this task, project-meta command has a set of action to generated and maintain many files in your dataset. Homepage: http://servforge.legi.grenoble-inp.fr/projects/soft-trokata/wiki/SoftWare/ProjectMeta END # Control archive rm -f ${tmp_folder}/control.tar.gz (cd ${tmp_folder}; tar czf control.tar.gz control) # Format deb package echo 2.0 > ${tmp_folder}/debian-binary # Create package (control before data) ar -r project-meta_${PROJECT_META_VERSION}-${LOCAL_VERSION}_amd64.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz # Clean rm -rf ${tmp_folder} # Prepare reprepro upload echo "# Prepare reprepro upload" echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/project-meta_${PROJECT_META_VERSION}-${LOCAL_VERSION}_amd64.deb )" echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i project-meta"