-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapprove-config
executable file
·207 lines (174 loc) · 5.49 KB
/
approve-config
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/usr/bin/env bash
: "${PKG_CONFIG:=pkg-config}"
# Poor man's distro detection.
DISTRO=unknown
grep -q 'Debian' /etc/issue && DISTRO=debian
grep -q 'Ubuntu' /etc/issue && DISTRO=ubuntu
grep -q 'Fedora' /etc/issue && DISTRO=fedora
# Default everything to n, so variable is defined here if not in the file.
XINERAMA_SUPPORT=n
PUTICON_GDKPIXBUF=n
PUTICON_IMLIB2=n
DRAWKBLIBS_XLIB=n
DRAWKBLIBS_CAIRO=n
# Read configuration file.
. ./configuration
NEED_SOMETHING=n
SUGGEST_SOMETHING=n
if echo "$DRAWKBLIBS_XLIB $PUTICON_IMLIB2 $PUTICON_GDKPIXBUF" |
grep -q "^[my] n n$"; then
NEED_SOMETHING=y
need_index=$((${#NEED_COMPONENTS[@]}+1))
NEED_COMPONENTS[$need_index]='* Imlib2 library and development headers'
NEED_UBUNTU_SUGG[$need_index]='libimlib2-dev'
NEED_DEBIAN_SUGG[$need_index]='libimlib2-dev'
NEED_FEDORA_SUGG[$need_index]='imlib2-devel'
fi
if [ "$DRAWKBLIBS_XLIB" = "y" -o "$DRAWKBLIBS_XLIB" = "m" ]; then
if "${PKG_CONFIG}" xft renderproto xrender --exists > /dev/null; then
true
else
NEED_SOMETHING=y
need_index=$((${#NEED_COMPONENTS[@]}+1))
NEED_COMPONENTS[$need_index]='* Xft library and development headers'
NEED_UBUNTU_SUGG[$need_index]='libxft-dev'
NEED_DEBIAN_SUGG[$need_index]='libxft-dev'
NEED_FEDORA_SUGG[$need_index]='libXft-devel'
need_index=$((${#NEED_COMPONENTS[@]}+1))
NEED_COMPONENTS[$need_index]='* Xrender library and development headers'
NEED_UBUNTU_SUGG[$need_index]='libxrender-dev x11proto-render-dev'
NEED_DEBIAN_SUGG[$need_index]='libxrender-dev x11proto-render-dev'
NEED_FEDORA_SUGG[$need_index]='xorg-x11-proto-devel'
fi
fi
# Suggest Cairo if not detected.
if [ "$DRAWKBLIBS_CAIRO" = "n" ]; then
suggest_index=$((${#SUGGEST_COMPONENTS[@]}+1))
SUGGEST_SOMETHING=y
SUGGEST_COMPONENTS[$suggest_index]='* Cairo and Pango library and development headers'
SUGGEST_UBUNTU_SUGG[$suggest_index]='libcairo2-dev libpango1.0-dev'
SUGGEST_DEBIAN_SUGG[$suggest_index]='libcairo2-dev libpango1.0-dev'
SUGGEST_FEDORA_SUGG[$suggest_index]='cairo-devel pango-devel'
fi
# Suggest Xinerama if not detected.
if [ "$XINERAMA_SUPPORT" = "n" ]; then
suggest_index=$((${#SUGGEST_COMPONENTS[@]}+1))
SUGGEST_SOMETHING=y
SUGGEST_COMPONENTS[$suggest_index]='* Xinerama library and development headers'
SUGGEST_UBUNTU_SUGG[$suggest_index]='libxinerama-dev'
SUGGEST_DEBIAN_SUGG[$suggest_index]='libxinerama-dev'
SUGGEST_FEDORA_SUGG[$suggest_index]='libXinerama-devel'
fi
if which help2man | grep -q help2man; then
:
else
echo "FALSE"
need_index=$((${#NEED_COMPONENTS[@]}+1))
NEED_SOMETHING=y
NEED_COMPONENTS[$need_index]='* help2man binary'
NEED_UBUNTU_SUGG[$need_index]='help2man'
NEED_DEBIAN_SUGG[$need_index]='help2man'
NEED_FEDORA_SUGG[$need_index]='help2man'
fi
if [ "$NEED_SOMETHING" = "y" ]; then
echo
echo "-------------------------------------------------------------------"
echo
echo "ERROR: Superkb requires some components not found in your"
echo "system. Compilation can not continue without these components."
echo "Please install them accordingly. The required components are:";
echo
for I in `seq 1 $((${#NEED_COMPONENTS[@]}))`; do
echo "${NEED_COMPONENTS[$I]}"
done
echo
if [ "$DISTRO" = "fedora" ]; then
echo "Under Fedora, we suggest the following command:"
echo
echo -n '===> su -c '"'"'yum install '
for I in `seq 1 $((${#NEED_COMPONENTS[@]}))`; do
echo -n "${NEED_FEDORA_SUGG[$I]} "
done
echo "'"
echo
fi
if [ "$DISTRO" = "debian" ]; then
echo "Under Debian, we suggest the following command:"
echo
echo -n '===> su -c '"'"'apt-get install '
for I in `seq 1 $((${#NEED_COMPONENTS[@]}))`; do
echo -n "${NEED_DEBIAN_SUGG[$I]} "
done
echo "'"
echo
fi
if [ "$DISTRO" = "ubuntu" ]; then
echo "Under ubuntu, we suggest the following command:"
echo
echo -n '===> sudo apt-get install '
for I in `seq 1 $((${#NEED_COMPONENTS[@]}))`; do
echo -n "${NEED_UBUNTU_SUGG[$I]} "
done
echo
echo
fi
fi
if [ "$SUGGEST_SOMETHING" = "y" -a "$NEED_SOMETHING" = "n" ]; then
echo
echo "-------------------------------------------------------------------"
echo
echo "WARNING: In order to better enjoy Superkb, some components are"
echo "highly suggested. Compilation will continue. The suggested"
echo "components are:";
fi
if [ "$SUGGEST_SOMETHING" = "y" -a "$NEED_SOMETHING" = "y" ]; then
echo
echo
echo "In addition, the following components are highly suggested to"
echo "better experience Superkb:"
fi
if [ "$SUGGEST_SOMETHING" = "y" ]; then
echo
for I in `seq 1 $((${#SUGGEST_COMPONENTS[@]}))`; do
echo "${SUGGEST_COMPONENTS[$I]}"
done
echo
if [ "$DISTRO" = "fedora" ]; then
echo "Under Fedora, we suggest the following command:"
echo
echo -n '===> su -c '"'"'yum install '
for I in `seq 1 $((${#SUGGEST_COMPONENTS[@]}))`; do
echo -n "${SUGGEST_FEDORA_SUGG[$I]} "
done
echo "'"
echo
fi
if [ "$DISTRO" = "debian" ]; then
echo "Under Debian, we suggest the following command:"
echo
echo -n '===> su -c '"'"'apt-get install '
for I in `seq 1 $((${#SUGGEST_COMPONENTS[@]}))`; do
echo -n "${SUGGEST_DEBIAN_SUGG[$I]} "
done
echo "'"
echo
fi
if [ "$DISTRO" = "ubuntu" ]; then
echo "Under ubuntu, we suggest the following command:"
echo
echo -n '===> sudo apt-get install '
for I in `seq 1 $((${#SUGGEST_COMPONENTS[@]}))`; do
echo -n "${SUGGEST_UBUNTU_SUGG[$I]} "
done
echo
echo
fi
fi
if [ "$NEED_SOMETHING" = "y" ]; then
echo 'Your "configuration" file will be renamed as configuration-bad.'
mv configuration configuration-bad
exit 1;
fi
if [ "$SUGGEST_SOMETHING" = "y" ]; then
exit 0;
fi