mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 13:24:25 -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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check OS type
|
# Detect OS
|
||||||
if [ -e '/etc/redhat-release' ]; then
|
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
|
||||||
type="rhel"
|
Debian) type="debian" ;;
|
||||||
fi
|
Ubuntu) type="ubuntu" ;;
|
||||||
|
*) type="rhel" ;;
|
||||||
if [ "$(lsb_release -si)" == "Ubuntu" ] && [ -e '/etc/debian_version' ]; then
|
esac
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
# Check wget
|
# Check wget
|
||||||
if [ -e '/usr/bin/wget' ]; then
|
if [ -e '/usr/bin/wget' ]; then
|
||||||
|
@ -84,34 +68,4 @@ if [ -e '/usr/bin/curl' ]; then
|
||||||
fi
|
fi
|
||||||
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
|
exit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue