Fix: forgejo chown for non-exists dir, add robots.txt
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
leafee98 2023-08-22 14:56:08 +08:00
parent a13d90bf59
commit 20eb80e648
2 changed files with 81 additions and 3 deletions

View file

@ -1,8 +1,8 @@
#/usr/bin/env bash #!/usr/bin/env bash
pkgname="forgejo" pkgname="forgejo"
arch="amd64" arch="amd64"
pkgrel=3 pkgrel=4
pkgver="1.20.3-0" pkgver="1.20.3-0"
pkgdesc="A painless selfhost git service." pkgdesc="A painless selfhost git service."
url="https://codeberg.org/forgejo/forgejo" url="https://codeberg.org/forgejo/forgejo"
@ -12,11 +12,13 @@ _arch="amd64"
source=( source=(
"forgejo-${pkgver}-linux-${_arch}.xz::https://codeberg.org/forgejo/forgejo/releases/download/v${pkgver}/forgejo-${pkgver}-linux-${_arch}.xz" "forgejo-${pkgver}-linux-${_arch}.xz::https://codeberg.org/forgejo/forgejo/releases/download/v${pkgver}/forgejo-${pkgver}-linux-${_arch}.xz"
"forgejo.service::materials/forgejo.service" "forgejo.service::materials/forgejo.service"
"robots.txt::materials/robots.txt"
) )
function package { function package {
install -Dm755 "${srcdir}/forgejo-${pkgver}-linux-${_arch}" "${pkgdir}/usr/bin/forgejo" 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}/forgejo.service" "${pkgdir}/usr/lib/systemd/system/forgejo.service"
install -Dm644 "${srcdir}/robots.txt" "${pkgdir}/etc/forgejo/robots.txt"
} }
function debian_postinst { function debian_postinst {
@ -28,7 +30,7 @@ mkdir -p /etc/forgejo/conf
touch /etc/forgejo/conf/app.ini touch /etc/forgejo/conf/app.ini
adduser --system git 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 systemctl daemon-reload
EOF EOF

View file

@ -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