forked from kronosnet/ci-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-rpm-common
executable file
·179 lines (174 loc) · 6.61 KB
/
ci-rpm-common
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
export REMOVERPMS="libnozzle1 libknet1 libqb* corosynclib libcorosync* resource-agents libpacemaker-devel pacemaker-libs-devel pacemaker-schemas fence-agents fence-agents-common corosync-qdevice-devel dlm*"
cleanbr() {
if [ -n "$(which zypper 2>/dev/null)" ]; then
zypper remove -y $REMOVERPMS || true
zypper removerepo kronosnet-build || true
zypper removerepo libqb-build || true
zypper removerepo corosync-build || true
zypper removerepo pacemaker-build || true
zypper removerepo corosync-qdevice-build || true
zypper removerepo sbd-build || true
zypper removerepo fence-agents-build || true
zypper removerepo resource-agents-build || true
zypper removerepo booth-build || true
zypper removerepo dlm-build || true
zypper removerepo gfs2utils-build || true
zypper clean
fi
if [ -n "$(which yum 2>/dev/null)" ]; then
yum remove -y $REMOVERPMS || true
rm -rf /etc/yum.repos.d/kronosnet-build.repo || true
rm -rf /etc/yum.repos.d/libqb-build.repo || true
rm -rf /etc/yum.repos.d/corosync-build.repo || true
rm -rf /etc/yum.repos.d/pacemaker-build.repo || true
rm -rf /etc/yum.repos.d/corosync-qdevice-build.repo || true
rm -rf /etc/yum.repos.d/sbd-build.repo || true
rm -rf /etc/yum.repos.d/fence-agents-build.repo || true
rm -rf /etc/yum.repos.d/resource-agents-build.repo || true
rm -rf /etc/yum.repos.d/booth-build.repo || true
rm -rf /etc/yum.repos.d/dlm-build.repo || true
rm -rf /etc/yum.repos.d/gfs2utils-build.repo || true
yum clean all
fi
}
# always restore BaseOS libqb-devel
removerpmdeps() {
cleanbr
osdeps="libqb-devel"
case ${NODE_NAME} in
*ci-test*)
osdeps="$osdeps libknet1-devel"
;;
esac
if [ -n "$(which zypper 2>/dev/null)" ]; then
zypper install -y $osdeps
fi
if [ -n "$(which yum 2>/dev/null)" ]; then
yum install -y $osdeps
fi
return $1
}
installrpmdeps() {
if [ "x$bootstrap" = "x1" ]; then
ret="true"
else
ret="removerpmdeps 1"
fi
cleanbr
if [ -n "$(which zypper 2>/dev/null)" ]; then
if [ -n "$KRONOSNET_REPO_PATH" ]; then
zypper addrepo $KRONOSNET_REPO_PATH kronosnet-build || $ret
zypper modifyrepo -p 1 -e -f -G kronosnet-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $KRONOSNET_REPO_PATH; then
zypper removerepo kronosnet-build || true
fi
fi
if [ -n "$LIBQB_REPO_PATH" ]; then
zypper addrepo $LIBQB_REPO_PATH libqb-build || $ret
zypper modifyrepo -p 1 -e -f -G libqb-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $LIBQB_REPO_PATH; then
zypper removerepo libqb-build || true
fi
fi
if [ -n "$COROSYNC_REPO_PATH" ]; then
zypper addrepo $COROSYNC_REPO_PATH corosync-build || $ret
zypper modifyrepo -p 1 -e -f -G corosync-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $COROSYNC_REPO_PATH; then
zypper removerepo corosync-build || true
fi
fi
if [ -n "$PACEMAKER_REPO_PATH" ]; then
zypper addrepo $PACEMAKER_REPO_PATH pacemaker-build || $ret
zypper modifyrepo -p 1 -e -f -G pacemaker-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $PACEMAKER_REPO_PATH; then
zypper removerepo pacemaker-build || true
fi
fi
if [ -n "$COROSYNC_QDEVICE_REPO_PATH" ]; then
zypper addrepo $COROSYNC_QDEVICE_REPO_PATH corosync-qdevice-build || $ret
zypper modifyrepo -p 1 -e -f -G corosync-qdevice-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $COROSYNC_QDEVICE_REPO_PATH; then
zypper removerepo corosync-qdevice-build || true
fi
fi
if [ -n "$SBD_REPO_PATH" ]; then
zypper addrepo $SBD_REPO_PATH sbd-build || $ret
zypper modifyrepo -p 1 -e -f -G sbd-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $SBD_REPO_PATH; then
zypper removerepo sbd-build || true
fi
fi
if [ -n "$FENCE_AGENTS_REPO_PATH" ]; then
zypper addrepo $FENCE_AGENTS_REPO_PATH fence-agents-build || $ret
zypper modifyrepo -p 1 -e -f -G fence-agents-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $FENCE_AGENTS_REPO_PATH; then
zypper removerepo fence-agents-build || true
fi
fi
if [ -n "$RESOURCE_AGENTS_REPO_PATH" ]; then
zypper addrepo $RESOURCE_AGENTS_REPO_PATH resource-agents-build || $ret
zypper modifyrepo -p 1 -e -f -G resource-agents-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $RESOURCE_AGENTS_REPO_PATH; then
zypper removerepo resource-agents-build || true
fi
fi
if [ -n "$BOOTH_REPO_PATH" ]; then
zypper addrepo $BOOTH_REPO_PATH booth-build || $ret
zypper modifyrepo -p 1 -e -f -G booth-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $BOOTH_REPO_PATH; then
zypper removerepo booth-build || true
fi
fi
if [ -n "$DLM_REPO_PATH" ]; then
zypper addrepo $DLM_REPO_PATH dlm-build || $ret
zypper modifyrepo -p 1 -e -f -G dlm-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $DLM_REPO_PATH; then
zypper removerepo dlm-build || true
fi
fi
if [ -n "$GFS2UTILS_REPO_PATH" ]; then
zypper addrepo $GFS2UTILS_REPO_PATH gfs2utils-build || $ret
zypper modifyrepo -p 1 -e -f -G gfs2utils-build || $ret
if [ "x$bootstrap" = "x1" ] && ! wget -4 -q -O /dev/null $GFS2UTILS_REPO_PATH; then
zypper removerepo gfs2utils-build || true
fi
fi
zypper install -y $RPMDEPS || removerpmdeps 1
fi
if [ -n "$(which yum 2>/dev/null)" ]; then
if [ -n "$KRONOSNET_REPO" ]; then
wget -4 -O /etc/yum.repos.d/kronosnet-build.repo $KRONOSNET_REPO || $ret
fi
if [ -n "$LIBQB_REPO" ]; then
wget -4 -O /etc/yum.repos.d/libqb-build.repo $LIBQB_REPO || $ret
fi
if [ -n "$COROSYNC_REPO" ]; then
wget -4 -O /etc/yum.repos.d/corosync-build.repo $COROSYNC_REPO || $ret
fi
if [ -n "$PACEMAKER_REPO" ]; then
wget -4 -O /etc/yum.repos.d/pacemaker-build.repo $PACEMAKER_REPO || $ret
fi
if [ -n "$COROSYNC_QDEVICE_REPO" ]; then
wget -4 -O /etc/yum.repos.d/corosync-qdevice-build.repo $COROSYNC_QDEVICE_REPO || $ret
fi
if [ -n "$SBD_REPO" ]; then
wget -4 -O /etc/yum.repos.d/sbd-build.repo $SBD_REPO || $ret
fi
if [ -n "$FENCE_AGENTS_REPO" ]; then
wget -4 -O /etc/yum.repos.d/fence-agents-build.repo $FENCE_AGENTS_REPO || $ret
fi
if [ -n "$RESOURCE_AGENTS_REPO" ]; then
wget -4 -O /etc/yum.repos.d/resource-agents-build.repo $RESOURCE_AGENTS_REPO || $ret
fi
if [ -n "$BOOTH_REPO" ]; then
wget -4 -O /etc/yum.repos.d/booth-build.repo $BOOTH_REPO || $ret
fi
if [ -n "$DLM_REPO" ]; then
wget -4 -O /etc/yum.repos.d/dlm-build.repo $DLM_REPO || $ret
fi
if [ -n "$GFS2UTILS_REPO" ]; then
wget -4 -O /etc/yum.repos.d/gfs2utils-build.repo $GFS2UTILS_REPO || $ret
fi
yum install -y $RPMDEPS || removerpmdeps 1
fi
}