gitlab-shell/gitlab-shell.spec

122 lines
4.0 KiB
RPMSpec
Raw Normal View History

%define gitlab_uid 65434
%define gitlab_gid 65434
%define homedir %{_localstatedir}/lib/gitlab
Name: gitlab-shell
Version: 13.18.0
Release: 1mamba
Summary: GitLab ssh access and repository management
Group: Applications/Development
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://github.com/gitlabhq/gitlab-shell
Source: https://gitlab.com/gitlab-org/gitlab-shell/-/archive/v%{version}/gitlab-shell-v%{version}.tar.gz
Source1: gitlab-shell.gitconfig
Patch0: gitlab-shell-configs.patch
License: MIT
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
## AUTOBUILDREQ-END
BuildRequires: go
Requires: git
%description
GitLab Shell is an application that allows you to execute git commands and provide ssh access to git repositories. It is not a unix shell nor a replacement for Bash or Zsh.
%debug_package
%prep
%setup -q -n gitlab-shell-v%{version}
#-D -T
#:<< _EOF
%patch0 -p1
%build
#:<< _EOF
export CGO_CPPFLAGS="%{optflags}"
export CGO_CFLAGS="%{optflags}"
export CGO_CXXFLAGS="%{optflags}"
#export CGO_LDFLAGS="${LDFLAGS}"
#export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
make build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
install -d -m0755 %{buildroot}%{homedir}/{.ssh,satellites}
install -d -m0755 %{buildroot}%{_localstatedir}/log/gitlab
install -d -m0755 %{buildroot}%{_datadir}/gitlab-shell
# .gitconfig
install -D -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/gitlab/gitconfig
ln -fs %{_sysconfdir}/gitlab/gitconfig %{buildroot}%{homedir}/.gitconfig
# .gitlab_shell_secret
touch %{buildroot}%{_sysconfdir}/gitlab/gitlab-shell-secret
ln -fs %{_sysconfdir}/gitlab/gitlab-shell-secret %{buildroot}%{_datadir}/gitlab-shell/.gitlab_shell_secret
# config.yml
install -Dm644 config.yml.example %{buildroot}%{_sysconfdir}/gitlab/gitlab-shell-config.yml
ln -fs %{_sysconfdir}/gitlab/gitlab-shell-config.yml %{buildroot}%{_datadir}/gitlab-shell/config.yml
cp -r VERSION bin spec support %{buildroot}%{_datadir}/gitlab-shell/
ln -fs %{_datadir}/gitlab-shell %{buildroot}%{homedir}/
# Compatibility for FS#64251
ln -s gitlab-shell %{buildroot}%{_datadir}/gitlab-shell/bin/gitlab-shell-ruby
install -d -m770 %{buildroot}%{homedir}/repositories
touch %{buildroot}%{homedir}/.ssh/authorized_keys
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
if [ $1 -ge 1 ]; then
/usr/sbin/groupadd gitlab -g %{gitlab_gid} 2>/dev/null
/usr/sbin/useradd -u %{gitlab_uid} -c 'Gitlab user' -d %{homedir} -g gitlab \
-s %{_datadir}/gitlab-shell/bin/gitlab-shell gitlab 2>/dev/null
fi
:
%post
if [ $1 -eq 1 ]; then
echo "Configure gitlab-shell in /etc/gitlab/gitlab-shell-config.yml"
echo "Put a secret bytestring to /etc/gitlab/gitlab-shell-secret"
fi
if [ $1 -gt 1 ]; then
echo "If you have previously installed gitlab-shell and now git pull fails on a repo, try changing the shell:"
echo "usermod -s /usr/share/gitlab-shell/bin/gitlab-shell gitlab"
fi
:
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/gitlab/gitlab-shell-config.yml
%config(noreplace) %{_sysconfdir}/gitlab/gitlab-shell-secret
%config(noreplace) %{_sysconfdir}/gitlab/gitconfig
%dir %{_datadir}/gitlab-shell
%{_datadir}/gitlab-shell/*
%{_datadir}/gitlab-shell/.gitlab_shell_secret
%dir %attr(0750,gitlab,gitlab) %{homedir}
%dir %attr(0700,gitlab,gitlab) %{homedir}/.ssh
%config(noreplace) %attr(0600,gitlab,gitlab) %{homedir}/.ssh/authorized_keys
%dir %attr(0750,gitlab,gitlab) %{homedir}/satellites
%dir %attr(2770,gitlab,gitlab) %{homedir}/repositories
%{homedir}/.gitconfig
%{homedir}/gitlab-shell
%attr(0770,gitlab,root) %dir %{_localstatedir}/log/gitlab
%doc LICENSE
%changelog
* Tue May 11 2021 Automatic Build System <autodist@mambasoft.it> 13.18.0-1mamba
- automatic version update by autodist
* Sun Mar 28 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 13.17.0-1mamba
- update to 13.17.0
* Mon Jun 02 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 1.9.5-1mamba
- package created using the webbuild interface