7.0.4-alt1
- Initial build (based on gitea.spec)
This commit is contained in:
parent
533f27b5b7
commit
4f98f82dec
28
disable-strip.patch
Normal file
28
disable-strip.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 0880a15357651a303a1005d80cd5737220e6f622 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Shabalin <shaba@altlinux.org>
|
||||
Date: Wed, 2 Mar 2022 15:04:43 +0300
|
||||
Subject: Disable strip bin files
|
||||
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index a15caf7a8f..4ea717eadf 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -577,7 +577,7 @@ check: test
|
||||
|
||||
.PHONY: install $(TAGS_PREREQ)
|
||||
install: $(wildcard *.go)
|
||||
- CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
|
||||
+ CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) install -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
||||
|
||||
.PHONY: build
|
||||
build: frontend backend
|
||||
@@ -594,7 +594,7 @@ generate: $(TAGS_PREREQ)
|
||||
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' $(GO_PACKAGES)
|
||||
|
||||
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
|
||||
- CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
||||
+ CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $@
|
||||
|
||||
.PHONY: release
|
||||
release: frontend generate release-windows release-linux release-darwin release-copy release-compress vendor release-sources release-docs release-check
|
42
forgejo.service
Normal file
42
forgejo.service
Normal file
@ -0,0 +1,42 @@
|
||||
[Unit]
|
||||
Description=Forgejo (Beyond coding. We forge.)
|
||||
After=network.target
|
||||
After=mysqld.service mariadb.service
|
||||
After=postgresql.service
|
||||
After=memcached.service
|
||||
After=redis.service
|
||||
|
||||
[Service]
|
||||
LimitNOFILE=65535
|
||||
RestartSec=2s
|
||||
Type=simple
|
||||
User=forgejo
|
||||
Group=forgejo
|
||||
WorkingDirectory=/var/lib/forgejo
|
||||
RuntimeDirectory=forgejo
|
||||
RuntimeDirectoryPreserve=yes
|
||||
ExecStart=/usr/bin/forgejo web -c /etc/forgejo/app.ini
|
||||
Restart=always
|
||||
Environment=USER=forgejo HOME=/var/lib/forgejo FORGEJO_WORK_DIR=/var/lib/forgejo
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectSystem=yes
|
||||
ProtectHome=yes
|
||||
PrivateUsers=yes
|
||||
ProtectHostname=yes
|
||||
ProtectClock=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelLogs=yes
|
||||
ProtectControlGroups=yes
|
||||
LockPersonality=yes
|
||||
MemoryDenyWriteExecute=yes
|
||||
RestrictRealtime=yes
|
||||
RestrictSUIDSGID=yes
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
SystemCallErrorNumber=EPERM
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
17
forgejo.service.d.conf
Normal file
17
forgejo.service.d.conf
Normal file
@ -0,0 +1,17 @@
|
||||
[Service]
|
||||
#LimitMEMLOCK=infinity
|
||||
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
|
||||
# LimitNOFILE=524288:524288
|
||||
# If you want to bind Forgejo to a port below 1024 uncomment
|
||||
# the two values below
|
||||
###
|
||||
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
###
|
||||
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
|
||||
# set the following value to false to allow capabilities to be applied on gitea process. The following
|
||||
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
|
||||
# in the host user namespace.
|
||||
###
|
||||
#PrivateUsers=false
|
||||
###
|
115
forgejo.spec
Normal file
115
forgejo.spec
Normal file
@ -0,0 +1,115 @@
|
||||
%global import_path code.gitea.io/gitea
|
||||
%global _unpackaged_files_terminate_build 1
|
||||
|
||||
Name: forgejo
|
||||
Version: 7.0.4
|
||||
Release: alt1
|
||||
|
||||
Summary: Self-hosted lightweight software forge
|
||||
|
||||
License: MIT
|
||||
Group: Development/Other
|
||||
Url: https://forgejo.org
|
||||
Vcs: https://codeberg.org/forgejo/forgejo.git
|
||||
Source: %name-%version.tar
|
||||
|
||||
Source2: %name.service
|
||||
Source3: %name.service.d.conf
|
||||
|
||||
Patch3: disable-strip.patch
|
||||
|
||||
BuildRequires(pre): rpm-macros-golang
|
||||
BuildRequires: golang >= 1.22 rpm-build-golang
|
||||
BuildRequires: libpam-devel
|
||||
BuildRequires: /proc
|
||||
|
||||
Requires: git-core
|
||||
|
||||
%description
|
||||
Forgejo is a self-hosted lightweight software forge.
|
||||
Easy to install and low maintenance, it just does the job
|
||||
|
||||
Brought to you by an inclusive community under the umbrella
|
||||
of Codeberg e.V., a democratic non-profit organization,
|
||||
Forgejo can be trusted to be exclusively Free Software. It
|
||||
is a "soft" fork of Gitea with a focus on scaling, federation
|
||||
and privacy.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
%patch3 -p1
|
||||
|
||||
sed -i \
|
||||
-e "s|^APP_NAME = ; Gitea: Git with a cup of tea|APP_NAME = Forgejo: Beyond coding. We Forge.|" \
|
||||
-e "s|^RUN_USER =|RUN_USER = forgejo|" \
|
||||
-e "s|^HTTP_ADDR = 0.0.0.0|HTTP_ADDR = 127.0.0.1|" \
|
||||
-e "s|^;APP_DATA_PATH = data|;APP_DATA_PATH = %_localstatedir/%name/data|" \
|
||||
-e "s|^;STATIC_ROOT_PATH =|;STATIC_ROOT_PATH = %_datadir/%name|" \
|
||||
-e "s|^;ROOT_PATH =|;ROOT_PATH = %_logdir/%name|" \
|
||||
-e "s|^DB_TYPE = mysql|;DB_TYPE = mysql|" \
|
||||
-e "s|^HOST = 127.0.0.1:3306|;HOST = 127.0.0.1:3306|" \
|
||||
-e "s|^NAME = gitea|;NAME = gitea|" \
|
||||
-e "s|^USER = root|;USER = root|" \
|
||||
-e "s|^;DB_TYPE = sqlite3|DB_TYPE = sqlite3|" \
|
||||
custom/conf/app.example.ini
|
||||
|
||||
sed -i -e "s|gitea|%name|g" contrib/autocompletion/*_autocomplete
|
||||
|
||||
%build
|
||||
export BUILDDIR="$PWD/.gopath"
|
||||
export IMPORT_PATH="%import_path"
|
||||
export GOPATH="$BUILDDIR:%go_path"
|
||||
export LDFLAGS="-X code.gitea.io/gitea/modules/setting.CustomConf=%_sysconfdir/%name/app.ini \
|
||||
-X code.gitea.io/gitea/modules/setting.CustomPath=%_localstatedir/%name/custom \
|
||||
-X code.gitea.io/gitea/modules/setting.AppWorkPath=%_localstatedir/%name"
|
||||
export TAGS="bindata timetzdata sqlite sqlite_unlock_notify pam"
|
||||
%make all
|
||||
%gobuild -o %name-environment-to-ini contrib/environment-to-ini/environment-to-ini.go
|
||||
|
||||
%install
|
||||
mkdir -p %buildroot%_localstatedir/%name/custom
|
||||
mkdir -p %buildroot%_logdir/%name
|
||||
install -Dm 0755 gitea %buildroot%_bindir/%name
|
||||
install -Dm 0755 %name-environment-to-ini %buildroot%_bindir/%name-environment-to-ini
|
||||
install -Dm 0644 %SOURCE2 %buildroot%_unitdir/%name.service
|
||||
mkdir -p %buildroot%_sysconfdir/systemd/system/%name.service.d
|
||||
install -Dm 0644 %SOURCE3 %buildroot%_sysconfdir/systemd/system/%name.service.d/port.conf
|
||||
install -Dm 0660 custom/conf/app.example.ini %buildroot%_sysconfdir/%name/app.ini
|
||||
|
||||
# install docs
|
||||
mkdir -p %buildroot%_man1dir
|
||||
%buildroot%_bindir/%name docs --man > %buildroot%_man1dir/%name.1
|
||||
|
||||
# install completions
|
||||
install -D -p -m 0644 contrib/autocompletion/bash_autocomplete %buildroot%_datadir/bash-completion/completions/%name
|
||||
install -D -p -m 0644 contrib/autocompletion/zsh_autocomplete %buildroot%_datadir/zsh/site-functions/_%name
|
||||
|
||||
%pre
|
||||
groupadd -r -f %name 2>/dev/null ||:
|
||||
useradd -r -g %name -c 'Forgejo daemon' \
|
||||
-s /bin/bash -d %_localstatedir/%name %name 2>/dev/null ||:
|
||||
|
||||
%post
|
||||
%post_service %name
|
||||
|
||||
%preun
|
||||
%preun_service %name
|
||||
%files
|
||||
%doc *.md custom/conf/app.example.ini
|
||||
%_bindir/%name
|
||||
%_bindir/%name-environment-to-ini
|
||||
%dir %attr(0750,%name,%name) %_localstatedir/%name
|
||||
%dir %attr(0750,%name,%name) %_localstatedir/%name/custom
|
||||
%dir %attr(0770,root,%name) %_logdir/%name
|
||||
%dir %_sysconfdir/%name
|
||||
%config(noreplace) %attr(0660,root,%name) %_sysconfdir/%name/app.ini
|
||||
%dir %_sysconfdir/systemd/system/%name.service.d
|
||||
%config(noreplace) %_sysconfdir/systemd/system/%name.service.d/port.conf
|
||||
%_unitdir/%name.service
|
||||
%_man1dir/*
|
||||
%_datadir/bash-completion/completions/%name
|
||||
%_datadir/zsh/site-functions/_%name
|
||||
|
||||
%changelog
|
||||
* Mon Jul 01 2024 Alexey Shabalin <shaba@altlinux.org> 7.0.4-alt1
|
||||
- Initial build (based on gitea.spec)
|
Loading…
Reference in New Issue
Block a user