@@ -138,32 +138,36 @@ if grep suse /etc/os-release; then
138138 fi
139139fi
140140
141- echo " Installing cf-remote for possible package install and masterfiles download"
142- # try pipx first for debian as pip won't work.
143- # If that fails to install CFEngine then try python3-pip for redhats.
144- PIP=" "
145- software python3-venv || true # on ubuntu-20 this is needed, debian-12 it is not but won't hurt
146- if software pipx; then
147- PIP=pipx
148- export PATH=$HOME /.local/bin:$PATH
149- elif software python3-pip; then
150- if command -v pip; then
151- PIP=pip
152- elif command -v pip3; then
153- PIP=pip3
154- fi
155- elif software python-pip; then
156- if command -v pip; then
157- PIP=pip
158- fi
159- else
160- echo " Tried installing pipx, python3-pip and python-pip, none of which resulted in pipx, pip3 or pip being available. Exiting."
161- exit 23
162- fi
163- 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
164166
165- $PIP uninstall -y cf-remote || true # just in case a previous is there and would cause the install to fail
166- $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
167171
168172echo " Checking for pre-installed CFEngine (chicken/egg problem)"
169173# We need a cf-agent to run build host setup policy and redhat-10-arm did not have a previous package to install.
0 commit comments