150 lines
3.6 KiB
RPMSpec
150 lines
3.6 KiB
RPMSpec
ExclusiveArch: %{go_arches}
|
|
%if 0%{?el8}
|
|
%global debug_package %{nil}
|
|
%endif
|
|
|
|
Name: gogs
|
|
Version: 0.11.91
|
|
Release: 2%{?dist}
|
|
Summary: Go GIT Server
|
|
|
|
License: MIT
|
|
URL: https://gogs.io/
|
|
Source0: https://github.com/gogs/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
|
|
|
BuildRequires: golang
|
|
BuildRequires: pam-devel
|
|
Requires(pre): /usr/bin/getent
|
|
Requires(pre): /usr/sbin/useradd
|
|
Requires: git
|
|
|
|
%description
|
|
|
|
|
|
%prep
|
|
%setup -q -c
|
|
%{__mkdir_p} src/github.com/gogs
|
|
mv %{name}-%{version} src/github.com/gogs/gogs
|
|
|
|
%build
|
|
export GOPATH=%{gopath}:$(pwd)
|
|
|
|
cd src/github.com/gogs/gogs
|
|
|
|
case ${RPM_ARCH} in
|
|
i386)
|
|
GOARCH=386
|
|
;;
|
|
x86_64)
|
|
GOARCH=amd64
|
|
;;
|
|
*)
|
|
echo UNKNOWN ${RPM_ARCH}
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
case ${RPM_OS} in
|
|
linux)
|
|
GOOS=linux
|
|
;;
|
|
*)
|
|
echo UNKNOWN ${RPM_OS}
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
export GOARCH
|
|
export GOOS
|
|
|
|
|
|
#
|
|
# It is best practice to always use external packages, rather than bundled
|
|
# content. As not all of these packages are yet available in Fedora, we will
|
|
# save this for a future date.
|
|
#
|
|
# rm -fr vendor
|
|
#
|
|
|
|
#
|
|
# Using -a to force everything to compile
|
|
#
|
|
# Using -v to display what is happening
|
|
#
|
|
go build -a -v -tags 'cert pam sqlite'
|
|
sed -i \
|
|
-e '/^#/d' \
|
|
-e 's|^DISABLE_SSH\s.*$|DISABLE_SSH = true|g' \
|
|
-e 's|^HTTP_ADDR\s.*$|HTTP_ADDR = localhost|g' \
|
|
-e 's|^ROOT\s=.*$|ROOT = /var/lib/gogs/repositories|g' \
|
|
-e 's|^ROOT_PATH\s=.*$|ROOT_PATH = /var/log/gogs|g' \
|
|
-e 's|^RUN_MODE\s=.*$|RUN_MODE = prod|g' \
|
|
-e 's|^RUN_USER\s=.*$|RUN_USER = gogs|g' \
|
|
-e 's|^STATIC_ROOT_PATH\s=.*$|STATIC_ROOT_PATH = /var/lib/gogs|g' \
|
|
-e 's|^TLS_MIN_MODE\s=.*$|TLS_MIN_MODE = TLS12|g' \
|
|
-e 's|^USER\s=.*$|USER = gogs|g' \
|
|
conf/app.ini
|
|
sed -i \
|
|
-e 's|^User=.*$|User=gogs|g' \
|
|
-e 's|^Group=.*$|Group=gogs|g' \
|
|
-e 's|^WorkingDirectory=.*$|WorkingDirectory=/var/lib/gogs|g' \
|
|
-e 's|^ExecStart=.*$|ExecStart=%{_bindir}/gogs web|g' \
|
|
-e 's|^Environment=.*$|Environment=USER=gogs HOME=/var/lib/gogs GOGS_CUSTOM=/etc/gogs|g' \
|
|
scripts/systemd/gogs.service
|
|
|
|
|
|
%install
|
|
rm -rf %{buildroot}
|
|
cd src/github.com/gogs/gogs
|
|
%{__install} -d %{buildroot}%{_bindir}
|
|
%{__install} -d %{buildroot}%{_sysconfdir}/gogs
|
|
%{__install} -d %{buildroot}/usr/lib/systemd/system
|
|
%{__install} -d %{buildroot}/var/lib/gogs
|
|
%{__install} -d %{buildroot}/var/log/gogs
|
|
%{__install} -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
|
|
%{__cp} -rp conf %{buildroot}%{_sysconfdir}/gogs/
|
|
%{__install} -p -m 0644 scripts/systemd/gogs.service %{buildroot}/usr/lib/systemd/system/gogs.service
|
|
%{__cp} -rp templates %{buildroot}/var/lib/gogs/
|
|
%{__cp} -rp public %{buildroot}/var/lib/gogs/
|
|
|
|
|
|
%pre
|
|
getent passwd gogs > /dev/null 2>&1 || useradd -r -d /var/lib/gogs -s /bin/bash gogs
|
|
|
|
|
|
%files
|
|
%license src/github.com/gogs/gogs/LICENSE
|
|
%doc src/github.com/gogs/gogs/README.md
|
|
%doc src/github.com/gogs/gogs/README_ZH.md
|
|
%doc src/github.com/gogs/gogs/scripts/mysql.sql
|
|
%attr(0700, gogs, gogs) %dir /var/lib/gogs
|
|
%attr(0700, gogs, gogs) %dir /var/log/gogs
|
|
%{_bindir}/%{name}
|
|
%attr(0644, root, root) /usr/lib/systemd/system/gogs.service
|
|
%attr(-, gogs, gogs) %config(noreplace) %{_sysconfdir}/gogs
|
|
%attr(-, gogs, gogs) %config(noreplace) /var/lib/gogs/templates
|
|
%attr(-, gogs, gogs) %config(noreplace) /var/lib/gogs/public
|
|
|
|
|
|
%changelog
|
|
* Sun Sep 22 2019 Jason Rothstein
|
|
- recompile
|
|
|
|
* Thu Aug 15 2019 Jason Rothstein
|
|
- Version bump to 0.11.91
|
|
|
|
* Sun Jul 28 2019 Jason Rothstein
|
|
- Add git as a requirement
|
|
|
|
* Thu Jul 04 2019 Jason Rothstein
|
|
- Fix permissions so that SSH access works
|
|
- Fix permissions on systemd unit file
|
|
|
|
* Mon Feb 18 2019 Jason Rothstein
|
|
- Version bump
|
|
- make config files noreplace
|
|
|
|
* Fri Dec 28 2018 Jason Rothstein
|
|
- initial version
|
|
|