diff --git a/.drone.jsonnet b/.drone.jsonnet index e7145b5..a3dafff 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -21,16 +21,16 @@ local stable_py3_suites = [ local distros = [ { name: 'Arch', slug: 'arch', multiplier: 0, depends: [] }, - // { name: 'Amazon 1', slug: 'amazon-1', multiplier: 1, depends: [] }, - // { name: 'Amazon 2', slug: 'amazon-2', multiplier: 2, depends: [] }, +// { name: 'Amazon 1', slug: 'amazon-1', multiplier: 1, depends: [] }, + { name: 'Amazon 2', slug: 'amazon-2', multiplier: 2, depends: [] }, { name: 'CentOS 6', slug: 'centos-6', multiplier: 3, depends: [] }, { name: 'CentOS 7', slug: 'centos-7', multiplier: 4, depends: [] }, - { name: 'CentOS 8', slug: 'centos-8', multiplier: 4, depends: [] }, - { name: 'Debian 8', slug: 'debian-8', multiplier: 5, depends: [] }, - { name: 'Debian 9', slug: 'debian-9', multiplier: 6, depends: [] }, - { name: 'Debian 10', slug: 'debian-10', multiplier: 6, depends: [] }, - { name: 'Fedora 30', slug: 'fedora-30', multiplier: 6, depends: [] }, - { name: 'Opensuse 15.0', slug: 'opensuse-15', multiplier: 4, depends: [] }, + { name: 'CentOS 8', slug: 'centos-8', multiplier: 5, depends: [] }, + { name: 'Debian 8', slug: 'debian-8', multiplier: 6, depends: [] }, + { name: 'Debian 9', slug: 'debian-9', multiplier: 5, depends: [] }, + { name: 'Debian 10', slug: 'debian-10', multiplier: 4, depends: [] }, + { name: 'Fedora 30', slug: 'fedora-30', multiplier: 3, depends: [] }, + { name: 'Opensuse 15.1', slug: 'opensuse-15', multiplier: 2, depends: [] }, { name: 'Ubuntu 16.04', slug: 'ubuntu-1604', multiplier: 1, depends: [] }, { name: 'Ubuntu 18.04', slug: 'ubuntu-1804', multiplier: 0, depends: [] }, ]; @@ -44,12 +44,14 @@ local stable_distros = [ 'debian-8', 'debian-9', 'debian-10', + 'fedora-30', 'ubuntu-1604', 'ubuntu-1804', ]; local py3_distros = [ 'amazon-2', + 'arch', 'centos-7', 'centos-8', 'debian-9', @@ -67,6 +69,7 @@ local py2_blacklist = [ local blacklist_2018 = [ 'centos-8', 'debian-10', + 'amazon-2', ]; local Shellcheck() = { @@ -76,7 +79,7 @@ local Shellcheck() = { steps: [ { name: 'shellcheck', - image: 'koalaman/shellcheck-alpine', + image: 'koalaman/shellcheck-alpine:v0.6.0', commands: [ 'shellcheck -s sh -f checkstyle bootstrap-salt.sh', ], @@ -92,17 +95,37 @@ local Build(distro) = { project: 'open', }, - local suite = - if std.count(py2_blacklist, distro.slug) > 0 then - [] - else if std.count(stable_distros, distro.slug) > 0 then - git_suites + stable_suites - else git_suites, - local suites = suite + if std.count(blacklist_2018, distro.slug) > 0 then - git_py3_suites + stable_py3_suites[1:] - else if std.count(py3_distros, distro.slug) > 0 then - git_py3_suites + stable_py3_suites - else [], + local temp_git_suites = if std.count(py2_blacklist, distro.slug) > 0 then + [] + else + git_suites, + + local temp_stable_suites = if std.count(py2_blacklist, distro.slug) > 0 then + [] + else if std.count(stable_distros, distro.slug) > 0 then + stable_suites + else + [], + + local temp_git_py3_suites = if std.count(py3_distros, distro.slug) < 1 then + [] + else if std.count(blacklist_2018, distro.slug) > 0 then + git_py3_suites[1:] + else if std.count(py3_distros, distro.slug) > 0 then + git_py3_suites + else + [], + + local temp_stable_py3_suites = if std.count(stable_distros, distro.slug) < 1 then + [] + else if std.count(blacklist_2018, distro.slug) > 0 then + stable_py3_suites[1:] + else if std.count(py3_distros, distro.slug) > 0 then + stable_py3_suites + else + [], + + local suites = temp_git_suites + temp_stable_suites + temp_git_py3_suites + temp_stable_py3_suites, steps: [ { @@ -111,7 +134,7 @@ local Build(distro) = { commands: [ std.format( "sh -c 't=%(offset)s; echo Sleeping %(offset)s seconds; sleep %(offset)s'", - { offset: 5 * std.length(suites) * distro.multiplier } + { offset: 6 * std.length(suites) * distro.multiplier } ), ], }, @@ -127,7 +150,7 @@ local Build(distro) = { commands: [ 'bundle install --with docker --without opennebula ec2 windows vagrant', "echo 'Waiting for docker to start'", - 'sleep 10', // give docker enough time to start + 'sleep 20', // give docker enough time to start 'docker ps -a', std.format('bundle exec kitchen create %s', [distro.slug]), ], diff --git a/.drone.yml b/.drone.yml index f7d4ecf..20eddb9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ platform: steps: - name: shellcheck - image: koalaman/shellcheck-alpine + image: koalaman/shellcheck-alpine:v0.6.0 commands: - shellcheck -s sh -f checkstyle bootstrap-salt.sh @@ -31,7 +31,7 @@ steps: commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create arch environment: @@ -65,6 +65,150 @@ steps: - throttle-build - create +- name: Py3 2018.3(Git) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py3-git-2018-3-arch + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +- name: Py3 2019.2(Git) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py3-git-2019-2-arch + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +services: +- name: docker + image: saltstack/drone-salt-bootstrap-testing + command: + - --storage-driver=overlay2 + privileged: true + +node: + project: open + +depends_on: +- Lint + +--- +kind: pipeline +name: Amazon 2 + +platform: + os: linux + arch: amd64 + +steps: +- name: throttle-build + image: alpine + commands: + - sh -c 't=72; echo Sleeping 72 seconds; sleep 72' + +- name: create + image: saltstack/drone-salt-bootstrap-testing + commands: + - bundle install --with docker --without opennebula ec2 windows vagrant + - echo 'Waiting for docker to start' + - sleep 20 + - docker ps -a + - bundle exec kitchen create amazon-2 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + +- name: Py2 2018.3(Git) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py2-git-2018-3-amazon-2 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +- name: Py2 2019.2(Git) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py2-git-2019-2-amazon-2 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +- name: Py2 2018.3(Stable) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py2-stable-2018-3-amazon-2 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +- name: Py2 2019.2(Stable) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py2-stable-2019-2-amazon-2 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +- name: Py3 2019.2(Git) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py3-git-2019-2-amazon-2 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +- name: Py3 2019.2(Stable) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py3-stable-2019-2-amazon-2 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + services: - name: docker image: saltstack/drone-salt-bootstrap-testing @@ -90,14 +234,14 @@ steps: - name: throttle-build image: alpine commands: - - sh -c 't=60; echo Sleeping 60 seconds; sleep 60' + - sh -c 't=72; echo Sleeping 72 seconds; sleep 72' - name: create image: saltstack/drone-salt-bootstrap-testing commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create centos-6 environment: @@ -182,14 +326,14 @@ steps: - name: throttle-build image: alpine commands: - - sh -c 't=160; echo Sleeping 160 seconds; sleep 160' + - sh -c 't=192; echo Sleeping 192 seconds; sleep 192' - name: create image: saltstack/drone-salt-bootstrap-testing commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create centos-7 environment: @@ -333,7 +477,7 @@ steps: commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create centos-8 environment: @@ -341,19 +485,6 @@ steps: depends_on: - throttle-build -- name: Py3 2018.3(Git) - image: saltstack/drone-salt-bootstrap-testing - commands: - - pip install -U pip - - pip install -r tests/requirements.txt - - bundle install --with docker --without opennebula ec2 windows vagrant - - bundle exec kitchen test py3-git-2018-3-centos-8 - environment: - DOCKER_HOST: tcp://docker:2375 - depends_on: - - throttle-build - - create - - name: Py3 2019.2(Git) image: saltstack/drone-salt-bootstrap-testing commands: @@ -405,14 +536,14 @@ steps: - name: throttle-build image: alpine commands: - - sh -c 't=100; echo Sleeping 100 seconds; sleep 100' + - sh -c 't=144; echo Sleeping 144 seconds; sleep 144' - name: create image: saltstack/drone-salt-bootstrap-testing commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create debian-8 environment: @@ -504,7 +635,7 @@ steps: commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create debian-9 environment: @@ -641,14 +772,14 @@ steps: - name: throttle-build image: alpine commands: - - sh -c 't=90; echo Sleeping 90 seconds; sleep 90' + - sh -c 't=48; echo Sleeping 48 seconds; sleep 48' - name: create image: saltstack/drone-salt-bootstrap-testing commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create debian-10 environment: @@ -656,19 +787,6 @@ steps: depends_on: - throttle-build -- name: Py3 2018.3(Git) - image: saltstack/drone-salt-bootstrap-testing - commands: - - pip install -U pip - - pip install -r tests/requirements.txt - - bundle install --with docker --without opennebula ec2 windows vagrant - - bundle exec kitchen test py3-git-2018-3-debian-10 - environment: - DOCKER_HOST: tcp://docker:2375 - depends_on: - - throttle-build - - create - - name: Py3 2019.2(Git) image: saltstack/drone-salt-bootstrap-testing commands: @@ -720,14 +838,14 @@ steps: - name: throttle-build image: alpine commands: - - sh -c 't=180; echo Sleeping 180 seconds; sleep 180' + - sh -c 't=144; echo Sleeping 144 seconds; sleep 144' - name: create image: saltstack/drone-salt-bootstrap-testing commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create fedora-30 environment: @@ -761,6 +879,32 @@ steps: - throttle-build - create +- name: Py2 2018.3(Stable) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py2-stable-2018-3-fedora-30 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + +- name: Py2 2019.2(Stable) + image: saltstack/drone-salt-bootstrap-testing + commands: + - pip install -U pip + - pip install -r tests/requirements.txt + - bundle install --with docker --without opennebula ec2 windows vagrant + - bundle exec kitchen test py2-stable-2019-2-fedora-30 + environment: + DOCKER_HOST: tcp://docker:2375 + depends_on: + - throttle-build + - create + - name: Py3 2018.3(Git) image: saltstack/drone-salt-bootstrap-testing commands: @@ -828,7 +972,7 @@ depends_on: --- kind: pipeline -name: Opensuse 15.0 +name: Opensuse 15.1 platform: os: linux @@ -838,14 +982,14 @@ steps: - name: throttle-build image: alpine commands: - - sh -c 't=40; echo Sleeping 40 seconds; sleep 40' + - sh -c 't=24; echo Sleeping 24 seconds; sleep 24' - name: create image: saltstack/drone-salt-bootstrap-testing commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create opensuse-15 environment: @@ -904,14 +1048,14 @@ steps: - name: throttle-build image: alpine commands: - - sh -c 't=40; echo Sleeping 40 seconds; sleep 40' + - sh -c 't=48; echo Sleeping 48 seconds; sleep 48' - name: create image: saltstack/drone-salt-bootstrap-testing commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create ubuntu-1604 environment: @@ -1055,7 +1199,7 @@ steps: commands: - bundle install --with docker --without opennebula ec2 windows vagrant - echo 'Waiting for docker to start' - - sleep 10 + - sleep 20 - docker ps -a - bundle exec kitchen create ubuntu-1804 environment: @@ -1182,6 +1326,6 @@ depends_on: --- kind: signature -hmac: 906ceab2f0ec44b6e9c99f698feeb4874c503fd9db2a8525ed2916445069c403 +hmac: 9c01a5f3f8d8fe0b09aad2cc73976678a432edf3c81aafdff0d17e52ce4cc7f8 ... diff --git a/.kitchen.yml b/.kitchen.yml index 3fd2af7..3d4db93 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -40,6 +40,8 @@ platforms: image: amazonlinux:2 platform: rhel run_command: /usr/lib/systemd/systemd + provision_command: + - yum -y install procps-ng - name: arch driver_config: image: archlinux/base @@ -81,10 +83,11 @@ platforms: run_command: /usr/lib/systemd/systemd - name: opensuse-15 driver_config: - image: opensuse/leap:15.0 + image: opensuse/leap:15.1 run_command: /usr/lib/systemd/systemd provision_command: - zypper --non-interactive install --auto-agree-with-licenses dbus-1 + - zypper --non-interactive install --auto-agree-with-licenses sudo openssh which curl - systemctl enable sshd.service provisioner: salt_bootstrap_options: -MPfq -y -x python2 git %s @@ -128,6 +131,7 @@ suites: - centos-6 - debian-8 - opensuse-15 + - amazon-2 - name: py3-git-2019-2 provisioner: salt_version: 2019.2 @@ -146,6 +150,7 @@ suites: - centos-6 - debian-8 - opensuse-15 + - amazon-2 - name: py3-stable-2019-2 provisioner: salt_version: 2019.2 diff --git a/AUTHORS.rst b/AUTHORS.rst index 3fc7c87..b3a9322 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -86,6 +86,7 @@ Jorge Schrauwen sjorge sjorge@blackdot.be Juan A. Moyano wincus wincus.public@gmail.com Justin Anderson justinta justin.ta@outlook.com Justin Findlay jfindlay jfindlay@gmail.com + kgbsd Karl Grzeszczak karlgrz Kenneth Wilke KennethWilke Kevin Quinn kevinquinnyo kevin.quinn@totalserversolutions.com diff --git a/ChangeLog b/ChangeLog index dd36fa2..07bc592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Version TBD (In Progress on the Develop Branch): +Version 2020.01.21: + * FreeBSD fixes (kgbsd) #1376 + * Fix macOS support (s0undt3ch) #1397 + Version 2019.11.04: * Fix busybox mktemp compatibility (stanzgy) #1369 * Install debian 10 packages on debian 10 instead of 9 (kiemlicz) #1375 diff --git a/README.rst b/README.rst index 776473c..7a7e0bc 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file. The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is: +- 2019.11.04: ``905924fccd4ebf168d19ba598bf10af53efe02302b792aeb15433e73fd3ad1d2`` - 2019.10.03: ``34f196f06d586ce9e1b9907660ea6e67caf57abcecfea66e0343697e3fd0d17d`` - 2019.05.20: ``46fb5e4b7815efafd69fd703f033fe86e7b584b6770f7e0b936995bcae1cedd8`` - 2019.02.27: ``23728e4b5e54f564062070e3be53c5602b55c24c9a76671968abbf3d609258cb`` @@ -212,9 +213,10 @@ Supported Operating Systems --------------------------- The salt-bootstrap script officially supports the distributions outlined in -`Salt's Supported Operating Systems`_ document. The operating systems listed below should reflect -this document but may become out of date. If an operating system is listed below, but is not -listed on the official supported operating systems document, the level of support is "best-effort". +`Salt's Supported Operating Systems`_ document, except for Solaris and AIX. The operating systems +listed below should reflect this document but may become out of date. If an operating system is +listed below, but is not listed on the official supported operating systems document, the level of +support is "best-effort". Since Salt is written in Python, the packages available from `SaltStack's corporate repository`_ are CPU architecture independent and could be installed on any hardware supported by Linux kernel. @@ -241,7 +243,7 @@ Debian and derivatives ~~~~~~~~~~~~~~~~~~~~~~ - Cumulus Linux 2/3 -- Debian GNU/Linux 7/8/9 +- Debian GNU/Linux 7/8/9/10 - Devuan GNU/Linux 1/2 - Kali Linux 1.0 (based on Debian 7) - Linux Mint Debian Edition 1 (based on Debian 8) @@ -264,11 +266,12 @@ Red Hat family ~~~~~~~~~~~~~~ - Amazon Linux 2012.3 and later -- CentOS 6/7 +- Amazon Linux 2 +- CentOS 6/7/8 - Cloud Linux 6/7 -- Fedora 27/28 (install latest stable from standard repositories) +- Fedora 30/31 (install latest stable from standard repositories) - Oracle Linux 6/7 -- Red Hat Enterprise Linux 6/7 +- Red Hat Enterprise Linux 6/7/8 - Scientific Linux 6/7 @@ -352,7 +355,9 @@ Some distributions support installing Salt to use Python 3 instead of Python 2. this offering, while limited, is as follows: - CentOS 7 +- Centos 8 - Debian 9 +- Debian 10 - Fedora (only git installations) - Ubuntu 16.04 - Ubuntu 18.04 @@ -367,6 +372,18 @@ Installing the Python 3 packages for Salt is done via the ``-x`` option: See the ``-x`` option for more information. +The earliest release of Salt that supports Python3 is `2018.3.4`. + +Tornado 5/6 Workaround +---------------------- +Salt does not support tornado>=5.0 currently. This support will not be added until the neon +release. In order to work around this requirement on OSs that no longer have the tornado 4 package +available in their repositories we are pip installing tornado<5.0 in the bootstrap script. This +requires the user to pass -P to the bootstrap script if installing via git to ensure tornado is pip +installed. If a user does not pass this argument they will be warned that it is required for the +tornado 5 workaround. So far the OSs that are using this workaround are Debian 10, Centos 8 and +Fedora 31. + Testing ------- @@ -421,7 +438,7 @@ Salt components, custom configurations, and even `pre-accepted Minion keys`_ alr .. _`pre-accepted Minion keys`: https://docs.saltstack.com/en/latest/topics/tutorials/preseed_key.html .. _`read the source`: https://github.com/saltstack/salt-bootstrap/blob/develop/bootstrap-salt.sh .. _`Salt`: https://saltstack.com/community/ -.. _`Salt's Supported Operating Systems`: http://saltstack.com/wp-content/uploads/2016/08/SaltStack-Supported-Operating-Systems.pdf +.. _`Salt's Supported Operating Systems`: http://get.saltstack.com/rs/304-PHQ-615/images/SaltStack-Supported-Operating-Systems.pdf .. _`SaltStack's corporate repository`: https://repo.saltstack.com/ .. _`SaltStack's Debian repository`: http://repo.saltstack.com/#debian .. _`SaltStack's Ubuntu repository`: http://repo.saltstack.com/#ubuntu diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 34c8984..cc443b7 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -83,7 +83,7 @@ Param( [Parameter(Mandatory=$false,ValueFromPipeline=$true)] # Doesn't support versions prior to "2017.7.0" [ValidateSet("2","3")] - [string]$pythonVersion = "", + [string]$pythonVersion = "2", [Parameter(Mandatory=$false,ValueFromPipeline=$true)] [ValidateSet("true","false")] @@ -211,38 +211,19 @@ Else { } #=============================================================================== -# Figure out the latest version if no version is passed +# Use version "Latest" if no version is passed #=============================================================================== -# If version isn't supplied, use latest. If (!$version) { - # Find latest version of Salt Minion - $repo = Invoke-Restmethod "$repourl" - $regex = "<\s*a\s*[^>]*?href\s*=\s*[`"']*([^`"'>]+)[^>]*?>" - $returnMatches = New-Object System.Collections.ArrayList - $resultingMatches = [Regex]::Matches($repo, $regex, "IgnoreCase") - foreach($match in $resultingMatches) { - $cleanedMatch = $match.Groups[1].Value.Trim() - [void] $returnMatches.Add($cleanedMatch) - } - If ($arch -eq 'x86') { - $returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*x86-Setup.exe"} - } - Else { - $returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*AMD64-Setup.exe"} - } - - $version = $($returnMatches[$returnMatches.Count -1]).Split(("n-","-A","-x","-P"),([System.StringSplitOptions]::RemoveEmptyEntries))[1] -} - -$versionSection = $version - -$year = $version.Substring(0, 4) -If ([int]$year -ge 2017) { - If ($pythonVersion -eq "3") { - $versionSection = "$version-Py3" - } - Else { - $versionSection = "$version-Py2" + $versionSection = "Latest-Py$pythonVersion" +} else { + $versionSection = $version + $year = $version.Substring(0, 4) + If ([int]$year -ge 2017) { + If ($pythonVersion -eq "3") { + $versionSection = "$version-Py3" + } Else { + $versionSection = "$version-Py2" + } } } @@ -287,6 +268,7 @@ While (!$service) { If($runservice) { # Start service + Write-Output "Starting the Salt minion service" Start-Service -Name "salt-minion" -ErrorAction SilentlyContinue # Check if service is started, otherwise retry starting the diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4e197ab..d111a8c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -23,7 +23,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2019.11.04" +__ScriptVersion="2020.01.21" __ScriptName="bootstrap-salt.sh" __ScriptFullName="$0" @@ -270,6 +270,7 @@ _QUIET_GIT_INSTALLATION=$BS_FALSE _REPO_URL="repo.saltstack.com" _PY_EXE="" _INSTALL_PY="$BS_FALSE" +_TORNADO_MAX_PY3_VERSION="5.0" # Defaults for install arguments ITYPE="stable" @@ -674,7 +675,7 @@ if [ -n "$_PY_EXE" ]; then if [ "$(uname)" = "Darwin" ]; then _PY_PKG_VER=$(echo "$_PY_EXE" | sed "s/\\.//g") else - _PY_PKG_VER=$(echo "$_PY_EXE" | sed -r "s/\\.//g") + _PY_PKG_VER=$(echo "$_PY_EXE" | sed -E "s/\\.//g") fi _PY_MAJOR_VERSION=$(echo "$_PY_PKG_VER" | cut -c 7) @@ -933,11 +934,11 @@ __strip_duplicates() { __sort_release_files() { KNOWN_RELEASE_FILES=$(echo "(arch|alpine|centos|debian|ubuntu|fedora|redhat|suse|\ mandrake|mandriva|gentoo|slackware|turbolinux|unitedlinux|void|lsb|system|\ - oracle|os)(-|_)(release|version)" | sed -r 's:[[:space:]]::g') + oracle|os)(-|_)(release|version)" | sed -E 's:[[:space:]]::g') primary_release_files="" secondary_release_files="" # Sort know VS un-known files first - for release_file in $(echo "${@}" | sed -r 's:[[:space:]]:\n:g' | sort -f | uniq); do + for release_file in $(echo "${@}" | sed -E 's:[[:space:]]:\n:g' | sort -f | uniq); do match=$(echo "$release_file" | grep -E -i "${KNOWN_RELEASE_FILES}") if [ "${match}" != "" ]; then primary_release_files="${primary_release_files} ${release_file}" @@ -962,7 +963,7 @@ __sort_release_files() { done # Echo the results collapsing multiple white-space into a single white-space - echo "${primary_release_files} ${secondary_release_files}" | sed -r 's:[[:space:]]+:\n:g' + echo "${primary_release_files} ${secondary_release_files}" | sed -E 's:[[:space:]]+:\n:g' } @@ -1181,17 +1182,17 @@ __gather_sunos_system_info() { case "$line" in *OpenIndiana*oi_[0-9]*) DISTRO_NAME="OpenIndiana" - DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenIndiana(.*)oi_([[:digit:]]+)(.*)/\\2/p") + DISTRO_VERSION=$(echo "$line" | sed -nE "s/OpenIndiana(.*)oi_([[:digit:]]+)(.*)/\\2/p") break ;; *OpenSolaris*snv_[0-9]*) DISTRO_NAME="OpenSolaris" - DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenSolaris(.*)snv_([[:digit:]]+)(.*)/\\2/p") + DISTRO_VERSION=$(echo "$line" | sed -nE "s/OpenSolaris(.*)snv_([[:digit:]]+)(.*)/\\2/p") break ;; *Oracle*Solaris*[0-9]*) DISTRO_NAME="Oracle Solaris" - DISTRO_VERSION=$(echo "$line" | sed -nr "s/(Oracle Solaris) ([[:digit:]]+)(.*)/\\2/p") + DISTRO_VERSION=$(echo "$line" | sed -nE "s/(Oracle Solaris) ([[:digit:]]+)(.*)/\\2/p") break ;; *Solaris*) @@ -1712,7 +1713,7 @@ echoinfo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}" echo # Simplify distro name naming on functions -DISTRO_NAME_L=$(echo "$DISTRO_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -re 's/([[:space:]])+/_/g') +DISTRO_NAME_L=$(echo "$DISTRO_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -Ee 's/([[:space:]])+/_/g') # Simplify version naming on functions if [ "$DISTRO_VERSION" = "" ] || [ ${_SIMPLIFY_VERSION} -eq $BS_FALSE ]; then @@ -1790,7 +1791,7 @@ elif [ "${DISTRO_NAME_L}" = "debian" ]; then __debian_codename_translation fi -if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|red_hat|oracle|scientific|amazon|fedora)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then +if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|red_hat|oracle|scientific|amazon|fedora|macosx)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then echoerror "${DISTRO_NAME} does not have major version pegged packages support" exit 1 fi @@ -1981,7 +1982,7 @@ __git_clone_and_checkout() { fi case ${OS_NAME_L} in - openbsd|freebsd|netbsd ) + openbsd|freebsd|netbsd|darwin ) __TAG_REGEX_MATCH=$(echo "${GIT_REV}" | sed -E 's/^(v?[0-9]{1,4}\.[0-9]{1,2})(\.[0-9]{1,2})?.*$/MATCH/') ;; * ) @@ -2507,7 +2508,7 @@ __activate_virtualenv() { __install_pip_pkgs() { _pip_pkgs="$1" _py_exe="$2" - _py_pkg=$(echo "$_py_exe" | sed -r "s/\\.//g") + _py_pkg=$(echo "$_py_exe" | sed -E "s/\\.//g") _pip_cmd="${_py_exe} -m pip" if [ "${_py_exe}" = "" ]; then @@ -2911,9 +2912,11 @@ install_ubuntu_git() { fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - ${_PYEXE} setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 + # shellcheck disable=SC2086 + "${_PYEXE}" setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 else - ${_PYEXE} setup.py ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 + # shellcheck disable=SC2086 + "${_PYEXE}" setup.py ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 fi return 0 @@ -3395,9 +3398,11 @@ install_debian_git() { fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - ${_PYEXE} setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 + # shellcheck disable=SC2086 + "${_PYEXE}" setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 else - ${_PYEXE} setup.py ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 + # shellcheck disable=SC2086 + "${_PYEXE}" setup.py ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 fi } @@ -4830,16 +4835,23 @@ install_amazon_linux_ami_2_git_deps() { yum -y install ca-certificates || return 1 fi - PIP_EXE='pip' - if __check_command_exists python2.7; then - if ! __check_command_exists pip2.7; then - __yum_install_noinput python2-pip - fi - PIP_EXE='/bin/pip' - _PY_EXE='python2.7' - fi - install_amazon_linux_ami_2_deps || return 1 + if __check_command_exists python3; then + if ! __check_command_exists pip3; then + __yum_install_noinput python3-pip + fi + PIP_EXE='/bin/pip3' + _PY_EXE='python3' + else + PIP_EXE='pip' + if __check_command_exists python2.7; then + if ! __check_command_exists pip2.7; then + __yum_install_noinput python2-pip + fi + PIP_EXE='/bin/pip' + _PY_EXE='python2.7' + fi + fi if ! __check_command_exists git; then __yum_install_noinput git || return 1 @@ -4850,9 +4862,18 @@ install_amazon_linux_ami_2_git_deps() { __PACKAGES="" __PIP_PACKAGES="" - if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then + if [ "$_INSTALL_CLOUD" -eq "$BS_TRUE" ]; then __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" - __PACKAGES="${__PACKAGES} python27-pip" + if [ "$PARSED_VERSION" -eq "2" ]; then + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq "3" ]; then + __PACKAGES="${__PACKAGES} python3-pip" + __PIP_PACKAGES="${__PIP_PACKAGES} tornado<$_TORNADO_MAX_PY3_VERSION" + else + __PACKAGES="${__PACKAGES} python2-pip" + fi + else + __PACKAGES="${__PACKAGES} python27-pip" + fi __PIP_PACKAGES="${__PIP_PACKAGES} apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -4860,7 +4881,7 @@ install_amazon_linux_ami_2_git_deps() { # We're on the develop branch, install whichever tornado is on the requirements file __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then - __PACKAGES="${__PACKAGES} ${pkg_append}-tornado" + __PACKAGES="${__PACKAGES} ${pkg_append}${PY_PKG_VER}-tornado" fi fi @@ -4917,18 +4938,31 @@ install_amazon_linux_ami_2_deps() { if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then __REPO_FILENAME="saltstack-repo.repo" + __PY_VERSION_REPO="yum" + PY_PKG_VER="" + _PY_MAJOR_VERSION=$(echo "$_PY_PKG_VER" | cut -c 7) + repo_label="saltstack-repo" + repo_name="SaltStack repo for Amazon Linux 2" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + __REPO_FILENAME="saltstack-py3-repo.repo" + __PY_VERSION_REPO="py3" + PY_PKG_VER=3 + repo_label="saltstack-py3-repo" + repo_name="SaltStack Python 3 repo for Amazon Linux 2" + fi - base_url="$HTTP_VAL://${_REPO_URL}/yum/amazon/2/\$basearch/$repo_rev/" - gpg_key="${base_url}SALTSTACK-GPG-KEY.pub - ${base_url}base/RPM-GPG-KEY-CentOS-7" - repo_name="SaltStack repo for Amazon Linux 2.0" + base_url="$HTTP_VAL://${_REPO_URL}/${__PY_VERSION_REPO}/amazon/2/\$basearch/$repo_rev/" + gpg_key="${base_url}SALTSTACK-GPG-KEY.pub,${base_url}base/RPM-GPG-KEY-CentOS-7" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + gpg_key="${base_url}SALTSTACK-GPG-KEY.pub" + fi # This should prob be refactored to use __install_saltstack_rhel_repository() # With args passed in to do the right thing. Reformatted to be more like the # amazon linux yum file. if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then cat <<_eof > "/etc/yum.repos.d/${__REPO_FILENAME}" -[saltstack-repo] +[$repo_label] name=$repo_name failovermethod=priority priority=10 @@ -4942,9 +4976,14 @@ _eof # Package python-ordereddict-1.1-2.el6.noarch is obsoleted by python26-2.6.9-2.88.amzn1.x86_64 # which is already installed - __PACKAGES="m2crypto ${pkg_append}-crypto ${pkg_append}-jinja2 PyYAML procps-ng" - __PACKAGES="${__PACKAGES} ${pkg_append}-msgpack ${pkg_append}-requests ${pkg_append}-zmq" - __PACKAGES="${__PACKAGES} ${pkg_append}-futures" + if [ "${PY_PKG_VER}" -eq 3 ]; then + __PACKAGES="${pkg_append}${PY_PKG_VER}-m2crypto ${pkg_append}${PY_PKG_VER}-pyyaml" + else + __PACKAGES="m2crypto PyYAML ${pkg_append}-futures" + fi + + __PACKAGES="${__PACKAGES} ${pkg_append}${PY_PKG_VER}-crypto ${pkg_append}${PY_PKG_VER}-jinja2 procps-ng" + __PACKAGES="${__PACKAGES} ${pkg_append}${PY_PKG_VER}-msgpack ${pkg_append}${PY_PKG_VER}-requests ${pkg_append}${PY_PKG_VER}-zmq" # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 @@ -5025,6 +5064,12 @@ install_amazon_linux_ami_2_testing_post() { install_centos_testing_post || return 1 return 0 } + +install_amazon_linux_ami_2_check_services() { + install_centos_check_services || return 1 + return 0 +} + # # Ended Amazon Linux AMI Install Functions # @@ -5240,158 +5285,32 @@ install_arch_check_services() { # FreeBSD Install Functions # -__freebsd_get_packagesite() { - if [ "$CPU_ARCH_L" = "amd64" ]; then - BSD_ARCH="x86:64" - elif [ "$CPU_ARCH_L" = "x86_64" ]; then - BSD_ARCH="x86:64" - elif [ "$CPU_ARCH_L" = "i386" ]; then - BSD_ARCH="x86:32" - elif [ "$CPU_ARCH_L" = "i686" ]; then - BSD_ARCH="x86:32" - fi - - # Since the variable might not be set, don't, momentarily treat it as a - # failure - set +o nounset - - # ABI is a std format for identifying release / architecture combos - ABI="freebsd:${DISTRO_MAJOR_VERSION}:${BSD_ARCH}" - _PACKAGESITE="http://pkg.freebsd.org/${ABI}/latest" - # Awkwardly, we want the `${ABI}` to be in conf file without escaping - PKGCONFURL="pkg+http://pkg.freebsd.org/\${ABI}/latest" - SALTPKGCONFURL="http://repo.saltstack.com/freebsd/\${ABI}/" - - # Treat unset variables as errors once more - set -o nounset -} - # Using a separate conf step to head for idempotent install... __configure_freebsd_pkg_details() { - ## pkg.conf is deprecated. - ## We use conf files in /usr/local or /etc instead - mkdir -p /usr/local/etc/pkg/repos/ - mkdir -p /etc/pkg/ - - ## Use new JSON-like format for pkg repo configs - ## check if /etc/pkg/FreeBSD.conf is already in place - if [ ! -f /etc/pkg/FreeBSD.conf ]; then - conf_file=/usr/local/etc/pkg/repos/freebsd.conf - { - echo "FreeBSD:{" - echo " url: \"${PKGCONFURL}\"," - echo " mirror_type: \"srv\"," - echo " signature_type: \"fingerprints\"," - echo " fingerprints: \"/usr/share/keys/pkg\"," - echo " enabled: true" - echo "}" - } > $conf_file - __copyfile $conf_file /etc/pkg/FreeBSD.conf - fi - FROM_FREEBSD="-r FreeBSD" - - ##### Workaround : Waiting for SaltStack Repository to be available for FreeBSD 12 #### - if [ "${DISTRO_MAJOR_VERSION}" -ne 12 ]; then - ## add saltstack freebsd repo - salt_conf_file=/usr/local/etc/pkg/repos/saltstack.conf - { - echo "SaltStack:{" - echo " url: \"${SALTPKGCONFURL}\"," - echo " mirror_type: \"http\"," - echo " enabled: true" - echo " priority: 10" - echo "}" - } > $salt_conf_file - FROM_SALTSTACK="-r SaltStack" - fi - ##### End Workaround : Waiting for SaltStack Repository to be available for FreeBSD 12 #### - - ## ensure future ports builds use pkgng - echo "WITH_PKGNG= yes" >> /etc/make.conf - - /usr/local/sbin/pkg update -f || return 1 + _SALT_ETC_DIR="/usr/local/etc/salt" } -install_freebsd_9_stable_deps() { - _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} - _PKI_DIR=${_SALT_ETC_DIR}/pki - - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then - #make variables available even if pkg already installed - __freebsd_get_packagesite - - if [ ! -x /usr/local/sbin/pkg ]; then - - # install new `pkg` code from its own tarball. - fetch "${_PACKAGESITE}/Latest/pkg.txz" || return 1 - tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static" || return 1 - ./pkg-static add ./pkg.txz || return 1 - /usr/local/sbin/pkg2ng || return 1 - fi - - # Configure the pkg repository using new approach - __configure_freebsd_pkg_details || return 1 - fi - - # Now install swig30 - # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_FREEBSD} -y swig30 || return 1 - - # YAML module is used for generating custom master/minion configs - # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_FREEBSD} -y py27-yaml || return 1 - - if [ "${_EXTRA_PACKAGES}" != "" ]; then - echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" - # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_FREEBSD} -y ${_EXTRA_PACKAGES} || return 1 - fi - - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - pkg upgrade -y || return 1 - fi - - return 0 -} - -install_freebsd_10_stable_deps() { - install_freebsd_9_stable_deps -} - -install_freebsd_11_stable_deps() { - install_freebsd_9_stable_deps -} - -install_freebsd_12_stable_deps() { - install_freebsd_9_stable_deps +install_freebsd_deps() { + __configure_freebsd_pkg_details + pkg install -y pkg } install_freebsd_git_deps() { - install_freebsd_9_stable_deps || return 1 + install_freebsd_stable_deps || return 1 + SALT_DEPENDENCIES=$(/usr/local/sbin/pkg search -R -d py36-salt | grep 'origin:' \ + | tail -n +2 | awk -F\" '{print $2}' | sed 's#.*/py-#py36-#g') # shellcheck disable=SC2086 - SALT_DEPENDENCIES=$(/usr/local/sbin/pkg search ${FROM_FREEBSD} -R -d sysutils/py-salt | grep -i origin | sed -e 's/^[[:space:]]*//' | tail -n +2 | awk -F\" '{print $2}' | tr '\n' ' ') - # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_FREEBSD} -y ${SALT_DEPENDENCIES} || return 1 - # install python meta package - /usr/local/sbin/pkg install -y lang/python || return 1 + /usr/local/sbin/pkg install -y ${SALT_DEPENDENCIES} || return 1 if ! __check_command_exists git; then /usr/local/sbin/pkg install -y git || return 1 fi - /usr/local/sbin/pkg install -y www/py-requests || return 1 + /usr/local/sbin/pkg install -y py36-requests || return 1 __git_clone_and_checkout || return 1 - if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then - # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" - if [ "${__REQUIRED_TORNADO}" != "" ]; then - /usr/local/sbin/pkg install -y www/py-tornado4 || return 1 - fi - fi - echodebug "Adapting paths to FreeBSD" # The list of files was taken from Salt's BSD port Makefile for file in doc/man/salt-key.1 doc/man/salt-cp.1 doc/man/salt-minion.1 \ @@ -5430,34 +5349,12 @@ install_freebsd_git_deps() { return 0 } -install_freebsd_9_stable() { - # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_SALTSTACK} -y sysutils/py-salt || return 1 - return 0 -} - -install_freebsd_10_stable() { - # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1 - return 0 -} - -install_freebsd_11_stable() { +install_freebsd_stable() { # # installing latest version of salt from FreeBSD CURRENT ports repo # # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1 - - return 0 -} - -install_freebsd_12_stable() { -# -# installing latest version of salt from FreeBSD CURRENT ports repo -# - # shellcheck disable=SC2086 - /usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1 + /usr/local/sbin/pkg install -y py36-salt || return 1 return 0 } @@ -5499,7 +5396,7 @@ install_freebsd_git() { return 0 } -install_freebsd_9_stable_post() { +install_freebsd_stable_post() { for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -5509,34 +5406,15 @@ install_freebsd_9_stable_post() { [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - enable_string="salt_${fname}_enable=\"YES\"" + enable_string="salt_${fname}_enable=YES" grep "$enable_string" /etc/rc.conf >/dev/null 2>&1 - [ $? -eq 1 ] && echo "$enable_string" >> /etc/rc.conf + [ $? -eq 1 ] && sysrc $enable_string - if [ $fname = "minion" ] ; then - grep "salt_minion_paths" /etc/rc.conf >/dev/null 2>&1 - [ $? -eq 1 ] && echo "salt_minion_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\"" >> /etc/rc.conf - fi done } -install_freebsd_10_stable_post() { - install_freebsd_9_stable_post -} - -install_freebsd_11_stable_post() { - install_freebsd_9_stable_post -} - -install_freebsd_12_stable_post() { - install_freebsd_9_stable_post -} - install_freebsd_git_post() { - if [ -f $salt_conf_file ]; then - rm -f $salt_conf_file - fi - install_freebsd_9_stable_post || return 1 + install_freebsd_stable_post || return 1 return 0 } @@ -6750,6 +6628,11 @@ install_macosx_stable_deps() { install_macosx_git_deps() { install_macosx_stable_deps || return 1 + if ! echo "$PATH" | grep -q /usr/local/bin; then + echowarn "/usr/local/bin was not found in \$PATH. Adding it for the duration of the script execution." + export PATH=/usr/local/bin:$PATH + fi + __fetch_url "/tmp/get-pip.py" "https://bootstrap.pypa.io/get-pip.py" || return 1 if [ -n "$_PY_EXE" ]; then @@ -6802,14 +6685,18 @@ install_macosx_git() { } install_macosx_stable_post() { - if [ ! -f /etc/paths.d/salt ]; then - print "%s\n" "/opt/salt/bin" "/usr/local/sbin" > /etc/paths.d/salt - fi + if [ ! -f /etc/paths.d/salt ]; then + print "%s\n" "/opt/salt/bin" "/usr/local/sbin" > /etc/paths.d/salt + fi - # shellcheck disable=SC1091 - . /etc/profile + # Don'f fail because of unknown variable on the next step + set +o nounset + # shellcheck disable=SC1091 + . /etc/profile + # Revert nounset to it's previous state + set -o nounset - return 0 + return 0 } install_macosx_git_post() {