|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | shopt -s expand_aliases |
3 | 3 |
|
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 | | - |
10 | 4 | # Use the newest CFEngine version we can |
11 | 5 | CFE_VERSION=3.26.0 |
12 | 6 | if [ -f /etc/centos-release ]; then |
@@ -126,20 +120,21 @@ cd .. |
126 | 120 | echo "Install any distribution upgrades" |
127 | 121 | if [ -f /etc/os-release ]; then |
128 | 122 | 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 |
133 | 125 | elif grep debian /etc/os-release; then |
134 | 126 | DEBIAN_FRONTEND=noninteractive apt upgrade --yes && DEBIAN_FRONTEND=noninteractive apt autoremove --yes |
| 127 | + alias software=DEBIAN_FRONTEND=noninteractive apt install --yes |
135 | 128 | elif grep suse /etc/os-release; then |
136 | 129 | zypper -n update |
| 130 | + alias software=zypper install -y |
137 | 131 | else |
138 | 132 | echo "Unknown platform ID $ID. Need this information in order to update/upgrade distribution packages." |
139 | 133 | exit 1 |
140 | 134 | fi |
141 | 135 | elif [ -f /etc/redhat-release ]; then |
142 | 136 | yum update --assumeyes |
| 137 | + alias software=yum install --assumeyes |
143 | 138 | else |
144 | 139 | echo "No /etc/os-release or /etc/redhat-release so cant determine platform." |
145 | 140 | exit 1 |
@@ -181,10 +176,17 @@ else |
181 | 176 | bash ./quick-install-cfengine-enterprise.sh agent |
182 | 177 | fi |
183 | 178 |
|
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 |
185 | 187 | 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 |
188 | 190 | rm -rf core # just in case we are repeating the script |
189 | 191 | git clone --recursive --depth 1 https://github.com/cfengine/core |
190 | 192 | cd core |
|
0 commit comments