added os detection
This commit is contained in:
parent
fcf5e9ac65
commit
549b105bd6
32
installer.sh
32
installer.sh
|
@ -2,23 +2,33 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Install Ruby and the Ruby dependency 'webrick'
|
# Detect the operating system
|
||||||
if ! command -v ruby &> /dev/null; then
|
OS=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
|
||||||
echo "Installing Ruby..."
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y ruby-full
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# 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
|
if ! gem list webrick -i > /dev/null; then
|
||||||
echo "Installing webrick..."
|
echo "Installing webrick..."
|
||||||
gem install webrick
|
gem install webrick
|
||||||
fi
|
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..."
|
echo "Enabling Nginx service..."
|
||||||
sudo systemctl enable nginx
|
sudo systemctl enable nginx
|
||||||
|
|
Loading…
Reference in New Issue