]>
Commit | Line | Data |
---|---|---|
d56df2c0 ER |
1 | %define uid 264 |
2 | %define gid 264 | |
3 | %define uname git | |
4 | %define gname git | |
26413cd7 ER |
5 | Summary: GitLab ssh access and repository management |
6 | Name: gitlab-shell | |
29e69209 | 7 | Version: 3.6.0 |
1e4a3972 | 8 | Release: 1 |
26413cd7 ER |
9 | License: MIT |
10 | Group: Applications/Shells | |
5d597017 | 11 | Source0: https://gitlab.com/gitlab-org/gitlab-shell/repository/archive.tar.gz?ref=v%{version}&/%{name}-%{version}.tar.gz |
29e69209 | 12 | # Source0-md5: e863a2b6e978b5da886842822861e327 |
26413cd7 | 13 | Patch0: config.yml.patch |
485fccd3 | 14 | Patch1: unvendor-redis.patch |
7f95a39d | 15 | URL: https://gitlab.com/gitlab-org/gitlab-shell |
f9ba6ab0 ER |
16 | BuildRequires: rpm-rubyprov |
17 | BuildRequires: rpmbuild(macros) >= 1.665 | |
075858cd | 18 | BuildRequires: sed >= 4.0 |
d56df2c0 ER |
19 | Provides: group(%{gname}) |
20 | Provides: user(%{uname}) | |
fff2cd7a | 21 | Conflicts: gitlab-ce < 8.7.5-0.17 |
d56df2c0 ER |
22 | Requires(postun): /usr/sbin/groupdel |
23 | Requires(postun): /usr/sbin/userdel | |
24 | Requires(pre): /bin/id | |
25 | Requires(pre): /usr/bin/getgid | |
26 | Requires(pre): /usr/sbin/groupadd | |
27 | Requires(pre): /usr/sbin/useradd | |
b418b507 | 28 | Requires: git-core >= 2.7.3 |
4ba6f8b0 | 29 | Requires: rsync |
47ac5429 | 30 | Requires: ruby >= 1:2.0 |
df52cff8 | 31 | Requires: ruby-redis >= 3.3.0 |
16fbd2d0 | 32 | Suggests: redis-server |
aa3dd4a4 | 33 | BuildArch: noarch |
26413cd7 ER |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
35 | ||
26413cd7 ER |
36 | %define homedir %{_localstatedir}/lib/gitlab |
37 | ||
38 | %description | |
39 | GitLab Shell is an application that allows you to execute git commands | |
40 | and provide ssh access to git repositories. It is not a Unix shell nor | |
41 | a replacement for Bash or Zsh. | |
42 | ||
43 | %prep | |
5d597017 ER |
44 | %setup -qc |
45 | mv %{name}-*/* . | |
edb0101d | 46 | cp -p config.yml.example config.yml |
26413cd7 | 47 | %patch0 -p1 |
485fccd3 | 48 | %patch1 -p1 |
26413cd7 | 49 | |
075858cd ER |
50 | %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* hooks/* |
51 | ||
485fccd3 ER |
52 | mv lib/vendor . |
53 | ||
edb0101d ER |
54 | # deprecated |
55 | rm support/rewrite-hooks.sh | |
56 | # stupid script, rather not package it at all | |
57 | rm support/truncate_repositories.sh* | |
26413cd7 | 58 | |
26e883d6 ER |
59 | # cleanup backups after patching |
60 | find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f | |
61 | ||
26413cd7 ER |
62 | %install |
63 | rm -rf $RPM_BUILD_ROOT | |
26e883d6 | 64 | install -d $RPM_BUILD_ROOT%{_datadir}/%{name} |
8a08257b | 65 | cp -a VERSION *.yml bin lib hooks support $RPM_BUILD_ROOT%{_datadir}/%{name} |
26413cd7 | 66 | |
edb0101d | 67 | install -d $RPM_BUILD_ROOT%{homedir}/{.ssh,repositories} |
26413cd7 ER |
68 | touch $RPM_BUILD_ROOT%{homedir}/.ssh/authorized_keys |
69 | ||
26413cd7 ER |
70 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/gitlab |
71 | mv $RPM_BUILD_ROOT%{_datadir}/gitlab-shell/config.yml $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/gitlab-shell-config.yml | |
72 | ln -sf %{_sysconfdir}/gitlab/gitlab-shell-config.yml $RPM_BUILD_ROOT%{_datadir}/gitlab-shell/config.yml | |
73 | ||
f9ba6ab0 ER |
74 | # it will attempt to symlink if it doesn't exist |
75 | # /var/lib/gitlab/config/initializers/gitlab_shell_secret_token.rb +18 | |
76 | touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/.gitlab_shell_secret | |
77 | ln -s %{_sysconfdir}/gitlab/.gitlab_shell_secret $RPM_BUILD_ROOT%{_datadir}/%{name}/.gitlab_shell_secret | |
78 | ||
26413cd7 ER |
79 | %clean |
80 | rm -rf $RPM_BUILD_ROOT | |
81 | ||
82 | %pre | |
d56df2c0 ER |
83 | %groupadd -g %{gid} %{gname} |
84 | %useradd -u %{uid} -c 'Git user' -d %{homedir} -g git -s /bin/false %{uname} | |
26413cd7 ER |
85 | |
86 | %post | |
fff2cd7a ER |
87 | %banner -o -e %{name} <<EOF |
88 | ||
89 | To rebuild authorized_keys file, run: | |
90 | ||
91 | # gitlab-rake gitlab:shell:setup | |
92 | ||
93 | http://docs.gitlab.com/ce/raketasks/maintenance.html#rebuild-authorized_keys-file | |
94 | ||
95 | EOF | |
26413cd7 | 96 | |
d56df2c0 ER |
97 | %postun |
98 | if [ "$1" = "0" ]; then | |
99 | %userremove git | |
100 | %groupremove git | |
101 | fi | |
102 | ||
26413cd7 ER |
103 | %files |
104 | %defattr(644,root,root,755) | |
8a08257b | 105 | %doc README.md CHANGELOG LICENSE |
51998476 | 106 | %dir %{_sysconfdir}/gitlab |
f9ba6ab0 | 107 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab-shell-config.yml |
2681706a | 108 | %attr(640,%{uname},%{gname}) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/.gitlab_shell_secret |
26e883d6 ER |
109 | %dir %{_datadir}/%{name} |
110 | %{_datadir}/%{name}/lib | |
111 | %dir %{_datadir}/%{name}/bin | |
112 | %attr(755,root,root) %{_datadir}/%{name}/bin/* | |
f9ba6ab0 | 113 | %{_datadir}/%{name}/.gitlab_shell_secret |
26e883d6 | 114 | %{_datadir}/%{name}/config.yml |
8a08257b | 115 | %{_datadir}/%{name}/VERSION |
26e883d6 ER |
116 | %dir %{_datadir}/%{name}/hooks |
117 | %attr(755,root,root) %{_datadir}/%{name}/hooks/* | |
26e883d6 | 118 | |
51998476 | 119 | %dir %{homedir} |
d56df2c0 ER |
120 | %dir %attr(700,%{uname},%{gname}) %{homedir}/.ssh |
121 | %config(noreplace) %attr(600,%{uname},%{gname}) %{homedir}/.ssh/authorized_keys | |
122 | %dir %attr(2770,%{uname},%{gname}) %{homedir}/repositories |