forked from viniciusferrao/cloysterhpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-deb.sh
More file actions
executable file
·62 lines (52 loc) · 2.16 KB
/
build-deb.sh
File metadata and controls
executable file
·62 lines (52 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
set -Eeuo pipefail
build_dir=${1:-build-host}
output_dir=${2:-out/deb}
package_name=${OPENCATTUS_DEB_PACKAGE_NAME:-opencattus-installer-debug}
version=$(awk '/^Version:/ {print $2; exit}' rpmspecs/opencattus.spec)
release=$(awk '/^Release:/ {print $2; exit}' rpmspecs/opencattus.spec)
architecture=$(dpkg --print-architecture)
package_root="${output_dir}/${package_name}_${version}-${release}_${architecture}"
binary_path="${build_dir}/src/opencattus"
[[ -x "${binary_path}" ]] || {
echo "OpenCATTUS binary not found or not executable: ${binary_path}" >&2
exit 1
}
rm -rf "${package_root}"
install -d \
"${package_root}/DEBIAN" \
"${package_root}/usr/bin" \
"${package_root}/opt/opencattus/conf/repos"
install -m 755 "${binary_path}" "${package_root}/usr/bin/opencattus"
install -m 644 repos/repos.conf "${package_root}/opt/opencattus/conf/repos/repos.conf"
install -m 644 repos/alma.conf "${package_root}/opt/opencattus/conf/repos/alma.conf"
install -m 644 repos/rhel.conf "${package_root}/opt/opencattus/conf/repos/rhel.conf"
install -m 644 repos/oracle.conf "${package_root}/opt/opencattus/conf/repos/oracle.conf"
install -m 644 repos/rocky-upstream.conf \
"${package_root}/opt/opencattus/conf/repos/rocky-upstream.conf"
install -m 644 repos/rocky-vault.conf \
"${package_root}/opt/opencattus/conf/repos/rocky-vault.conf"
depends=""
if command -v dpkg-shlibdeps >/dev/null 2>&1; then
depends=$(dpkg-shlibdeps -O -e"${package_root}/usr/bin/opencattus" 2>/dev/null \
| sed -n 's/^shlibs:Depends=//p' || true)
fi
if [[ -z "${depends}" ]]; then
depends="libnewt0.52"
fi
installed_size=$(du -sk "${package_root}" | awk '{print $1}')
cat >"${package_root}/DEBIAN/control" <<EOF
Package: ${package_name}
Version: ${version}-${release}
Section: admin
Priority: optional
Architecture: ${architecture}
Maintainer: VersatusHPC <vinicius@ferrao.net.br>
Depends: ${depends}
Installed-Size: ${installed_size}
Homepage: https://github.com/versatushpc/opencattus
Description: OpenCATTUS Installer
OpenCATTUS installs and configures an HPC cluster from a single
head node.
EOF
dpkg-deb --build --root-owner-group "${package_root}" "${output_dir}"