Skip to content

Commit

Permalink
update rpm scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusPaz committed Jan 10, 2024
1 parent 6f5c1ed commit 176a6b4
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 30 deletions.
32 changes: 27 additions & 5 deletions scripts/rpm/script_generator/base_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release
handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system."
fi

log "Cleaning up old repositories..." "info"
rm -f /etc/yum.repos.d/nodesource*.repo
log "Old repositories removed" "info"

# Define Node.js version
NODE_VERSION="XX.x"

Expand All @@ -48,8 +52,8 @@ case "$SYS_ARCH" in
*) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;;
esac

# Repository content
REPO_CONTENT="[nodesource-nodejs]
# Repository content for Node.js
NODEJS_REPO_CONTENT="[nodesource-nodejs]
name=Node.js Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH
priority=9
Expand All @@ -58,18 +62,36 @@ gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null
# Write Node.js repository content
echo "$NODEJS_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodejs.repo > /dev/null

# Check if Node.js version is an LTS version
if [[ "$NODE_VERSION" == "18.x" ]] || [[ "$NODE_VERSION" == "20.x" ]]; then
# Repository content for N|Solid
NSOLID_REPO_CONTENT="[nodesource-nsolid]
name=N|Solid Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nsolid/$SYS_ARCH
priority=9
enabled=1
gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

# Write N|Solid repository content
echo "$NSOLID_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nsolid.repo > /dev/null
log "Added N|Solid repository for LTS version: $NODE_VERSION" "info"
fi

# Check for availability of dnf or yum
if command_exists dnf; then
log "dnf available, updating..." "info"
dnf update -y
log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'dnf install nodejs -y' or 'dnf install nsolid -y' to complete the installation." "info"
exit 0
elif command_exists yum; then
log "yum available, updating..." "info"
yum update -y
log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'yum install nodejs -y' or 'yum install nsolid -y' to complete the installation." "info"
else
handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager."
fi
32 changes: 27 additions & 5 deletions scripts/rpm/setup_18.x
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release
handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system."
fi

log "Cleaning up old repositories..." "info"
rm -f /etc/yum.repos.d/nodesource*.repo
log "Old repositories removed" "info"

# Define Node.js version
NODE_VERSION="18.x"

Expand All @@ -48,8 +52,8 @@ case "$SYS_ARCH" in
*) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;;
esac

# Repository content
REPO_CONTENT="[nodesource-nodejs]
# Repository content for Node.js
NODEJS_REPO_CONTENT="[nodesource-nodejs]
name=Node.js Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH
priority=9
Expand All @@ -58,18 +62,36 @@ gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null
# Write Node.js repository content
echo "$NODEJS_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodejs.repo > /dev/null

# Check if Node.js version is an LTS version
if [[ "$NODE_VERSION" == "18.x" ]] || [[ "$NODE_VERSION" == "20.x" ]]; then
# Repository content for N|Solid
NSOLID_REPO_CONTENT="[nodesource-nsolid]
name=N|Solid Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nsolid/$SYS_ARCH
priority=9
enabled=1
gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

# Write N|Solid repository content
echo "$NSOLID_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nsolid.repo > /dev/null
log "Added N|Solid repository for LTS version: $NODE_VERSION" "info"
fi

# Check for availability of dnf or yum
if command_exists dnf; then
log "dnf available, updating..." "info"
dnf update -y
log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'dnf install nodejs -y' or 'dnf install nsolid -y' to complete the installation." "info"
exit 0
elif command_exists yum; then
log "yum available, updating..." "info"
yum update -y
log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'yum install nodejs -y' or 'yum install nsolid -y' to complete the installation." "info"
else
handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager."
fi
32 changes: 27 additions & 5 deletions scripts/rpm/setup_20.x
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release
handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system."
fi

log "Cleaning up old repositories..." "info"
rm -f /etc/yum.repos.d/nodesource*.repo
log "Old repositories removed" "info"

# Define Node.js version
NODE_VERSION="20.x"

Expand All @@ -48,8 +52,8 @@ case "$SYS_ARCH" in
*) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;;
esac

# Repository content
REPO_CONTENT="[nodesource-nodejs]
# Repository content for Node.js
NODEJS_REPO_CONTENT="[nodesource-nodejs]
name=Node.js Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH
priority=9
Expand All @@ -58,18 +62,36 @@ gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null
# Write Node.js repository content
echo "$NODEJS_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodejs.repo > /dev/null

# Check if Node.js version is an LTS version
if [[ "$NODE_VERSION" == "18.x" ]] || [[ "$NODE_VERSION" == "20.x" ]]; then
# Repository content for N|Solid
NSOLID_REPO_CONTENT="[nodesource-nsolid]
name=N|Solid Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nsolid/$SYS_ARCH
priority=9
enabled=1
gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

# Write N|Solid repository content
echo "$NSOLID_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nsolid.repo > /dev/null
log "Added N|Solid repository for LTS version: $NODE_VERSION" "info"
fi

# Check for availability of dnf or yum
if command_exists dnf; then
log "dnf available, updating..." "info"
dnf update -y
log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'dnf install nodejs -y' or 'dnf install nsolid -y' to complete the installation." "info"
exit 0
elif command_exists yum; then
log "yum available, updating..." "info"
yum update -y
log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'yum install nodejs -y' or 'yum install nsolid -y' to complete the installation." "info"
else
handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager."
fi
32 changes: 27 additions & 5 deletions scripts/rpm/setup_21.x
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release
handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system."
fi

log "Cleaning up old repositories..." "info"
rm -f /etc/yum.repos.d/nodesource*.repo
log "Old repositories removed" "info"

# Define Node.js version
NODE_VERSION="21.x"

Expand All @@ -48,8 +52,8 @@ case "$SYS_ARCH" in
*) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;;
esac

# Repository content
REPO_CONTENT="[nodesource-nodejs]
# Repository content for Node.js
NODEJS_REPO_CONTENT="[nodesource-nodejs]
name=Node.js Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH
priority=9
Expand All @@ -58,18 +62,36 @@ gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null
# Write Node.js repository content
echo "$NODEJS_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodejs.repo > /dev/null

# Check if Node.js version is an LTS version
if [[ "$NODE_VERSION" == "18.x" ]] || [[ "$NODE_VERSION" == "20.x" ]]; then
# Repository content for N|Solid
NSOLID_REPO_CONTENT="[nodesource-nsolid]
name=N|Solid Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nsolid/$SYS_ARCH
priority=9
enabled=1
gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

# Write N|Solid repository content
echo "$NSOLID_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nsolid.repo > /dev/null
log "Added N|Solid repository for LTS version: $NODE_VERSION" "info"
fi

# Check for availability of dnf or yum
if command_exists dnf; then
log "dnf available, updating..." "info"
dnf update -y
log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'dnf install nodejs -y' or 'dnf install nsolid -y' to complete the installation." "info"
exit 0
elif command_exists yum; then
log "yum available, updating..." "info"
yum update -y
log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'yum install nodejs -y' or 'yum install nsolid -y' to complete the installation." "info"
else
handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager."
fi
32 changes: 27 additions & 5 deletions scripts/rpm/setup_current.x
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release
handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system."
fi

log "Cleaning up old repositories..." "info"
rm -f /etc/yum.repos.d/nodesource*.repo
log "Old repositories removed" "info"

# Define Node.js version
NODE_VERSION="21.x"

Expand All @@ -48,8 +52,8 @@ case "$SYS_ARCH" in
*) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;;
esac

# Repository content
REPO_CONTENT="[nodesource-nodejs]
# Repository content for Node.js
NODEJS_REPO_CONTENT="[nodesource-nodejs]
name=Node.js Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH
priority=9
Expand All @@ -58,18 +62,36 @@ gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null
# Write Node.js repository content
echo "$NODEJS_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodejs.repo > /dev/null

# Check if Node.js version is an LTS version
if [[ "$NODE_VERSION" == "18.x" ]] || [[ "$NODE_VERSION" == "20.x" ]]; then
# Repository content for N|Solid
NSOLID_REPO_CONTENT="[nodesource-nsolid]
name=N|Solid Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nsolid/$SYS_ARCH
priority=9
enabled=1
gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

# Write N|Solid repository content
echo "$NSOLID_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nsolid.repo > /dev/null
log "Added N|Solid repository for LTS version: $NODE_VERSION" "info"
fi

# Check for availability of dnf or yum
if command_exists dnf; then
log "dnf available, updating..." "info"
dnf update -y
log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'dnf install nodejs -y' or 'dnf install nsolid -y' to complete the installation." "info"
exit 0
elif command_exists yum; then
log "yum available, updating..." "info"
yum update -y
log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'yum install nodejs -y' or 'yum install nsolid -y' to complete the installation." "info"
else
handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager."
fi
32 changes: 27 additions & 5 deletions scripts/rpm/setup_lts.x
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release
handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system."
fi

log "Cleaning up old repositories..." "info"
rm -f /etc/yum.repos.d/nodesource*.repo
log "Old repositories removed" "info"

# Define Node.js version
NODE_VERSION="20.x"

Expand All @@ -48,8 +52,8 @@ case "$SYS_ARCH" in
*) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;;
esac

# Repository content
REPO_CONTENT="[nodesource-nodejs]
# Repository content for Node.js
NODEJS_REPO_CONTENT="[nodesource-nodejs]
name=Node.js Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH
priority=9
Expand All @@ -58,18 +62,36 @@ gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null
# Write Node.js repository content
echo "$NODEJS_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodejs.repo > /dev/null

# Check if Node.js version is an LTS version
if [[ "$NODE_VERSION" == "18.x" ]] || [[ "$NODE_VERSION" == "20.x" ]]; then
# Repository content for N|Solid
NSOLID_REPO_CONTENT="[nodesource-nsolid]
name=N|Solid Packages for Linux RPM based distros - $SYS_ARCH
baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nsolid/$SYS_ARCH
priority=9
enabled=1
gpgcheck=1
gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key
module_hotfixes=1"

# Write N|Solid repository content
echo "$NSOLID_REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nsolid.repo > /dev/null
log "Added N|Solid repository for LTS version: $NODE_VERSION" "info"
fi

# Check for availability of dnf or yum
if command_exists dnf; then
log "dnf available, updating..." "info"
dnf update -y
log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'dnf install nodejs -y' or 'dnf install nsolid -y' to complete the installation." "info"
exit 0
elif command_exists yum; then
log "yum available, updating..." "info"
yum update -y
log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info"
log "Repositories are configured and updated. Run 'yum install nodejs -y' or 'yum install nsolid -y' to complete the installation." "info"
else
handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager."
fi

0 comments on commit 176a6b4

Please sign in to comment.