anti-AD/start.sh

69 lines
1.6 KiB
Bash
Raw Normal View History

2019-04-04 16:22:37 +08:00
#!/bin/bash
2018-10-04 21:37:00 +08:00
source /etc/profile
2018-10-08 10:59:06 +08:00
cd $(cd "$(dirname "$0")";pwd)
2018-10-10 09:23:35 +08:00
git pull
2018-10-08 10:59:06 +08:00
2018-10-04 21:37:00 +08:00
echo '开始下载 easylist1...'
2019-12-14 10:45:22 +08:00
wget -O ./origin-files/easylistchina+easylist.txt --timeout 30 https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt
2018-10-04 21:37:00 +08:00
2019-12-14 21:29:41 +08:00
# shellcheck disable=SC2181
2018-10-04 21:37:00 +08:00
if [ $? -ne 0 ];then
echo '下载失败,请重试'
exit 1
fi
2019-09-04 19:46:50 +08:00
echo '开始下载 easylist2...'
2019-12-14 10:45:22 +08:00
wget -O ./origin-files/cjx-annoyance.txt --timeout 30 https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt
2018-10-04 21:37:00 +08:00
2019-12-14 21:29:41 +08:00
# shellcheck disable=SC2181
2019-09-04 19:46:50 +08:00
if [ $? -ne 0 ];then
echo '下载失败,请重试'
exit 1
fi
2018-10-04 21:37:00 +08:00
2019-11-01 00:48:07 +08:00
echo '开始下载 easylist3...'
2019-12-14 10:45:22 +08:00
wget -O ./origin-files/fanboy-annoyance.txt --timeout 30 https://easylist.to/easylist/fanboy-annoyance.txt
2019-11-01 00:48:07 +08:00
2019-12-14 21:29:41 +08:00
# shellcheck disable=SC2181
2019-11-01 00:48:07 +08:00
if [ $? -ne 0 ];then
echo '下载失败,请重试'
exit 1
fi
echo '开始下载 hosts1...'
2019-12-14 10:45:22 +08:00
wget -O ./origin-files/hosts1 --timeout 30 https://hosts.nfz.moe/full/hosts
2019-12-14 21:29:41 +08:00
# shellcheck disable=SC2181
if [ $? -ne 0 ];then
echo '下载失败,请重试'
exit 1
fi
echo '开始下载 hosts2...'
2019-12-14 10:45:22 +08:00
wget -O ./origin-files/hosts2 --timeout 60 https://raw.githubusercontent.com/vokins/yhosts/master/hosts
2019-12-14 21:29:41 +08:00
# shellcheck disable=SC2181
if [ $? -ne 0 ];then
echo '下载失败,请重试'
exit 1
fi
2019-11-01 01:21:54 +08:00
echo '开始下载 hosts3...'
2019-12-14 10:45:22 +08:00
wget -O ./origin-files/hosts3 --timeout 60 https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts
2019-11-01 01:21:54 +08:00
2019-12-14 21:29:41 +08:00
# shellcheck disable=SC2181
2019-11-01 01:21:54 +08:00
if [ $? -ne 0 ];then
echo '下载失败,请重试'
exit 1
fi
PHP_RET=$(/usr/local/php/bin/php make-addr.php)
2018-10-10 09:23:35 +08:00
2019-12-14 21:29:41 +08:00
git add -A adblock-for-dnsmasq.conf origin-files/*
git commit -am "auto commit. script output--- $PHP_RET"
2018-10-10 09:23:35 +08:00
git push --force