added os detection
This commit is contained in:
parent
fcf5e9ac65
commit
549b105bd6
32
installer.sh
32
installer.sh
|
@ -2,23 +2,33 @@
|
|||
|
||||
set -e
|
||||
|
||||
# Install Ruby and the Ruby dependency 'webrick'
|
||||
if ! command -v ruby &> /dev/null; then
|
||||
echo "Installing Ruby..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ruby-full
|
||||
fi
|
||||
# Detect the operating system
|
||||
OS=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
|
||||
|
||||
# Install Ruby, Nginx, and Git
|
||||
case $OS in
|
||||
"CentOS Linux"|"Fedora")
|
||||
sudo yum install -y ruby nginx git
|
||||
;;
|
||||
"Arch Linux")
|
||||
sudo pacman -Syu --noconfirm ruby nginx git
|
||||
;;
|
||||
"Debian GNU/Linux"|"Ubuntu"|"Raspbian GNU/Linux")
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ruby nginx git
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported operating system: $OS"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Install the 'webrick' gem
|
||||
if ! gem list webrick -i > /dev/null; then
|
||||
echo "Installing webrick..."
|
||||
gem install webrick
|
||||
fi
|
||||
|
||||
# Install Nginx and enable the service
|
||||
if ! command -v nginx &> /dev/null; then
|
||||
echo "Installing Nginx..."
|
||||
sudo apt-get install -y nginx
|
||||
fi
|
||||
|
||||
echo "Enabling Nginx service..."
|
||||
sudo systemctl enable nginx
|
||||
|
|
Loading…
Reference in New Issue