1 | #!/bin/bash |
---|
2 | # |
---|
3 | # 2018/04/29 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/project-meta-XXXXXX) |
---|
11 | [ -n "${tmp_folder}" -a -d "${tmp_folder}" ] || exit 1 |
---|
12 | |
---|
13 | # Set Name and Version |
---|
14 | PKG_NAME=project-meta |
---|
15 | CODE_VERSION=$(grep 'version->declare' project-meta | cut -f 2 -d "'") #' |
---|
16 | PKG_VERSION=2 |
---|
17 | |
---|
18 | # Create future tree |
---|
19 | mkdir -p ${tmp_folder}/usr/bin |
---|
20 | mkdir -p ${tmp_folder}/usr/share/man/man1 |
---|
21 | mkdir -p ${tmp_folder}/usr/share/project-meta/license.d |
---|
22 | mkdir -p ${tmp_folder}/usr/share/project-meta/template.d |
---|
23 | mkdir -p ${tmp_folder}/etc/bash_completion.d |
---|
24 | cp project-meta ${tmp_folder}/usr/bin/ |
---|
25 | cp project-meta.1.gz ${tmp_folder}/usr/share/man/man1/ |
---|
26 | cp LICENSE.txt ${tmp_folder}/usr/share/project-meta/ |
---|
27 | cp PROJECT-META.sample.yml ${tmp_folder}/usr/share/project-meta/ |
---|
28 | cp license.d/*.txt ${tmp_folder}/usr/share/project-meta/license.d/ |
---|
29 | cp template.d/*.tt ${tmp_folder}/usr/share/project-meta/template.d/ |
---|
30 | cp project-meta.bash_completion ${tmp_folder}/etc/bash_completion.d/ |
---|
31 | chmod -R a+rx ${tmp_folder}/usr/bin/project-meta |
---|
32 | chmod -R a+rX,go-w ${tmp_folder}/usr |
---|
33 | chmod -R a+rX,go-w ${tmp_folder}/etc |
---|
34 | |
---|
35 | # Data archive |
---|
36 | rm -f ${tmp_folder}/data.tar.gz |
---|
37 | (cd ${tmp_folder}; tar --owner root --group root -czf data.tar.gz ./usr ./etc) |
---|
38 | |
---|
39 | # Control file |
---|
40 | cat <<END > ${tmp_folder}/control |
---|
41 | Package: ${PKG_NAME} |
---|
42 | Version: ${CODE_VERSION}-${PKG_VERSION} |
---|
43 | Section: utils |
---|
44 | Tag: implemented-in::perl, interface::commandline, role::program, |
---|
45 | works-with-format::zip, works-with::archive, works-with::file |
---|
46 | Priority: optional |
---|
47 | Depends: perl, libyaml-syck-perl, libtemplate-perl, libarchive-zip-perl, coreutils, findutils |
---|
48 | Suggests: libyaml-shell-perl | yamllint |
---|
49 | Architecture: amd64 |
---|
50 | Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) |
---|
51 | Maintainer: Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
52 | Description: Project-Meta - opendata project metafile manager |
---|
53 | Project-Meta is a small tool to maintain a set of open data files. |
---|
54 | In order to help you in this task, project-meta command has a set of action |
---|
55 | to generated and maintain many files in your dataset. |
---|
56 | Homepage: http://servforge.legi.grenoble-inp.fr/projects/soft-trokata/wiki/SoftWare/ProjectMeta |
---|
57 | END |
---|
58 | |
---|
59 | # Control archive |
---|
60 | rm -f ${tmp_folder}/control.tar.gz |
---|
61 | (cd ${tmp_folder}; tar --owner root --group root -czf control.tar.gz control) |
---|
62 | |
---|
63 | # Format deb package |
---|
64 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
65 | |
---|
66 | # Create package (control before data) |
---|
67 | ar -r ${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_amd64.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz |
---|
68 | |
---|
69 | # Clean |
---|
70 | rm -rf ${tmp_folder} |
---|
71 | |
---|
72 | # Prepare reprepro upload |
---|
73 | echo "# Prepare reprepro upload" |
---|
74 | echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_amd64.deb )" |
---|
75 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i project-meta" |
---|