Skip to content

Commit 752d7b1

Browse files
Merge pull request #2095 from craigcomstock/ent-13483-deb11-centos6
Fixup debian-11 and centos-6 build host setup
2 parents ac3440f + b206d6f commit 752d7b1

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

ci/setup-cfengine-build-host.sh

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ if [ -f /etc/os-release ]; then
8686
elif grep debian /etc/os-release; then
8787
DEBIAN_FRONTEND=noninteractive apt upgrade --yes && DEBIAN_FRONTEND=noninteractive apt autoremove --yes
8888
alias software='DEBIAN_FRONTEND=noninteractive apt install --yes'
89-
if grep stretch /etc/os-release; then
90-
DEBIAN_STRETCH=1 # special case, cf-remote install needs to NOT use master as there are no packages there
91-
fi
9289
elif grep suse /etc/os-release; then
9390
zypper -n update
9491
alias software='zypper install -y'
@@ -141,39 +138,45 @@ if grep suse /etc/os-release; then
141138
fi
142139
fi
143140

144-
echo "Installing cf-remote for possible package install and masterfiles download"
145-
# try pipx first for debian as pip won't work.
146-
# If that fails to install CFEngine then try python3-pip for redhats.
147-
PIP=""
148-
software python3-venv || true # on ubuntu-20 this is needed, debian-12 it is not but won't hurt
149-
if software pipx; then
150-
PIP=pipx
151-
export PATH=$HOME/.local/bin:$PATH
152-
elif software python3-pip; then
153-
if command -v pip; then
154-
PIP=pip
155-
elif command -v pip3; then
156-
PIP=pip3
157-
fi
158-
elif software python-pip; then
159-
if command -v pip; then
160-
PIP=pip
161-
fi
162-
else
163-
echo "Tried installing pipx, python3-pip and python-pip, none of which resulted in pipx, pip3 or pip being available. Exiting."
164-
exit 23
165-
fi
166-
export PATH=/usr/local/bin:$PATH # some pip/pipx use /usr/local/bin
141+
if [ ! -x /var/cfengine/cf-agent ]; then
142+
if ! ls cfengine-masterfiles*tar.gz; then
143+
echo "Installing cf-remote for possible package install and masterfiles download"
144+
# try pipx first for debian as pip won't work.
145+
# If that fails to install CFEngine then try python3-pip for redhats.
146+
PIP=""
147+
software python3-venv || true # on ubuntu-20 this is needed, debian-12 it is not but won't hurt
148+
if software pipx; then
149+
PIP=pipx
150+
export PATH=$HOME/.local/bin:$PATH
151+
elif software python3-pip; then
152+
if command -v pip; then
153+
PIP=pip
154+
elif command -v pip3; then
155+
PIP=pip3
156+
fi
157+
elif software python-pip; then
158+
if command -v pip; then
159+
PIP=pip
160+
fi
161+
else
162+
echo "Tried installing pipx, python3-pip and python-pip, none of which resulted in pipx, pip3 or pip being available. Exiting."
163+
exit 23
164+
fi
165+
export PATH=/usr/local/bin:$PATH # some pip/pipx use /usr/local/bin
167166

168-
$PIP uninstall -y cf-remote || true # just in case a previous is there and would cause the install to fail
169-
$PIP install cf-remote || true # if this fails we will try to install from source
167+
$PIP uninstall -y cf-remote || true # just in case a previous is there and would cause the install to fail
168+
$PIP install cf-remote || true # if this fails we will try to install from source
169+
fi # no masterfiles downloaded
170+
fi # no cf-agent installed
170171

171172
echo "Checking for pre-installed CFEngine (chicken/egg problem)"
172173
# We need a cf-agent to run build host setup policy and redhat-10-arm did not have a previous package to install.
173174
if ! /var/cfengine/bin/cf-agent -V; then
174175
echo "No existing CFEngine install found, try cf-remote..."
175-
if [ -n "$DEBIAN_STRETCH" ]; then
176-
_VERSION="--version 3.21.8"
176+
if grep -i stretch /etc/os-release; then
177+
_VERSION="--version 3.21.8" # 3.27.0 and 3.24.x do not have debian 9 (stretch)
178+
elif grep -i bullseye /etc/os-release; then
179+
_VERSION="--version 3.24.3" # 3.27.0 has only debian > 11 (bullseye)
177180
elif grep suse /etc/os-release; then
178181
# here we must use 3.24.2 instead of 3.24.3 because 3.24.3 has libcurl 4 which depends on unavailable OPENSSL_3.2.0
179182
_VERSION="--version 3.24.2" # we removed suse platforms in 3.27.0

0 commit comments

Comments
 (0)