Skip to content

Commit

Permalink
Fix installation for RHEL-like distributions (#12)
Browse files Browse the repository at this point in the history
* Fix installation on CentOS 7
* Fix quiet installation with YUM
  • Loading branch information
stevapple committed Apr 3, 2023
1 parent db2445a commit 16ead1e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 57 deletions.
60 changes: 15 additions & 45 deletions .github/workflows/Tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,55 +49,25 @@ jobs:
- name: Wait for CDN refreshment
run: sleep 1m

test-ubuntu-install:
test-install:
needs: wait-for-cdn
strategy:
matrix:
image:
- ubuntu:20.04
- ubuntu:22.04
- centos:7
- amazonlinux:2
container:
image: ubuntu:20.04
image: ${{ matrix.image }}
runs-on: ubuntu-latest
steps:
- name: Install curl
run: |
apt-get update
apt-get install curl -y
- name: Test swiftbox install and upgrade
run: |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/stevapple/swiftbox/master/install.sh)"
swiftbox -v
swiftbox upgrade
- name: Test swiftbox setup
env:
DEBIAN_FRONTEND: noninteractive
DEBCONF_NONINTERACTIVE_SEEN: true
run: swiftbox list

test-centos-install:
needs: wait-for-cdn
container:
image: centos:7
runs-on: ubuntu-latest
steps:
- name: Test swiftbox install and upgrade
- name: Install cURL
if: ${{ startsWith(matrix.image, 'ubuntu:') }}
run: apt-get update && apt-get install curl -y
- name: Test swiftbox install
run: |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/stevapple/swiftbox/master/install.sh)"
swiftbox -v
swiftbox upgrade
- name: Test swiftbox setup
run: swiftbox list

test-amzn-install:
needs: wait-for-cdn
container:
image: amazonlinux:2
runs-on: ubuntu-latest
steps:
- name: Test swiftbox install and upgrade
run: |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/stevapple/swiftbox/master/install.sh)"
swiftbox -v
swiftbox upgrade
- name: Test swiftbox setup
run: swiftbox list
- name: Test swiftbox upgrade
run: swiftbox upgrade
11 changes: 8 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ fi

if [ -f /etc/os-release ]
then
ID=`cat /etc/os-release | grep '^ID=' | sed 's/ID=//g' | sed 's/"//g'`
case $ID in
OS=`cat /etc/os-release | grep '^ID=' | sed 's/ID=//g' | sed 's/"//g'`
case $OS in
ubuntu)
if hash curl 2> /dev/null || ! hash jq 2> /dev/null
then
Expand All @@ -17,9 +17,14 @@ then
fi
;;
rhel | centos | amzn)
VERSION=`cat /etc/os-release | grep '^VERSION_ID=' | sed 's/VERSION_ID=//g' | sed 's/"//g'`
if ! hash curl 2> /dev/null || ! hash jq 2> /dev/null || ! hash which 2> /dev/null
then
$SUDO_FLAG yum install curl jq which -q -y
if [ $OS != 'amzn' ] && [ $VERSION -lt 8 ]
then
$SUDO_FLAG yum install epel-release -y &> /dev/null
fi
$SUDO_FLAG yum install curl jq which -y &> /dev/null
fi
;;
*)
Expand Down
20 changes: 11 additions & 9 deletions swiftbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Set environment properties

SWIFTBOX_VERSION="0.13.3"
SWIFTBOX_VERSION="0.13.4"
SWIFT_DOWNLOAD_SITE="https://download.swift.org"

if [ `id -u` = 0 ]
Expand Down Expand Up @@ -48,14 +48,18 @@ then
SYSTEM_NAME="centos"
if ! hash curl 2> /dev/null || ! hash wget 2> /dev/null || ! hash jq 2> /dev/null
then
$SUDO_FLAG yum install curl wget jq -q -y
if [ $SYSTEM_VERSION -lt 8 ]
then
$SUDO_FLAG yum install epel-release -y &> /dev/null
fi
$SUDO_FLAG yum install curl wget jq -y &> /dev/null
fi
;;
amzn)
SYSTEM_NAME="amazonlinux"
if ! hash curl 2> /dev/null || ! hash wget 2> /dev/null || ! hash jq 2> /dev/null
then
$SUDO_FLAG yum install curl wget jq -y > /dev/null
$SUDO_FLAG yum install curl wget jq -y &> /dev/null
fi
;;
*)
Expand Down Expand Up @@ -104,12 +108,6 @@ do
fi
done

## Download Base URL

download-base() {
echo $SWIFT_DOWNLOAD_SITE/$1/$SYSTEM_NAME${SYSTEM_VERSION//./}$ARCH_SUFFIX
}

## Configure the environment

init-env() {
Expand Down Expand Up @@ -230,6 +228,10 @@ reinit-env() {

## Parse and check Swift version

download-base() {
echo $SWIFT_DOWNLOAD_SITE/$1/$SYSTEM_NAME${SYSTEM_VERSION//./}$ARCH_SUFFIX
}

format-version() {
if [ ! $1 ]
then
Expand Down

0 comments on commit 16ead1e

Please sign in to comment.