Skip to content

Commit 1042899

Browse files
committed
fixup setup build host script
1 parent 21257d4 commit 1042899

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

ci/setup-cfengine-build-host.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#!/usr/bin/env bash
22
shopt -s expand_aliases
33

4-
#ready_flag=/etc/cfengine-buildhost-ready.flag
5-
#if [ -f "$ready_flag" ]; then
6-
# echo "Found $ready_flag so skipping setup"
7-
# exit 0
8-
#fi
9-
104
# Use the newest CFEngine version we can
115
CFE_VERSION=3.26.0
126
if [ -f /etc/centos-release ]; then
@@ -126,20 +120,21 @@ cd ..
126120
echo "Install any distribution upgrades"
127121
if [ -f /etc/os-release ]; then
128122
if grep rhel /etc/os-release; then
129-
echo "rhel-10 seems to auto-upgrade in aws cloud anyway so skipping upgrades here"
130-
# on rhel-10 a yum proc goes anyway at startup so no need to explicitly upgrade and that even fails with cache problems for some reason
131-
yum install -y git
132-
# yum update --assumeyes
123+
yum update --assumeyes
124+
alias software=yum install --assumeyes
133125
elif grep debian /etc/os-release; then
134126
DEBIAN_FRONTEND=noninteractive apt upgrade --yes && DEBIAN_FRONTEND=noninteractive apt autoremove --yes
127+
alias software=DEBIAN_FRONTEND=noninteractive apt install --yes
135128
elif grep suse /etc/os-release; then
136129
zypper -n update
130+
alias software=zypper install -y
137131
else
138132
echo "Unknown platform ID $ID. Need this information in order to update/upgrade distribution packages."
139133
exit 1
140134
fi
141135
elif [ -f /etc/redhat-release ]; then
142136
yum update --assumeyes
137+
alias software=yum install --assumeyes
143138
else
144139
echo "No /etc/os-release or /etc/redhat-release so cant determine platform."
145140
exit 1
@@ -181,10 +176,17 @@ else
181176
bash ./quick-install-cfengine-enterprise.sh agent
182177
fi
183178

184-
# check if CFEngine install worked, cf-agent present?
179+
# if cf-agent not installed, try cf-remote --version master
180+
if [ ! -x /var/cfengine/bin/cf-agent ]; then
181+
echo "quick install didn't install cf-agent, try cf-remote"
182+
if software pipx; then
183+
pipx install cf-remote
184+
cf-remote --version master install --client localhost
185+
fi
186+
fi
185187
if [ ! -x /var/cfengine/bin/cf-agent ]; then
186-
# install from source
187-
CFE_VERSION=master # hopefully master works and we don't have to figure out 3.27.0a or something that needs maintenance
188+
echo "quickinstall and cf-remote didn't install cf-agent, try from source"
189+
CFE_VERSION=3.26.0 # need to use an actualy release which has a checksum for masterfiles download
188190
rm -rf core # just in case we are repeating the script
189191
git clone --recursive --depth 1 https://github.com/cfengine/core
190192
cd core

0 commit comments

Comments
 (0)