mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-21 04:50:10 -08:00
85 lines
2.0 KiB
Bash
Executable File
85 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# myVesta installation wrapper
|
|
# http://myvestacp.com
|
|
|
|
#
|
|
# Currently Supported Operating Systems:
|
|
# Debian 8, 9, 10
|
|
#
|
|
|
|
# Am I root?
|
|
if [ "x$(id -u)" != 'x0' ]; then
|
|
echo 'Error: this script can only be executed by root'
|
|
exit 1
|
|
fi
|
|
|
|
# Check admin user account
|
|
if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ -z "$1" ]; then
|
|
echo "Error: user admin exists"
|
|
echo
|
|
echo 'Please remove admin user before proceeding.'
|
|
echo 'If you want to do it automatically run installer with -f option:'
|
|
echo "Example: bash $0 --force"
|
|
exit 1
|
|
fi
|
|
|
|
# Check admin group
|
|
if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
|
|
echo "Error: group admin exists"
|
|
echo
|
|
echo 'Please remove admin group before proceeding.'
|
|
echo 'If you want to do it automatically run installer with -f option:'
|
|
echo "Example: bash $0 --force"
|
|
exit 1
|
|
fi
|
|
|
|
# Detect OS
|
|
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
|
|
Debian) type="debian" ;;
|
|
Ubuntu) type="ubuntu" ;;
|
|
Amazon) type="amazon" ;;
|
|
*) type="rhel" ;;
|
|
esac
|
|
|
|
if [ "$type" = "ubuntu" ]; then
|
|
echo "Sorry, Ubuntu is not supported."
|
|
echo "myVesta supports only Debian."
|
|
exit;
|
|
fi
|
|
if [ "$type" = "amazon" ]; then
|
|
echo "Sorry, Amazon linux cdistribution is not supported."
|
|
echo "myVesta supports only Debian."
|
|
exit;
|
|
fi
|
|
if [ "$type" = "rhel" ]; then
|
|
echo "Sorry, CentOS is not supported."
|
|
echo "myVesta supports only Debian."
|
|
exit;
|
|
fi
|
|
|
|
# Check wget
|
|
if [ -e '/usr/bin/wget' ]; then
|
|
wget http://c.myvestacp.com/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
|
|
fi
|
|
|
|
# Check curl
|
|
if [ -e '/usr/bin/curl' ]; then
|
|
curl -O http://c.myvestacp.com/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
|
|
fi
|
|
|
|
exit
|