1 | #!/bin/bash |
---|
2 | # |
---|
3 | # 2019/11/25 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/tssh-XXXXXX) |
---|
11 | [ -n "${tmp_folder}" -a -d "${tmp_folder}" ] || exit 1 |
---|
12 | |
---|
13 | # Set Name and Version |
---|
14 | PKG_NAME=tssh |
---|
15 | CODE_VERSION=$(grep '^VERSION=' tssh | cut -f 2 -d "'") # ' |
---|
16 | PKG_VERSION=1 |
---|
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/tssh |
---|
22 | mkdir -p ${tmp_folder}/etc/bash_completion.d |
---|
23 | cp tssh ${tmp_folder}/usr/bin/ |
---|
24 | cp tssh.1.gz ${tmp_folder}/usr/share/man/man1/ |
---|
25 | cp LICENSE.txt ${tmp_folder}/usr/share/tssh/ |
---|
26 | cp config.sample.sh ${tmp_folder}/usr/share/tssh/ |
---|
27 | cp tssh.bash_completion ${tmp_folder}/etc/bash_completion.d/ |
---|
28 | chmod -R a+rx ${tmp_folder}/usr/bin/tssh |
---|
29 | chmod -R a+rX,go-w ${tmp_folder}/usr |
---|
30 | chmod -R a+rX,go-w ${tmp_folder}/etc |
---|
31 | |
---|
32 | # Data archive |
---|
33 | rm -f ${tmp_folder}/data.tar.gz |
---|
34 | (cd ${tmp_folder}; tar --owner root --group root -czf data.tar.gz ./usr ./etc) |
---|
35 | |
---|
36 | # Control file |
---|
37 | cat <<END > ${tmp_folder}/control |
---|
38 | Package: ${PKG_NAME} |
---|
39 | Version: ${CODE_VERSION}-${PKG_VERSION} |
---|
40 | Section: utils |
---|
41 | Tag: implemented-in::bash, interface::commandline, role::program |
---|
42 | Priority: optional |
---|
43 | Depends: tmux, openssh-client, ncurses-bin, findutils, grep |
---|
44 | Suggests: nmap, parallel |
---|
45 | Architecture: all |
---|
46 | Installed-Size: $(du -ks ${tmp_folder}|cut -f 1) |
---|
47 | Maintainer: Gabriel Moreau <Gabriel.Moreau@univ-grenoble-alpes.fr> |
---|
48 | Description: tmux cluster ssh |
---|
49 | tssh is an acronym for tmux ssh. |
---|
50 | In practise, tssh is an ncurve version of cluster-ssh. |
---|
51 | It has been used in the LEGI laboratory for over 5 years. |
---|
52 | tssh is a small tool to luanch command over many computers. |
---|
53 | . |
---|
54 | The tool is quite effective and tries to keep things simple. |
---|
55 | Homepage: http://servforge.legi.grenoble-inp.fr/projects/soft-trokata/wiki/SoftWare/tssh |
---|
56 | END |
---|
57 | |
---|
58 | # Control archive |
---|
59 | rm -f ${tmp_folder}/control.tar.gz |
---|
60 | (cd ${tmp_folder}; tar --owner root --group root -czf control.tar.gz control) |
---|
61 | |
---|
62 | # Format deb package |
---|
63 | echo 2.0 > ${tmp_folder}/debian-binary |
---|
64 | |
---|
65 | # Create package (control before data) |
---|
66 | ar -r ${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb ${tmp_folder}/debian-binary ${tmp_folder}/control.tar.gz ${tmp_folder}/data.tar.gz |
---|
67 | |
---|
68 | # Clean |
---|
69 | rm -rf ${tmp_folder} |
---|
70 | |
---|
71 | # Prepare reprepro upload |
---|
72 | echo "# Prepare reprepro upload" |
---|
73 | echo "( cd /srv/www/debian/ ; reprepro includedeb wheezy ~/wheezy/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
74 | echo "( cd /srv/www/debian/ ; reprepro includedeb jessie ~/jessie/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
75 | echo "( cd /srv/www/debian/ ; reprepro includedeb stretch ~/stretch/${PKG_NAME}_${CODE_VERSION}-${PKG_VERSION}_all.deb )" |
---|
76 | echo "( cd /srv/www/debian/ ; reprepro dumpreferences ) | grep -i tssh" |
---|