Skip to content

Commit 63659f4

Browse files
authored
Installer lts check
2 parents 8b34f42 + 97ad1e8 commit 63659f4

File tree

1 file changed

+50
-22
lines changed

1 file changed

+50
-22
lines changed

install/hst-install.sh

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,34 +42,62 @@ case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
4242
*) type="NoSupport" ;;
4343
esac
4444

45+
no_support_message() {
46+
echo "Your OS is currently not supported, please consider to use:"
47+
echo " Debian: 8, 9"
48+
echo " Ubuntu: 16.04, 18.04"
49+
exit 1;
50+
}
51+
4552
# Check if OS is supported
4653
if [ "$type" = "NoSupport" ]; then
47-
echo "Your OS is currently not supported."
48-
exit 1;
54+
no_support_message
4955
fi
5056

51-
# Check wget
52-
if [ -e '/usr/bin/wget' ]; then
53-
wget -q https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh -O hst-install-$type.sh
54-
if [ "$?" -eq '0' ]; then
55-
bash hst-install-$type.sh $*
56-
exit
57-
else
58-
echo "Error: hst-install-$type.sh download failed."
59-
exit 1
57+
check_wget_curl(){
58+
# Check wget
59+
if [ -e '/usr/bin/wget' ]; then
60+
wget -q https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh -O hst-install-$type.sh
61+
if [ "$?" -eq '0' ]; then
62+
bash hst-install-$type.sh $*
63+
exit
64+
else
65+
echo "Error: hst-install-$type.sh download failed."
66+
exit 1
67+
fi
6068
fi
61-
fi
6269

63-
# Check curl
64-
if [ -e '/usr/bin/curl' ]; then
65-
curl -s -O https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh
66-
if [ "$?" -eq '0' ]; then
67-
bash hst-install-$type.sh $*
68-
exit
69-
else
70-
echo "Error: hst-install-$type.sh download failed."
71-
exit 1
70+
# Check curl
71+
if [ -e '/usr/bin/curl' ]; then
72+
curl -s -O https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh
73+
if [ "$?" -eq '0' ]; then
74+
bash hst-install-$type.sh $*
75+
exit
76+
else
77+
echo "Error: hst-install-$type.sh download failed."
78+
exit 1
79+
fi
7280
fi
81+
}
82+
83+
84+
# Detect codename for debian
85+
if [ "$type" = "debian" ]; then
86+
release=$(cat /etc/debian_version|grep -o [0-9]|head -n1)
87+
VERSION='debian'
88+
fi
89+
90+
# Detect codename for ubuntu
91+
if [ "$type" = "ubuntu" ]; then
92+
release="$(lsb_release -s -r)"
93+
VERSION='ubuntu'
94+
fi
95+
96+
# Check Ubuntu Version Are Acceptable to install
97+
if [[ "$release" =~ ^(8|9|16.04|18.04)$ ]]; then
98+
check_wget_curl
99+
else
100+
no_support_message
73101
fi
74102

75-
exit
103+
exit

0 commit comments

Comments
 (0)