添加安装脚本

This commit is contained in:
aixiao 2025-01-13 15:57:35 +08:00
parent ed4deb847e
commit 7947c42dd7
2 changed files with 46 additions and 0 deletions

BIN
denyip

Binary file not shown.

46
install.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
set -x
init()
{
DENYIP_HOME=~/DenyIp-go
}
main()
{
if ! test -d $DENYIP_HOME; then
mkdir -p $DENYIP_HOME
mkdir -p $DENYIP_HOME/ip2region
fi
if ! test -f ~/DenyIp/ip2region/ip2region.xdb; then
wget -O $DENYIP_HOME/ip2region/ip2region.xdb https://git.aixiao.me/aixiao/DenyIP-go/raw/branch/main/ip2region/ip2region.xdb
if test "$(md5sum $DENYIP_HOME/ip2region/ip2region.xdb | cut -d " " -f 1)" != "508c6b0257a02152b9d1b2b3792936e1"; then
echo "ip2region.xdb md5 check fail"
rm -rf $DENYIP_HOME
exit 1
else
echo "ip2region.xdb md5 check success"
fi
fi
if ! test -f ~/DenyIp/denyip; then
wget -O $DENYIP_HOME/denyip https://git.aixiao.me/aixiao/DenyIP-go/raw/branch/main/denyip
chmod +x $DENYIP_HOME/denyip
if test -n "$(file $DENYIP_HOME/denyip | grep ELF)"; then
echo "denyip install success"
else
echo "denyip install fail"
rm -rf $DENYIP_HOME
exit 1
fi
fi
}
init
main $@
exit 0