package based setup script updated as per CentOS Stream9
@@ -15,41 +15,42 @@ PACKAGE_BUILD_VERSION=$1
[[ -z "${PACKAGE_BUILD_VERSION}" ]] && echo "Build Version not found." && exit 1
-OS_NAME=`(grep -o '^NAME=.*' /etc/os-release | cut -f2 -d\" | sed 's/"//g')`
+OS_NAME=$(grep -o '^NAME=.*' /etc/os-release | cut -f2 -d\" | sed 's/"//g')
ID=$(cat /etc/os-release | grep -w ID | cut -f2 -d"=" | tr -d '"')
-UNAME=`uname -m`
+UNAME=$(uname -m)
VERSION_ID=$(cat /etc/os-release | grep -w VERSION_ID | cut -f2 -d"=" | tr -d '"')
-echo "version id is "${VERSION_ID}
+echo "Version ID is ${VERSION_ID}"
if [[ ${OS_NAME} == *"Red Hat"* || ${OS_NAME} == *"CentOS"* ]]; then
- ID="${ID}7"
- echo "Build version is "${PACKAGE_BUILD_VERSION}
- echo "ID is "${ID}
- echo "uname is "${UNAME}
+ if [[ ${VERSION_ID} -eq "7" ]]; then ARCHIVE_PKG_OS="${ID}7"; else ARCHIVE_PKG_OS="${ID}-stream-9"; fi
+
+ echo "Build version is ${PACKAGE_BUILD_VERSION}"
+ echo "ID is ${ID} and Archive package OS is ${ARCHIVE_PKG_OS}"
+ echo "Uname is ${UNAME}"
sudo cp -f /etc/yum.repos.d/fledge.repo /etc/yum.repos.d/fledge.repo.bak | true
- sudo yum update -y
- echo "==================== DONE update, upgrade ============================"
# Configure Fledge repo
echo -e "[fledge]\n\
name=fledge Repository\n\
-baseurl=http://archives.fledge-iot.org/${PACKAGE_BUILD_VERSION}/${ID}/${UNAME}/\n\
+baseurl=http://archives.fledge-iot.org/${PACKAGE_BUILD_VERSION}/${ARCHIVE_PKG_OS}/${UNAME}/\n\
enabled=1\n\
gpgkey=http://archives.fledge-iot.org/RPM-GPG-KEY-fledge\n\
gpgcheck=1" | sudo tee /etc/yum.repos.d/fledge.repo
- sudo yum update -y
-
# Install prerequisites
if [[ ${ID} = "centos" ]]; then
+ if [[ ${VERSION_ID} -eq "7" ]]; then
sudo yum install -y centos-release-scl-rh
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+ fi
elif [[ ${ID} = "rhel" ]]; then
sudo yum-config-manager --enable 'Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server from RHUI'
fi
- sudo yum update -y
+
+ sudo yum -y check-update && sudo yum -y update
+ echo "==================== DONE check-update, update ============================"
time sudo yum install -y fledge
echo "==================== DONE INSTALLING Fledge =================="
