This repository was archived by the owner on Jan 16, 2020. It is now read-only.
forked from meteoral/Nali
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·153 lines (128 loc) · 2.77 KB
/
Copy pathconfigure
File metadata and controls
executable file
·153 lines (128 loc) · 2.77 KB
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
#!/bin/sh
prefix=/usr/local
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
echo "Usage: ./configure [options]"
echo " --help print this message"
echo " --prefix=PREFIX default:/usr/local"
echo " --bindir=BINDIR default:$prefix/bin"
echo " --datadir=BINDIR default:$prefix/share"
echo ""
exit 1
fi
if test ! -d ./bin
then
mkdir -p ./bin
fi
if test ! -d ./libqqwry
then
echo there is no ./libqqwry
echo see https://github.com/meteoral/Nali/tree/master/libqqwry
exit 1
fi
if test ! -f ./share/QQWry.Dat
then
echo please download QQWry.Dat from https://qqwry.mirror.noc.one/QQWry.Dat
exit 1
fi
# parse options
for opt do
optarg="${opt#*=}"
case "$opt" in
--prefix=*)
prefix="$optarg"
;;
--bindir=*)
bindir="$optarg"
;;
--datadir=*)
datadir="$optarg"
;;
esac
done
if test "z$bindir" = "z"
then
bindir=${prefix}/bin
fi
if test "z$datadir" = "z"
then
datadir=${prefix}/share
fi
# generate config files
cat > config.mak << EOF
prefix=$prefix
bindir=$bindir
datadir=$datadir
EOF
cat > config.h << EOF
#define NALI_QQWRY_PATH "$datadir/QQWry.Dat"
EOF
cat > bin/nali << EOF
#!/bin/sh
if test \$# -gt 0
then
echo \$@|perl $datadir/nali.pl
else
perl $datadir/nali.pl
fi
EOF
cat > bin/nali-update << EOF
#!/bin/sh
qqwry_dat_url="https://qqwry.mirror.noc.one/QQWry.Dat";
qqwry_dat_local_path="$datadir/QQWry.Dat"
axel=\`which axel\`
curl=\`which curl\`
wget=\`which wget\`
if ! test -w \$qqwry_dat_local_path
then
echo You may need sudo
exit 1
fi
if test -f /tmp/QQWry.Dat
then
rm -f /tmp/QQWry.Dat || exit 1
fi
if test "x\$axel" != "x" && test -x \$axel
then
command="\$axel -an8 \$qqwry_dat_url -o /tmp/QQWry.Dat"
elif test "x\$wget" != "x" && test -x \$wget
then
command="\$wget --no-check-certificate \$qqwry_dat_url -O /tmp/QQWry.Dat"
elif test "x\$curl" != "x" && test -x \$curl
then
command="\$curl -k --compressed \$qqwry_dat_url -o /tmp/QQWry.Dat"
else
echo Error: Please install curl or wget
exit 1
fi
echo Updating \$qqwry_dat_local_path
\$command && mv /tmp/QQWry.Dat \$qqwry_dat_local_path && chmod 555 \$qqwry_dat_local_path && echo Successfully Updated && exit 0
echo Failed to update
exit 1
EOF
cat > bin/nali-dig << EOF
#!/bin/sh
dig \$@ 2>&1|nali
EOF
cat > bin/nali-nslookup << EOF
#!/bin/sh
nslookup \$@ 2>&1|nali
EOF
cat > bin/nali-ping << EOF
#!/bin/sh
ping \$@ 2>&1|nali
EOF
cat > bin/nali-tracepath << EOF
#!/bin/sh
tracepath \$@ 2>&1|nali
EOF
cat > bin/nali-traceroute << EOF
#!/bin/sh
traceroute \$@ 2>&1|nali
EOF
echo '***** Configure Successfully *****'
echo
echo "Install:"
echo 'make && make install'
echo
echo "Usage and Examples:";
echo 'http://www.surfchen.org/wiki/Nali'