diff --git a/SOURCES/gitea-group-sync.service b/SOURCES/gitea-group-sync.service new file mode 100644 index 0000000..3a0737e --- /dev/null +++ b/SOURCES/gitea-group-sync.service @@ -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 diff --git a/SOURCES/gitea-group-sync.timer b/SOURCES/gitea-group-sync.timer new file mode 100644 index 0000000..9901af3 --- /dev/null +++ b/SOURCES/gitea-group-sync.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Gitea-Group-Sync + +[Timer] +OnUnitActiveSec=10s +OnBootSec=10s +OnCalendar=*-*-* *:00/30:05 + +[Install] +WantedBy=multi-user.target diff --git a/SPECS/gitea-group-sync.spec b/SPECS/gitea-group-sync.spec new file mode 100644 index 0000000..23ad46f --- /dev/null +++ b/SPECS/gitea-group-sync.spec @@ -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