|
2 | 2 | shopt -s expand_aliases |
3 | 3 | thisdir="$(dirname "$0")" |
4 | 4 |
|
5 | | -# Use the newest CFEngine version we can |
6 | | -CFE_VERSION=3.26.0 |
7 | | -if [ -f /etc/centos-release ]; then |
8 | | - _version=$(cat /etc/centos-release | cut -d' ' -f3 | cut -d. -f1) |
9 | | - if [ "$_version" = "6" ]; then |
10 | | - CFE_VERSION=3.24.2 |
11 | | - fi |
12 | | -elif [ -f /etc/os-release ]; then |
13 | | - source /etc/os-release |
14 | | - if [ "$ID" = "debian" ]; then |
15 | | - if [ "$VERSION_ID" -lt "9" ]; then |
16 | | - echo "Platform $ID $VERSION_ID is too old." |
17 | | - exit 9 |
18 | | - fi |
19 | | - if [ "$VERSION_ID" -lt "11" ]; then |
20 | | - CFE_VERSION=3.21.7 |
21 | | - fi |
22 | | - fi |
23 | | - if [ "$ID" = "redhat" ] || [ "$ID" = "centos" ]; then |
24 | | - if [ "$VERSION_ID" -lt "6" ]; then |
25 | | - echo "Platform $ID $VERSION_ID is too old." |
26 | | - exit 9 |
27 | | - fi |
28 | | - if [ "$VERSION_ID" -lt "7" ]; then |
29 | | - CFE_VERSION=3.24.2 |
30 | | - fi |
31 | | - fi |
32 | | - if [ "$ID" = "ubuntu" ]; then |
33 | | - _version="$(echo "$VERSION_ID" | cut -d. -f1)" |
34 | | - if [ "$_version" -lt "16" ]; then |
35 | | - echo "Platform $ID $VERSION_ID is too old." |
36 | | - exit 9 |
37 | | - fi |
38 | | - if [ "$_version" -lt "20" ]; then |
39 | | - CFE_VERSION=3.21.7 |
40 | | - fi |
41 | | - fi |
42 | | -fi |
43 | | - |
44 | 5 | # install needed packages and software for a build host |
45 | 6 | set -ex |
46 | 7 | if [ "$(id -u)" != "0" ]; then |
@@ -147,41 +108,9 @@ else |
147 | 108 | fi |
148 | 109 |
|
149 | 110 | echo "Checking for pre-installed CFEngine (chicken/egg problem)" |
150 | | -# We need a cf-agent to run build host setup policy and redhat-10-arm has not previous package to install. |
151 | | -# solution: install from source and make a custom AWS AMI image |
152 | | -if ! /var/cfengine/bin/cf-agent -V; then |
153 | | - echo "No existing CFEngine install found, try quickinstall script..." |
154 | | - if grep -i suse /etc/os-release; then |
155 | | - # need to add our public key first otherwise zypper install fails |
156 | | - rpm --import https://cfengine-package-repos.s3.amazonaws.com/pub/gpg.key |
157 | | - if grep 'VERSION.*12' /etc/os-release; then |
158 | | - urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-"$CFE_VERSION"/agent/agent_suse12_x86_64/cfengine-nova-"$CFE_VERSION"-1.suse12.x86_64.rpm |
159 | | - zypper install -y cfengine-nova-"$CFE_VERSION"-1.suse12.x86_64.rpm |
160 | | - elif grep 'VERSION.*15' /etc/os-release; then |
161 | | - urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-"$CFE_VERSION"/agent/agent_suse15_x86_64/cfengine-nova-"$CFE_VERSION"-1.suse15.x86_64.rpm |
162 | | - zypper install -y cfengine-nova-"$CFE_VERSION"-1.suse15.x86_64.rpm |
163 | | - else |
164 | | - echo "Unsupported suse version:" |
165 | | - grep VERSION /etc/os-release |
166 | | - exit 1 |
167 | | - fi |
168 | | - else |
169 | | - urlget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh |
170 | | - # log sha256 checksum expected and actuall for debugging purposes |
171 | | - echo "Expected quick install checksum: " |
172 | | - cat "$thisdir"/quick-install-cfengine-enterprise.sh.sha256 |
173 | | - echo "Actual quick install checksum: " |
174 | | - sha256sum quick-install-cfengine-enterprise.sh |
175 | | - |
176 | | - sha256sum --check "$thisdir"/quick-install-cfengine-enterprise.sh.sha256 |
177 | | - chmod +x quick-install-cfengine-enterprise.sh |
178 | | - export CFEngine_Enterprise_Package_Version="$CFE_VERSION" |
179 | | - bash ./quick-install-cfengine-enterprise.sh agent |
180 | | - fi |
181 | | -fi |
182 | | - |
| 111 | +# We need a cf-agent to run build host setup policy and redhat-10-arm did not have a previous package to install. |
183 | 112 | if ! /var/cfengine/bin/cf-agent -V; then |
184 | | - echo "quickinstall script didn't install CFEngine, try cf-remote..." |
| 113 | + echo "No existing CFEngine install found, try cf-remote..." |
185 | 114 | # try pipx first for debian as pip won't work. |
186 | 115 | # If that fails to install CFEngine then try python3-pip for redhats. |
187 | 116 | if software pipx; then |
|
199 | 128 | if [ ! -x /var/cfengine/bin/cf-agent ]; then |
200 | 129 | echo "cf-remote didn't install CFEngine, build from source..." |
201 | 130 | software git |
202 | | - echo "quickinstall and cf-remote didn't install cf-agent, try from source" |
| 131 | + echo "cf-remote didn't install cf-agent, try from source" |
203 | 132 | CFE_VERSION=3.26.0 # need to use an actualy release which has a checksum for masterfiles download |
204 | 133 | rm -rf core # just in case we are repeating the script |
205 | 134 | git clone --recursive --depth 1 https://github.com/cfengine/core |
|
0 commit comments