Skip to content

Commit 16ead1e

Browse files
authored
Fix installation for RHEL-like distributions (#12)
* Fix installation on CentOS 7 * Fix quiet installation with YUM
1 parent db2445a commit 16ead1e

File tree

3 files changed

+34
-57
lines changed

3 files changed

+34
-57
lines changed

.github/workflows/Tag.yaml

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -49,55 +49,25 @@ jobs:
4949
- name: Wait for CDN refreshment
5050
run: sleep 1m
5151

52-
test-ubuntu-install:
52+
test-install:
5353
needs: wait-for-cdn
54+
strategy:
55+
matrix:
56+
image:
57+
- ubuntu:20.04
58+
- ubuntu:22.04
59+
- centos:7
60+
- amazonlinux:2
5461
container:
55-
image: ubuntu:20.04
62+
image: ${{ matrix.image }}
5663
runs-on: ubuntu-latest
5764
steps:
58-
- name: Install curl
59-
run: |
60-
apt-get update
61-
apt-get install curl -y
62-
63-
- name: Test swiftbox install and upgrade
64-
run: |
65-
sh -c "$(curl -fsSL https://raw.githubusercontent.com/stevapple/swiftbox/master/install.sh)"
66-
swiftbox -v
67-
swiftbox upgrade
68-
69-
- name: Test swiftbox setup
70-
env:
71-
DEBIAN_FRONTEND: noninteractive
72-
DEBCONF_NONINTERACTIVE_SEEN: true
73-
run: swiftbox list
74-
75-
test-centos-install:
76-
needs: wait-for-cdn
77-
container:
78-
image: centos:7
79-
runs-on: ubuntu-latest
80-
steps:
81-
- name: Test swiftbox install and upgrade
65+
- name: Install cURL
66+
if: ${{ startsWith(matrix.image, 'ubuntu:') }}
67+
run: apt-get update && apt-get install curl -y
68+
- name: Test swiftbox install
8269
run: |
8370
sh -c "$(curl -fsSL https://raw.githubusercontent.com/stevapple/swiftbox/master/install.sh)"
8471
swiftbox -v
85-
swiftbox upgrade
86-
87-
- name: Test swiftbox setup
88-
run: swiftbox list
89-
90-
test-amzn-install:
91-
needs: wait-for-cdn
92-
container:
93-
image: amazonlinux:2
94-
runs-on: ubuntu-latest
95-
steps:
96-
- name: Test swiftbox install and upgrade
97-
run: |
98-
sh -c "$(curl -fsSL https://raw.githubusercontent.com/stevapple/swiftbox/master/install.sh)"
99-
swiftbox -v
100-
swiftbox upgrade
101-
102-
- name: Test swiftbox setup
103-
run: swiftbox list
72+
- name: Test swiftbox upgrade
73+
run: swiftbox upgrade

install.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ fi
77

88
if [ -f /etc/os-release ]
99
then
10-
ID=`cat /etc/os-release | grep '^ID=' | sed 's/ID=//g' | sed 's/"//g'`
11-
case $ID in
10+
OS=`cat /etc/os-release | grep '^ID=' | sed 's/ID=//g' | sed 's/"//g'`
11+
case $OS in
1212
ubuntu)
1313
if hash curl 2> /dev/null || ! hash jq 2> /dev/null
1414
then
@@ -17,9 +17,14 @@ then
1717
fi
1818
;;
1919
rhel | centos | amzn)
20+
VERSION=`cat /etc/os-release | grep '^VERSION_ID=' | sed 's/VERSION_ID=//g' | sed 's/"//g'`
2021
if ! hash curl 2> /dev/null || ! hash jq 2> /dev/null || ! hash which 2> /dev/null
2122
then
22-
$SUDO_FLAG yum install curl jq which -q -y
23+
if [ $OS != 'amzn' ] && [ $VERSION -lt 8 ]
24+
then
25+
$SUDO_FLAG yum install epel-release -y &> /dev/null
26+
fi
27+
$SUDO_FLAG yum install curl jq which -y &> /dev/null
2328
fi
2429
;;
2530
*)

swiftbox.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Set environment properties
44

5-
SWIFTBOX_VERSION="0.13.3"
5+
SWIFTBOX_VERSION="0.13.4"
66
SWIFT_DOWNLOAD_SITE="https://download.swift.org"
77

88
if [ `id -u` = 0 ]
@@ -48,14 +48,18 @@ then
4848
SYSTEM_NAME="centos"
4949
if ! hash curl 2> /dev/null || ! hash wget 2> /dev/null || ! hash jq 2> /dev/null
5050
then
51-
$SUDO_FLAG yum install curl wget jq -q -y
51+
if [ $SYSTEM_VERSION -lt 8 ]
52+
then
53+
$SUDO_FLAG yum install epel-release -y &> /dev/null
54+
fi
55+
$SUDO_FLAG yum install curl wget jq -y &> /dev/null
5256
fi
5357
;;
5458
amzn)
5559
SYSTEM_NAME="amazonlinux"
5660
if ! hash curl 2> /dev/null || ! hash wget 2> /dev/null || ! hash jq 2> /dev/null
5761
then
58-
$SUDO_FLAG yum install curl wget jq -y > /dev/null
62+
$SUDO_FLAG yum install curl wget jq -y &> /dev/null
5963
fi
6064
;;
6165
*)
@@ -104,12 +108,6 @@ do
104108
fi
105109
done
106110

107-
## Download Base URL
108-
109-
download-base() {
110-
echo $SWIFT_DOWNLOAD_SITE/$1/$SYSTEM_NAME${SYSTEM_VERSION//./}$ARCH_SUFFIX
111-
}
112-
113111
## Configure the environment
114112

115113
init-env() {
@@ -230,6 +228,10 @@ reinit-env() {
230228

231229
## Parse and check Swift version
232230

231+
download-base() {
232+
echo $SWIFT_DOWNLOAD_SITE/$1/$SYSTEM_NAME${SYSTEM_VERSION//./}$ARCH_SUFFIX
233+
}
234+
233235
format-version() {
234236
if [ ! $1 ]
235237
then

0 commit comments

Comments
 (0)