Comprehensive Installer Update

This commit introduces several significant changes to the install script to improve its robustness and compatibility with the project's requirements.

Key changes include:

    Updated the Ruby and Bundler versions in the installation steps from 3.0.5 and 2.4.6 respectively to 3.2.2 and 2.4.17 to match the versions used in the project.

    Added a step to create necessary directories if they do not exist. This ensures that the script can run successfully even if the directories are not pre-existing.

    Moved the step to set permissions to after the directory creation. This change is crucial to prevent potential bundle install failure due to lack of write permissions.

    Changed the order of operations to set permissions before cloning the repository. This ensures that the user has the necessary permissions for the subsequent operations.

    Updated the repository URL in the git clone command to match the current project repository.

    Changed the command to start the program for the first time from ruby starter.rb to ./rub2 to reflect the current method of starting the program.

These changes collectively enhance the user experience by ensuring a smoother installation process and better alignment with the project's current setup and requirements.

Signed-off-by: VetheonGames <76892542+VetheonGames@users.noreply.github.com>
This commit is contained in:
VetheonGames 2023-07-29 13:39:35 -06:00 committed by GitHub
parent 19feb229c3
commit 9d3b6993be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,57 +5,60 @@ distro=$(lsb_release -si)
# Check if Ruby 3.0.5 and Bundler 2.4.6 are installed # Check if Ruby 3.0.5 and Bundler 2.4.6 are installed
if [ "$distro" == "Ubuntu" ]; then if [ "$distro" == "Ubuntu" ]; then
if ! dpkg -s ruby-full | grep -q "Version: 3.0.5"; then if ! dpkg -s ruby-full | grep -q "Version: 3.2.2"; then
# Install rbenv and use it to install Ruby 3.0.5 and Bundler 2.4.6 # Install rbenv and use it to install Ruby 3.0.5 and Bundler 2.4.6
if [[ $(id -u) -ne 0 ]]; then if [[ $(id -u) -ne 0 ]]; then
echo "Please enter your password to install rbenv, Ruby 3.0.5, Bundler 2.4.6, and the Ruby development kit" echo "Please enter your password to install rbenv, Ruby 3.2.1, Bundler 2.4.17, and the Ruby development kit"
exec sudo "$0" "$@" exec sudo "$0" "$@"
fi fi
apt update apt update
apt install -y rbenv ruby-dev apt install -y rbenv ruby-dev
rbenv init rbenv init
rbenv install 3.0.5 rbenv install 3.2.2
rbenv global 3.0.5 rbenv global 3.2.2
gem install bundler -v 2.4.6 gem install bundler -v 2.4.17
gem install rake rdoc gem install rake rdoc
fi fi
elif [ "$distro" == "CentOS" ]; then elif [ "$distro" == "CentOS" ]; then
if ! rpm -q ruby | grep -q "3.0.5"; then if ! rpm -q ruby | grep -q "3.2.2"; then
# Install rbenv and use it to install Ruby 3.0.5 and Bundler 2.4.6 # Install rbenv and use it to install Ruby 3.2.2 and Bundler 2.4.17
if [[ $(id -u) -ne 0 ]]; then if [[ $(id -u) -ne 0 ]]; then
echo "Please enter your password to install rbenv, Ruby 3.0.5, Bundler 2.4.6, and the Ruby development kit" echo "Please enter your password to install rbenv, Ruby 3.2.2, Bundler 2.4.17, and the Ruby development kit"
exec sudo "$0" "$@" exec sudo "$0" "$@"
fi fi
yum install -y epel-release yum install -y epel-release
yum install -y rbenv ruby-devel yum install -y rbenv ruby-devel
rbenv init rbenv init
rbenv install 3.0.5 rbenv install 3.2.2
rbenv global 3.0.5 rbenv global 3.2.2
gem install bundler -v 2.4.6 gem install bundler -v 2.4.17
gem install rake rdoc gem install rake rdoc
fi fi
fi fi
# Clone the repository # Create directories if they don't exist
if [[ $(id -u) -ne 0 ]]; then if [[ $(id -u) -ne 0 ]]; then
echo "Please enter your password to clone the repository" echo "Please enter your password to create necessary directories"
exec sudo "$0" "$@" exec sudo "$0" "$@"
fi fi
sudo git clone https://github.com/Pixelated-Studios/Ru-b2-SQL-Backups.git /usr/bin/PixelatedStudios/Ruby/ sudo mkdir -p /usr/bin/PixelRidge-Softworks/Ruby/
# Install required gems
cd /usr/bin/PixelatedStudios/Ruby/Ru-b2-SQL-Backups
bundle install
# Give execute permissions to the user # Give execute permissions to the user
sudo chown -R $(whoami):$(whoami) /usr/bin/PixelatedStudios/Ruby/ sudo chown -R $(whoami):$(whoami) /usr/bin/PixelRidge-Softworks/Ruby/
sudo chmod -R +x /usr/bin/PixelatedStudios/Ruby/ sudo chmod -R +x /usr/bin/PixelRidge-Softworks/Ruby/
# Clone the repository
sudo git clone https://github.com/PixelRidge-Softworks/Ru-b2-SQL-Backups.git /usr/bin/PixelRidge-Softworks/Ruby/
# Install required gems
cd /usr/bin/PixelRidge-Softworks/Ruby/Ru-b2-SQL-Backups
bundle install
# Prompt user to run the program for the first time # Prompt user to run the program for the first time
read -p "Do you want to run the program for the first time? (y/n) " answer read -p "Do you want to run the program for the first time? (y/n) " answer
if [[ $answer =~ ^[Yy]$ ]]; then if [[ $answer =~ ^[Yy]$ ]]; then
cd /usr/bin/PixelatedStudios/Ruby/Ru-b2-SQL-Backups cd /usr/bin/PixelRidge-Softworks/Ruby/Ru-b2-SQL-Backups
ruby starter.rb ./rub2
else else
exit 0 exit 0
fi fi