Files
CyberPanel/install.sh
Bogdan Ilisei 4c330eda9d Rewriting install.sh
Putting some make-up on the install.sh script"

- This relies on the `/etc/os-release` file which is present on all modern distributions that you are currently supporting. More info on: https://www.freedesktop.org/software/systemd/man/os-release.html
- I've taken the liberty of including a warning message for CentOS 8 / CloudLinux 8
- I've also derived `SERVER_OS` from the proper strings. I suggest you end up using a variable directly from `/etc/os-release` instead, tough, as it's just extra-fluff right now, and it seems you are using it just for statistics purposes
- I have also switched to using `printf >&2`  to output the messages to `stderr` instead of `stdout` because they are technically warnings
2020-03-04 14:06:49 +02:00

39 lines
1.2 KiB
Bash

#!/bin/sh
if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
ID="unsupported"
PRETTY_NAME="Your OS does not have a /etc/os-release file"
fi
if [ "$ID" = "ubuntu" ] && [ "$UBUNTU_CODENAME" = "bionic" ]; then
export DEBIAN_FRONTEND=noninteractive
apt -q -y -o Dpkg::Options::=--force-confnew update
apt -q -y -o Dpkg::Options::=--force-confnew install wget curl
SERVER_OS="$NAME"
elif [ "$ID" = "centos" ] || [ "$ID" = "cloudlinux" ]; then
case "$VERSION_ID" in
7|7.*)
yum install curl wget -y 1> /dev/null
yum update curl wget ca-certificates -y 1> /dev/null
SERVER_OS="$NAME"
;;
8|8.*)
printf >&2 '\nCentOS 8/CloudLinux 8 support is currently experimental!\n'
yum install curl wget -y 1> /dev/null
yum update curl wget ca-certificates -y 1> /dev/null
SERVER_OS="${NAME}${VERSION_ID}"
;;
esac
else
printf >&2 '\nYour OS -- %s -- is not currently supported!\n' "$PRETTY_NAME"
printf >&2 '\nCyberPanel is currently supported on Ubuntu 18.04, CentOS 7 and CloudLinux 7.\n'
exit 1
fi
rm -f cyberpanel.sh install.tar.gz
curl --silent -o cyberpanel.sh "https://cyberpanel.sh/?dl&${SERVER_OS}" 2>/dev/null
chmod +x cyberpanel.sh
./cyberpanel.sh "$@"