-
Notifications
You must be signed in to change notification settings - Fork 14
/
setup
executable file
·58 lines (49 loc) · 1.84 KB
/
setup
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
#!/bin/bash
#
# Setup environment to build RPM
set -euo pipefail
export LC_ALL=C
PACKAGER_DIR="$(cd "$(dirname "${0}")" && echo "${PWD}")"
# RPM macros
RPM_MACROS=/usr/lib/rpm/macros.d/macros.dist
if [[ -f /etc/rpm/macros.dist ]]; then
# el7 and el8
RPM_MACROS=/etc/rpm/macros.dist
fi
RPM_DIST=.$(egrep -o "^%el[0-9]*" "${RPM_MACROS}" | tr -d '%')
echo "RPM_DIST: ${RPM_DIST} (${RPM_MACROS})"
# Setup build tools
echo
echo "# Setup build tools"
PACKAGE_MANAGER=""
if [[ "${RPM_DIST}" = ".el9" ]]; then
echo "# - Install build tools for el9"
dnf -y groupinstall "Development Tools"
dnf -y install sudo wget git-core rpm-build rpmdevtools yum-utils createrepo epel-release
dnf -y install pinentry
dnf config-manager --enable crb
elif [[ "${RPM_DIST}" = ".el8" ]]; then
echo "# - Install build tools for el8"
dnf -y groupinstall "Development Tools"
dnf -y install sudo wget git-core rpm-build rpmdevtools spectool yum-utils createrepo epel-release
dnf -y install pinentry
dnf config-manager --enable powertools
elif [[ "${RPM_DIST}" = ".el7" ]]; then
echo "# - Remove centos vault repository"
if [[ -f /etc/yum.repos.d/CentOS-Vault.repo ]]; then
rm -f /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/CentOS-Sources.repo
fi
echo "# - Install build tools for el7"
yum -y groupinstall "Development Tools"
yum -y install sudo wget git-core rpm-build rpmdevtools spectool yum-utils createrepo epel-release
yum clean all
fi
if [[ "${RPM_DIST}" = ".el9" ]]; then
echo "# - Install python3-mock for el9"
echo "# https://github.com/jfut/ganeti-rpm/issues/50"
dnf -y install https://buildlogs.cdn.centos.org/centos/9-stream/cloud/x86_64/openstack-zed/Packages/p/python3-mock-4.0.3-5.el9s.noarch.rpm
fi
# Setup GHC environment
echo
echo "# Setup GHC environment"
${PACKAGER_DIR}/setup-ghc