mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
Improved OS selector
This commit is contained in:
parent
8d4a0127d6
commit
242ac15d5d
1 changed files with 6 additions and 52 deletions
|
@ -37,28 +37,12 @@ if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Check OS type
|
||||
if [ -e '/etc/redhat-release' ]; then
|
||||
type="rhel"
|
||||
fi
|
||||
|
||||
if [ "$(lsb_release -si)" == "Ubuntu" ] && [ -e '/etc/debian_version' ]; then
|
||||
type="ubuntu"
|
||||
fi
|
||||
|
||||
if [ -z "$type" ]; then
|
||||
os=$(head -n1 /etc/issue | cut -f 1 -d ' ')
|
||||
if [ "$os" == 'Debian' ]; then
|
||||
type="debian"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check type
|
||||
if [ -z "$type" ]; then
|
||||
echo 'Error: only RHEL,CentOS, Ubuntu LTS and Debian 7 is supported'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Detect OS
|
||||
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
|
||||
Debian) type="debian" ;;
|
||||
Ubuntu) type="ubuntu" ;;
|
||||
*) type="rhel" ;;
|
||||
esac
|
||||
|
||||
# Check wget
|
||||
if [ -e '/usr/bin/wget' ]; then
|
||||
|
@ -84,34 +68,4 @@ if [ -e '/usr/bin/curl' ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Let's try to install wget automaticaly
|
||||
if [ "$type" = 'rhel' ]; then
|
||||
yum -y install wget
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: can't install wget"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
apt-get -y install wget
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: can't install wget"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# OK, last try
|
||||
if [ -e '/usr/bin/wget' ]; then
|
||||
wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
|
||||
if [ "$?" -eq '0' ]; then
|
||||
bash vst-install-$type.sh $*
|
||||
exit
|
||||
else
|
||||
echo "Error: vst-install-$type.sh download failed."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: /usr/bin/wget not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue