From 6145cd6ad5e092c42878ced03f0de351a7a86562 Mon Sep 17 00:00:00 2001 From: Pulux Date: Sun, 15 Oct 2023 11:45:41 +0200 Subject: [PATCH] New package: forgejo-1.20.5 --- srcpkgs/forgejo/INSTALL | 5 +++ srcpkgs/forgejo/files/forgejo/run | 13 ++++++++ srcpkgs/forgejo/patches/config.patch | 36 ++++++++++++++++++++ srcpkgs/forgejo/template | 50 ++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 srcpkgs/forgejo/INSTALL create mode 100755 srcpkgs/forgejo/files/forgejo/run create mode 100644 srcpkgs/forgejo/patches/config.patch create mode 100644 srcpkgs/forgejo/template diff --git a/srcpkgs/forgejo/INSTALL b/srcpkgs/forgejo/INSTALL new file mode 100644 index 0000000000000..e4e49e1acf0c6 --- /dev/null +++ b/srcpkgs/forgejo/INSTALL @@ -0,0 +1,5 @@ +case "${ACTION}" in +post) + chown _forgejo:_forgejo etc/forgejo.conf + ;; +esac diff --git a/srcpkgs/forgejo/files/forgejo/run b/srcpkgs/forgejo/files/forgejo/run new file mode 100755 index 0000000000000..1be6bd4a8c199 --- /dev/null +++ b/srcpkgs/forgejo/files/forgejo/run @@ -0,0 +1,13 @@ +#!/bin/sh +exec 2>&1 + +# USER and HOME are needed because gitea doesn't actually check the user it +# runs as, but instead just grabs the variables from the variables. +export USER=_forgejo +export HOME=/var/lib/forgejo + +# forgejo needs to run from its home for SSH to work properly +export FORGEJO_WORK_DIR="${HOME}" + +cd "${HOME}" +exec chpst -u _forgejo:_forgejo gitea web --config /etc/forgejo.conf 2>&1 diff --git a/srcpkgs/forgejo/patches/config.patch b/srcpkgs/forgejo/patches/config.patch new file mode 100644 index 0000000000000..5269a555978df --- /dev/null +++ b/srcpkgs/forgejo/patches/config.patch @@ -0,0 +1,36 @@ +--- gitea-1.20.0/custom/conf/app.example.ini.orig 2023-07-16 21:24:12.000000000 +0200 ++++ gitea-1.20.0/custom/conf/app.example.ini 2023-10-15 08:51:01.186945949 +0200 +@@ -47,7 +47,7 @@ + APP_NAME = ; Gitea: Git with a cup of tea + ;; + ;; RUN_USER will automatically detect the current user - but you can set it here change it if you run locally +-RUN_USER = ; git ++RUN_USER = _forgejo + ;; + ;; Application run mode, affects performance and debugging: "dev" or "prod", default is "prod" + ;; Mode "dev" makes Gitea easier to develop and debug, values other than "dev" are treated as "prod" which is for production use. +@@ -339,9 +339,9 @@ + ;; MySQL Configuration + ;; +-DB_TYPE = mysql +-HOST = 127.0.0.1:3306 ; can use socket e.g. /var/run/mysqld/mysqld.sock +-NAME = gitea +-USER = root ++;DB_TYPE = mysql ++;HOST = 127.0.0.1:3306 ; can use socket e.g. /var/run/mysqld/mysqld.sock ++;NAME = gitea ++;USER = root + ;PASSWD = ;Use PASSWD = `your password` for quoting if you use special characters in the password. + ;SSL_MODE = false ; either "false" (default), "true", or "skip-verify" + ;CHARSET = utf8mb4 ;either "utf8" or "utf8mb4", default is "utf8mb4". +@@ -364,8 +364,8 @@ + ;; + ;; SQLite Configuration + ;; +-;DB_TYPE = sqlite3 +-;PATH= ; defaults to data/forgejo.db ++DB_TYPE = sqlite3 ++PATH = /var/lib/forgejo/data/forgejo.db + ;SQLITE_TIMEOUT = ; Query timeout defaults to: 500 + ;SQLITE_JOURNAL_MODE = ; defaults to sqlite database default (often DELETE), can be used to enable WAL mode. https://www.sqlite.org/pragma.html#pragma_journal_mode + ;; diff --git a/srcpkgs/forgejo/template b/srcpkgs/forgejo/template new file mode 100644 index 0000000000000..539f05394bca3 --- /dev/null +++ b/srcpkgs/forgejo/template @@ -0,0 +1,50 @@ +# Template file for 'forgejo' +pkgname=forgejo +version=1.20.5 +revision=1 +_forgejo_tag="1-20-5-0" +build_style=go +go_import_path=code.gitea.io/gitea +go_ldflags=" -X main.Version=${version}" +# This could be done with build options, but these are built in with the +# following justification. +# * bindata: running with things not all in the binary is not a +# supported distribution format by the forgejo upstream developers. +# That mode is only supported for development of forgejo within the +# source tree +# * sqlite: this is likely the database that everyone will use. Only +# particularly large installations will want to go through the +# effort of setting up a real database server. +# * pam: PAM allows for authentication to varied external sources. +# Internal authentication supports the local database, OpenID, and +# LDAP, but basic other auth sources such as Kerberos and more +# exotic authenticators require PAM support to be useable. +# * tidb: This is an alternate database engine for users who would +# rather not use SQLite3 for some reason. It is also potentially +# more resiliant to corrupted writes. +go_build_tags="bindata sqlite pam tidb" +hostmakedepends="go-bindata" +makedepends="sqlite-devel pam-devel" +depends="git bash" +short_desc="Self-hosted lightweight software forge" +maintainer="Pulux " +license="MIT" +homepage="https://forgejo.org" +changelog="https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#${_forgejo_tag}" +distfiles="https://codeberg.org/forgejo/forgejo/releases/download/v${version}-0/forgejo-src-${version}-0.tar.gz" +checksum=e709c0e6403100fdef96eec8ac146c065375228b104125b9bf5ea844ea48633e +conflicts="gitea" + +system_accounts="_forgejo" +_forgejo_homedir="/var/lib/forgejo" +_forgejo_shell="/bin/bash" # Proper shell needed for ssh support +make_dirs="/var/lib/forgejo 0755 _forgejo _forgejo + /var/log/forgejo 0755 _forgejo root" +conf_files="/etc/forgejo.conf" + + +post_install() { + vlicense LICENSE + vsv forgejo + vinstall custom/conf/app.example.ini 0640 /etc forgejo.conf +}