Skip to content

Commit 242ac15

Browse files
committed
Improved OS selector
1 parent 8d4a012 commit 242ac15

File tree

1 file changed

+6
-52
lines changed

1 file changed

+6
-52
lines changed

install/vst-install.sh

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,12 @@ if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
3737
exit 1
3838
fi
3939

40-
# Check OS type
41-
if [ -e '/etc/redhat-release' ]; then
42-
type="rhel"
43-
fi
44-
45-
if [ "$(lsb_release -si)" == "Ubuntu" ] && [ -e '/etc/debian_version' ]; then
46-
type="ubuntu"
47-
fi
48-
49-
if [ -z "$type" ]; then
50-
os=$(head -n1 /etc/issue | cut -f 1 -d ' ')
51-
if [ "$os" == 'Debian' ]; then
52-
type="debian"
53-
fi
54-
fi
55-
56-
# Check type
57-
if [ -z "$type" ]; then
58-
echo 'Error: only RHEL,CentOS, Ubuntu LTS and Debian 7 is supported'
59-
exit 1
60-
fi
61-
40+
# Detect OS
41+
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
42+
Debian) type="debian" ;;
43+
Ubuntu) type="ubuntu" ;;
44+
*) type="rhel" ;;
45+
esac
6246

6347
# Check wget
6448
if [ -e '/usr/bin/wget' ]; then
@@ -84,34 +68,4 @@ if [ -e '/usr/bin/curl' ]; then
8468
fi
8569
fi
8670

87-
# Let's try to install wget automaticaly
88-
if [ "$type" = 'rhel' ]; then
89-
yum -y install wget
90-
if [ $? -ne 0 ]; then
91-
echo "Error: can't install wget"
92-
exit 1
93-
fi
94-
else
95-
apt-get -y install wget
96-
if [ $? -ne 0 ]; then
97-
echo "Error: can't install wget"
98-
exit 1
99-
fi
100-
fi
101-
102-
# OK, last try
103-
if [ -e '/usr/bin/wget' ]; then
104-
wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
105-
if [ "$?" -eq '0' ]; then
106-
bash vst-install-$type.sh $*
107-
exit
108-
else
109-
echo "Error: vst-install-$type.sh download failed."
110-
exit 1
111-
fi
112-
else
113-
echo "Error: /usr/bin/wget not found"
114-
exit 1
115-
fi
116-
11771
exit

0 commit comments

Comments
 (0)