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