From 20eb80e648cff34ba38826b34f0e1902c5427e48 Mon Sep 17 00:00:00 2001 From: leafee98 Date: Tue, 22 Aug 2023 14:56:08 +0800 Subject: [PATCH] Fix: forgejo chown for non-exists dir, add robots.txt --- packages/bin/forgejo-bin/DEBBUILD | 8 +- packages/bin/forgejo-bin/materials/robots.txt | 76 +++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 packages/bin/forgejo-bin/materials/robots.txt diff --git a/packages/bin/forgejo-bin/DEBBUILD b/packages/bin/forgejo-bin/DEBBUILD index 66826b1..0799c28 100644 --- a/packages/bin/forgejo-bin/DEBBUILD +++ b/packages/bin/forgejo-bin/DEBBUILD @@ -1,8 +1,8 @@ -#/usr/bin/env bash +#!/usr/bin/env bash pkgname="forgejo" arch="amd64" -pkgrel=3 +pkgrel=4 pkgver="1.20.3-0" pkgdesc="A painless selfhost git service." url="https://codeberg.org/forgejo/forgejo" @@ -12,11 +12,13 @@ _arch="amd64" source=( "forgejo-${pkgver}-linux-${_arch}.xz::https://codeberg.org/forgejo/forgejo/releases/download/v${pkgver}/forgejo-${pkgver}-linux-${_arch}.xz" "forgejo.service::materials/forgejo.service" + "robots.txt::materials/robots.txt" ) function package { install -Dm755 "${srcdir}/forgejo-${pkgver}-linux-${_arch}" "${pkgdir}/usr/bin/forgejo" install -Dm644 "${srcdir}/forgejo.service" "${pkgdir}/usr/lib/systemd/system/forgejo.service" + install -Dm644 "${srcdir}/robots.txt" "${pkgdir}/etc/forgejo/robots.txt" } function debian_postinst { @@ -28,7 +30,7 @@ mkdir -p /etc/forgejo/conf touch /etc/forgejo/conf/app.ini adduser --system git -chown -R git:git /var/lib/forgejo /etc/forgejo /etc/forgejo/app.ini +chown -R git:git /var/lib/forgejo systemctl daemon-reload EOF diff --git a/packages/bin/forgejo-bin/materials/robots.txt b/packages/bin/forgejo-bin/materials/robots.txt new file mode 100644 index 0000000..1a4e30d --- /dev/null +++ b/packages/bin/forgejo-bin/materials/robots.txt @@ -0,0 +1,76 @@ +User-agent: * +Disallow: /api/* +Disallow: /avatars +Disallow: /user/* +Disallow: /*/*/src/commit/* +Disallow: /*/*/commit/* +Disallow: /*/*/*/refs/* +Disallow: /*/*/*/star +Disallow: /*/*/*/watch +Disallow: /*/*/labels +Disallow: /*/*/activity/* +Disallow: /vendor/* +Disallow: /swagger.*.json + +# Language spam +Disallow: /*?lang= + +# from Github, to be cleaned +Allow: /*/*/tree/master +Allow: /*/*/blob/master +Disallow: /*/*/pulse +Disallow: /*/*/tree/* +Disallow: /*/*/blob/* +Disallow: /*/*/wiki/*/* +Disallow: /gist/*/*/* +Disallow: /oembed +Disallow: /*/forks +Disallow: /*/stars +Disallow: /*/download +Disallow: /*/revisions +Disallow: /*/*/issues/new +Disallow: /*/*/issues/search +Disallow: /*/*/commits/*/* +Disallow: /*/*/commits/*?author +Disallow: /*/*/commits/*?path +Disallow: /*/*/branches +Disallow: /*/*/tags +Disallow: /*/*/contributors +Disallow: /*/*/comments +Disallow: /*/*/stargazers +Disallow: /*/*/search +Disallow: /*/tarball/ +Disallow: /*/zipball/ +Disallow: /*/*/archive/ +Disallow: /raw/* +Disallow: /*/followers +Disallow: /*/following +Disallow: /stars/* +Disallow: /*/blame/ +Disallow: /*/watchers +Disallow: /*/network +Disallow: /*/graphs +Disallow: /*/raw/ +Disallow: /*/compare/ +Disallow: /*/cache/ +Disallow: /*/*/blame/ +Disallow: /*/*/watchers +Disallow: /*/*/network +Disallow: /*/*/graphs +Disallow: /*/*/raw/ +Disallow: /*/*/compare/ +Disallow: /*/*/cache/ +Disallow: /.git/ +Disallow: /*/.git/ +Disallow: /*.git$ +Disallow: /*/sitemap.xml +Disallow: /search/advanced +Disallow: /search +Disallow: /*q= +Disallow: /*.atom + + +Disallow: /mirrors + +Crawl-delay: 2 +