Use variable HOST in gen_robot.sh

This commit is contained in:
Jiajie Chen 2020-03-22 22:47:00 +08:00
parent 89d55e50a9
commit 551035bd89

View File

@ -1,11 +1,12 @@
#!/bin/bash
HOST="mirrors.tuna.tsinghua.edu.cn"
echo '# robots.txt for https://mirrors.tuna.tsinghua.edu.cn' > robots.txt
echo "# robots.txt for https://$HOST" > robots.txt
echo 'User-agent: *' >> robots.txt
echo '' >> robots.txt
echo 'Disallow: /logs' >> robots.txt
curl -s https://mirrors.tuna.tsinghua.edu.cn/static/tunasync.json | jq -r '.[] | .name' | uniq | while read name; do
curl -s https://$HOST/static/tunasync.json | jq -r '.[] | .name' | uniq | while read name; do
[[ -z ${name} ]] && continue
echo "Disallow: /${name}" >> robots.txt
done