%global homedir %{_datadir}/gitlab %global repodir %{_sharedstatedir}/gitlab %global confdir %{_sysconfdir}/gitlab %global logdir %{_localstatedir}/log/gitlab Summary: ssh access and repository management for GitLab Name: gitlab-shell Version: 1.7.1 Release: 2%{?dist} Group: Applications/Internet License: MIT URL: https://github.com/gitlabhq/gitlab-shell Source0: https://github.com/gitlabhq/gitlab-shell/archive/v%{version}.tar.gz Requires: ruby(release) Requires(post): shadow-utils BuildRequires: rubygem(rspec) BuildRequires: rubygem(vcr) BuildRequires: rubygem(webmock) BuildRequires: git BuildArch: noarch Provides: %{name} = %{version}-%{release} %description ssh access and repository management for use with GitLab %package doc Summary: Documentation for %{name} Group: Documentation Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc Documentation for %{name} %prep %setup -q %build %install # Prepare directory structure install -dm755 %{buildroot}%{homedir} install -dm755 %{buildroot}%{homedir}/%{name} install -dm770 %{buildroot}%{repodir} install -dm700 %{buildroot}%{repodir}/.ssh/ install -dm770 %{buildroot}%{repodir}/repositories/ install -dm770 %{buildroot}%{repodir}/satellites/ install -dm755 %{buildroot}%{confdir} install -dm755 %{buildroot}%{logdir} touch %{buildroot}%{repodir}/.ssh/authorized_keys chmod 600 %{buildroot}%{repodir}/.ssh/authorized_keys chmod g+s %{buildroot}%{repodir}/repositories/ # Change paths in config file sed -e "s|user: git|user: gitlab|" \ -e "s|/home/git/repositories|%{repodir}/repositories|" \ -e "s|/home/git|%{repodir}|" \ -e "s|# log_file: \"/home/git/%{name}/%{name}.log\"|log_file: \"%{logdir}/%{name}.log\"|" \ config.yml.example > %{buildroot}%{confdir}/%{name}.yml ln -svf %{confdir}/%{name}.yml %{buildroot}%{homedir}/%{name}/config.yml cp -a CHANGELOG LICENSE README.md VERSION bin hooks lib spec support %{buildroot}%{homedir}/%{name} %check #pushd %{buildroot}%{homedir}/%{name} # Copy needed config.yml sed -e "s|user: git|user: gitlab|" \ -e "s|/home/git/repositories|%{buildroot}%{repodir}/repositories|" \ -e "s|/home/git|%{buildroot}%{repodir}|" \ -e "s|# log_file: \"/home/git/gitlab-shell/gitlab-shell.log\"|log_file: \"%{buildroot}%{logdir}/gitlab-shell.log\"|" \ config.yml.example > config.yml rspec spec/ #popd #rm %{buildroot}%{logdir}/%{name}.log %post # Add the "gitlab" user and group getent group gitlab >/dev/null 2>&1 || groupadd -r gitlab &>/dev/null getent passwd gitlab >/dev/null 2>&1 || \ useradd -r -g gitlab -d %{homedir} -s /sbin/nologin -c "GitLab" gitlab &>/dev/null chown -R gitlab:gitlab %{homedir} chown -R gitlab:gitlab %{repodir} chmod -R go-rwx %{repodir}/.ssh/ chmod g+s %{repodir}/repositories/ exit 0 %files %config(noreplace) %{confdir}/%{name}.yml %config(noreplace) %{repodir}/.ssh/authorized_keys # /var/lib/gitlab %dir %{repodir} %{repodir}/repositories/ %{repodir}/satellites/ %{repodir}/.ssh/ # /usr/share/gitlab %dir %{homedir} %{homedir}/%{name}/bin/ %{homedir}/%{name}/lib/ %{homedir}/%{name}/hooks/ %{homedir}/%{name}/support/ %doc %{homedir}/%{name}/LICENSE %{homedir}/%{name}/config.yml #%{logdir}/%{name}.log %files doc %doc %{homedir}/%{name}/README.md %doc %{homedir}/%{name}/CHANGELOG %doc %{homedir}/%{name}/VERSION %{homedir}/%{name}/spec/ %changelog * Tue Sep 24 2013 Axilleas Pipinellis - 1.7.1-2 - Save log to /var/log/gitlab/ * Sat Sep 14 2013 Axilleas Pipinellis - 1.7.1-1 - Initial package