You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

76 lines
2.2 KiB

%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 : 20220525
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
cd gitea-group-sync
sed 's|for j := 1; j < len(teamList); j++ {|for j := 0; j < len(teamList); j++ {|' -i gitea-group-sync.go
%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