
3 changed files with 105 additions and 0 deletions
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
[Unit] |
||||
Description=Gitea-Group-Sync |
||||
After=syslog.target |
||||
After=network.target |
||||
After=gitea.service |
||||
|
||||
[Service] |
||||
# Modify these two values and uncomment them if you have |
||||
# repos with lots of files and get an HTTP error 500 because |
||||
# of that |
||||
### |
||||
#LimitMEMLOCK=infinity |
||||
#LimitNOFILE=65535 |
||||
Type=simple |
||||
User=git |
||||
Group=git |
||||
Environment="REP_TIME=@every 15m" |
||||
ExecStart=/usr/bin/gitea-group-sync --config /etc/gitea-group-sync/config.yaml |
||||
|
||||
[Install] |
||||
WantedBy=multi-user.target |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
[Unit] |
||||
Description=Gitea-Group-Sync |
||||
|
||||
[Timer] |
||||
OnUnitActiveSec=10s |
||||
OnBootSec=10s |
||||
OnCalendar=*-*-* *:00/30:05 |
||||
|
||||
[Install] |
||||
WantedBy=multi-user.target |
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
%global _hardened_build 1 |
||||
%define gitea_user git |
||||
%define gitea_group git |
||||
%define gitea_home /var/lib/gitea/ |
||||
%define gitea_logdir /var/log/gitea/ |
||||
|
||||
Name : gitea-group-sync |
||||
Version : 20210929 |
||||
Release : 1%{dist} |
||||
License : MIT |
||||
URL : http://gitea.io |
||||
Summary : Git with a cup of tea |
||||
Source0 : gitea-group-sync.service |
||||
Source1 : gitea-group-sync.timer |
||||
BuildRequires: golang |
||||
BuildRequires: git |
||||
Requires : git |
||||
|
||||
|
||||
%description |
||||
Gitea is a community managed fork of Gogs, lightweight code hosting solution written in Go and published under the MIT license. |
||||
|
||||
|
||||
%prep |
||||
%setup -T -q -c %{name}-%{version} |
||||
export GOPATH=`pwd` |
||||
mkdir -p go/src/github.com/gitea-group-sync/ |
||||
cd go/src/github.com/gitea-group-sync/ |
||||
git clone https://github.com/gitea-group-sync/gitea-group-sync |
||||
|
||||
|
||||
%build |
||||
export GOPATH=`pwd` |
||||
export GO111MODULE=on |
||||
cd go/src/github.com/gitea-group-sync/gitea-group-sync |
||||
go build -v -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -buildid "%{version}" -X 'main.Version="%{version}"' -X 'main.MakeVersion="%{release}"'" |
||||
|
||||
|
||||
%install |
||||
install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/gitea-group-sync.service |
||||
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/gitea-group-sync.timer |
||||
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}/ |
||||
install -p -D -m 0644 go/src/github.com/gitea-group-sync/gitea-group-sync/config.yaml %{buildroot}%{_sysconfdir}/%{name}/config.yaml |
||||
install -p -D -m 0555 go/src/github.com/gitea-group-sync/gitea-group-sync/gitea-group-sync %{buildroot}%{_bindir}/gitea-group-sync |
||||
|
||||
|
||||
%pre |
||||
getent group %{gitea_group} > /dev/null || groupadd -r %{gitea_group} |
||||
getent passwd %{gitea_user} > /dev/null || \ |
||||
useradd -r -d %{gitea_home} -g %{gitea_group} \ |
||||
-s /bin/bash -c "git user" %{gitea_user} |
||||
exit 0 |
||||
|
||||
|
||||
%post |
||||
%systemd_post gitea-group-sync.service |
||||
|
||||
|
||||
%preun |
||||
%systemd_preun gitea-group-sync.service |
||||
|
||||
|
||||
%postun |
||||
%systemd_postun gitea-group-sync.service |
||||
|
||||
|
||||
%files |
||||
%config(noreplace) %{_sysconfdir}/%{name}/config.yaml |
||||
%{_bindir}/gitea-group-sync |
||||
%{_unitdir}/gitea-group-sync.service |
||||
%{_unitdir}/gitea-group-sync.timer |
||||
|
||||
|
||||
%changelog |
Loading…
Reference in new issue