-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure
executable file
·101 lines (91 loc) · 2.02 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
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
set -e
setcfg(){
echo -ne " $1 [y/n]"
read -sn 1 c
echo -ne "\033[32;1m($c)\033[;0m"
if [ "$c" == "y" ] || [ "$c" == "Y" ] ; then
echo "$2=y" >> .config
else
echo "$2=n" >> .config
fi
echo
}
defconfig="ny"
ask_cfg(){
echo -e "\033[34;1mInary configure :\033[;0m"
echo "#inary config file" > .config
setcfg "Native language support" "NLS_SUPPORT"
setcfg "Additional scripts" "ADDITIONAL_SCRIPTS"
echo -e "\033[33;1m\".config\" file changed.\033[;0m"
}
ask_check(){
echo -e "\033[34;1mInary check :\033[;0m"
chkfile "/dev/null"
chkfile "/usr/bin/"
chkfile "/var/lib/"
chkfile "/usr/lib/"
chkfile "/etc/"
chkcmd "python3" && chkcmd "python3.8" || chkcmd "python3.7"
chkcmd "intltool-extract"
chkcmd "xgettext"
chkcmd "msgfmt"
}
chkcmd(){
echo -ne "checking $1 "
if which $1 &>/dev/null ; then
echo -e "\033[32;1m(yes)\033[;0m"
else
echo -e "\033[33;1m(no)\033[;0m"
echo -e "\033[32;1mERROR:\033[;0m $1 not found in \$PATH"
return 1
fi
}
chkfile(){
echo -ne "checking $1 "
if [ -e "$1" ] ; then
echo -e "\033[32;1m(yes)\033[;0m"
else
echo -e "\033[33;1m(no)\033[;0m"
echo -e "\033[32;1mERROR:\033[;0m $1 not found."
return 1
fi
}
yes(){
while true ; do
echo -ne "$1"
done
}
usage(){
cat <<EOF
./configure [OPTIONS]
Options list:
--yes-all : Enable all
--no-all : Disable all
--default : Use default config
--help : Show this message
--clean : Delete .config file
EOF
}
for i in $@ ; do
if [ "$i" == "--yes-all" ] ; then
ask_check
yes y | ask_cfg
exit 0
elif [ "$i" == "--no-all" ] ; then
ask_check
yes n | ask_cfg
exit 0
elif [ "$i" == "--clean" ] ; then
[ -f .config ] && rm -f .config
exit 0
elif [ "$i" == "--default" ] ; then
ask_check
echo "$defconfig" | ask_cfg
exit 0
elif [ "$i" == "--help" ] ; then
usage
exit 0
fi
done
ask_cfg