-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathconfigure
executable file
·90 lines (77 loc) · 1.76 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
# This isn't a configure generated by autoconf!
# ISLET build system
# Copyright 2014 Jon Schipp <[email protected]>
# Subject to the GNU GPL
# Get colors from libislet
LIBISLET=lib/libislet
[ -f $LIBISLET ] && source $LIBISLET
# Global Declarations
OK=0
CRITICAL=1
DEPENDS="bash make sshd sqlite3"
MISSING=()
DEBIAN=0
NO="${Y}[${N}${RF}NO${N}${Y}]${N}"
YES="${Y}[${N}${BF}YES${N}${Y}]${N}"
BULLET="${Y}[${N}${BF}*${N}${Y}]${N}"
check_arch()
{
echo -n "${BULLET} Checking arch ... "
ARCH=$(getconf LONG_BIT)
if [ $ARCH -ne 64 ]; then
echo "$NO Not a 64-bit system"
MISSING+=('64-bit')
else
echo "$YES 64-bit system"
fi
}
check_linux()
{
echo -n "${BULLET} Checking Linux ... "
if [[ "$(uname)" != "Linux" ]]; then
echo "$NO Linux not found"
MISSING+=('Linux')
else
echo "$YES Linux found"
fi
}
is_debian()
{
test -f /etc/debian_version && DEBIAN=1
}
check_dependencies()
{
local depends=$1
echo -n "${BULLET} Checking $depends ... "
if [[ "x$(which $depends 2>/dev/null)" == "x" ]]; then
MISSING+=("$depends")
else
echo "$YES $depends found"
fi
}
check_bash_version()
{
echo -n "${BULLET} Checking bash version ... "
! [[ "x$(which bash 2>/dev/null)" == "x" ]] && vers=$(bash -c 'echo $BASH_VERSION')
echo $vers | grep -q '^[45]' && echo "$YES 4.0+ found" || echo "$NO 4.0+ not found"
}
check_arch
check_linux
is_debian
for i in $DEPENDS
do
check_dependencies $i
done
check_bash_version
if [ ${#MISSING[@]} -gt 0 ]; then
count=$(echo ${#MISSING[@]})
echo -n "${Y}[${N}${RF}!${N}${Y}]${N} Missing dependencies: "
for (( i=0; i<${count}; i++ )); do
echo -n "${MISSING[$i]} "
done
echo
exit $CRITICAL
else
echo "${BULLET} All dependencies found, now you can run \`\`make install''"
fi