mirror-web/gen_robot.sh
Miao Wang c5dfbf3e83
Some checks failed
docker-images / multi (push) Has been cancelled
gen_robot: exclude linuxbrew-bottles
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
2024-11-25 02:06:05 +08:00

22 lines
532 B
Bash
Executable File

#!/bin/bash
HOST=${1:-"mirrors.tuna.tsinghua.edu.cn"}
echo "# robots.txt for https://$HOST" > robots.txt
echo 'User-agent: *' >> robots.txt
echo '' >> robots.txt
echo 'Disallow: /logs' >> robots.txt
(
curl -s https://$HOST/static/tunasync.json | jq -r '.[] | .name'
echo "lede";
echo "raspberry-pi-os";
echo "ctan";
echo "cygwin";
echo "pub";
echo "git";
echo "linuxbrew-bottles";
) | uniq | while read name; do
[[ -z ${name} ]] || [[ ${name} = "tuna" ]] && continue
echo "Disallow: /${name}" >> robots.txt
done