Initial working package
This commit is contained in:
		
							
								
								
									
										132
									
								
								gogs.spec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								gogs.spec
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,132 @@ | ||||
| ExclusiveArch:  %{go_arches} | ||||
|  | ||||
| Name:           gogs | ||||
| Version:        0.11.86 | ||||
| Release:        1%{?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 | ||||
|  | ||||
| %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 0755 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 /sbin/nologin 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(0770, gogs, gogs) %dir /var/lib/gogs | ||||
| %attr(0770, gogs, gogs) %dir /var/log/gogs | ||||
| %{_bindir}/%{name} | ||||
| /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 | ||||
| * Mon Feb 18 2019 Jason Rothstein | ||||
| - Version bump | ||||
| - make config files noreplace | ||||
|  | ||||
| * Fri Dec 28 2018 Jason Rothstein | ||||
| - initial version | ||||
|  | ||||
		Reference in New Issue
	
	Block a user