]> git.pld-linux.org Git - packages/gitlab-shell.git/blob - gitlab-shell.spec
own gitlab_shell_secret by git user
[packages/gitlab-shell.git] / gitlab-shell.spec
1 %define uid 264
2 %define gid 264
3 %define uname git
4 %define gname git
5 Summary:        GitLab ssh access and repository management
6 Name:           gitlab-shell
7 Version:        3.6.0
8 Release:        1
9 License:        MIT
10 Group:          Applications/Shells
11 Source0:        https://gitlab.com/gitlab-org/gitlab-shell/repository/archive.tar.gz?ref=v%{version}&/%{name}-%{version}.tar.gz
12 # Source0-md5:  e863a2b6e978b5da886842822861e327
13 Patch0:         config.yml.patch
14 Patch1:         unvendor-redis.patch
15 URL:            https://gitlab.com/gitlab-org/gitlab-shell
16 BuildRequires:  rpm-rubyprov
17 BuildRequires:  rpmbuild(macros) >= 1.665
18 BuildRequires:  sed >= 4.0
19 Provides:       group(%{gname})
20 Provides:       user(%{uname})
21 Conflicts:      gitlab-ce < 8.7.5-0.17
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
28 Requires:       git-core >= 2.7.3
29 Requires:       rsync
30 Requires:       ruby >= 1:2.0
31 Requires:       ruby-redis >= 3.3.0
32 Suggests:       redis-server
33 BuildArch:      noarch
34 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
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
44 %setup -qc
45 mv %{name}-*/* .
46 cp -p config.yml.example config.yml
47 %patch0 -p1
48 %patch1 -p1
49
50 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* hooks/*
51
52 mv lib/vendor .
53
54 # deprecated
55 rm support/rewrite-hooks.sh
56 # stupid script, rather not package it at all
57 rm support/truncate_repositories.sh*
58
59 # cleanup backups after patching
60 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
61
62 %install
63 rm -rf $RPM_BUILD_ROOT
64 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
65 cp -a VERSION *.yml bin lib hooks support $RPM_BUILD_ROOT%{_datadir}/%{name}
66
67 install -d $RPM_BUILD_ROOT%{homedir}/{.ssh,repositories}
68 touch $RPM_BUILD_ROOT%{homedir}/.ssh/authorized_keys
69
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
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
79 %clean
80 rm -rf $RPM_BUILD_ROOT
81
82 %pre
83 %groupadd -g %{gid} %{gname}
84 %useradd -u %{uid} -c 'Git user' -d %{homedir} -g git -s /bin/false %{uname}
85
86 %post
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
96
97 %postun
98 if [ "$1" = "0" ]; then
99         %userremove git
100         %groupremove git
101 fi
102
103 %files
104 %defattr(644,root,root,755)
105 %doc README.md CHANGELOG LICENSE
106 %dir %{_sysconfdir}/gitlab
107 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab-shell-config.yml
108 %attr(640,%{uname},%{gname}) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/.gitlab_shell_secret
109 %dir %{_datadir}/%{name}
110 %{_datadir}/%{name}/lib
111 %dir %{_datadir}/%{name}/bin
112 %attr(755,root,root) %{_datadir}/%{name}/bin/*
113 %{_datadir}/%{name}/.gitlab_shell_secret
114 %{_datadir}/%{name}/config.yml
115 %{_datadir}/%{name}/VERSION
116 %dir %{_datadir}/%{name}/hooks
117 %attr(755,root,root) %{_datadir}/%{name}/hooks/*
118
119 %dir %{homedir}
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
This page took 0.08849 seconds and 3 git commands to generate.