Last active
November 18, 2019 03:44
-
-
Save wen-long/324459d17d72d2260003 to your computer and use it in GitHub Desktop.
QQWry.Dat is the ip database from http://www.cz88.net/ the website which offers the original code seems won't update any more and the download link refers to another obsolete website original script was from https://www.surfchen.org/nali but it was obsolete because the download link https://chenze.name/wenjian/QQWry.Dat offers an obsolete file a…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
qqwry_dat_url="http://update.cz88.net/soft/setup.zip"; | |
qqwry_dat_local_path="/usr/local/share/QQWry.Dat" | |
curl=`which curl` | |
wget=`which wget` | |
workdir="/tmp/QQWry/" | |
zipname="QQWry.setup.zip" | |
ismodified=`curl -s -I --header "If-Modified-Since: \`date -R -u -r /usr/local/share/QQWry.Dat | sed 's/+0000/GMT/'\`" http://update.cz88.net/soft/setup.zip | grep "HTTP/1.1 304 Not Modified" | wc -l` | |
if [ $ismodified = 1 ] ; then echo "No update needed" && exit 0; fi | |
echo "Update needed" | |
if ! test -w $qqwry_dat_local_path | |
then | |
echo can not write to $qqwry_dat_local_path | |
exit 1 | |
fi | |
mkdir $workdir | |
if test "x$curl" != "x" && test -x $curl | |
then | |
command="$curl -k --compressed $qqwry_dat_url -o ${workdir}${zipname}" | |
elif test "x$wget" != "x" && test -x $wget | |
then | |
command="$wget --no-check-certificate $qqwry_dat_url -O ${workdir}${zipname}" | |
else | |
echo Error: Please install curl or wget | |
exit 1 | |
fi | |
echo Updating $qqwry_dat_local_path | |
$command | |
unzip -q -u ${workdir}${zipname} -d ${workdir} | |
innoextract -e ${workdir}setup.exe -d ${workdir} | |
cp ${workdir}app/qqwry.dat $qqwry_dat_local_path | |
#clean | |
rm -r ${workdir} | |
ls -alh "$qqwry_dat_local_path" | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome work