@@ -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
142139fi
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
171172echo " 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.
173174if ! /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