A new user interface for you! Read more...

File gitlab-common.spec of Package gitlab-common

#
# spec file for package gitlab-common
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           gitlab-common
Version:        10.0.0
Release:        0
License:        MIT
Summary:        Just some shared directories and users
Url:            http://www.opensuse.org/
Group:          Development/Tools/Version Control
BuildArch:      noarch
Source1:        gitlab-generate-secrets
PreReq:         /usr/sbin/useradd /usr/sbin/groupadd
PreReq:         dash
%define rb_suffix    ruby2.6
Requires(post): %{rb_suffix}

%define gitlab_user    gitlab
%define gitlab_group   gitlab
%define git_dir        /srv/gitlab
%define satellites_dir   %{git_dir}/satellites
%define repositories_dir %{git_dir}/repositories
%define build_dir        %{git_dir}/builds
%define shared_dir       %{git_dir}/shared
%define home_dir         %{git_dir}

%define gitlab_pages_user  gitlab-pages
%define gitlab_pages_group gitlab-pages
%define gitlab_pages_dir   /srv/gitlab-pages/

%define gitlab_runner_user  gitlab-runner
%define gitlab_runner_group gitlab-runner
%define gitlab_runner_dir  /srv/gitlab-runner/

%define gitlab_rails_dir   /srv/www/vhosts/gitlab-ce
%define secret_files       .gitlab_shell_secret .gitlab_workhorse_secret .gitlab_pages_secret

%description
Just some shared directories and users for gitlab shell and webapp.

%prep

%build
perl -p -i -e 's|^(#!.*)|#!/usr/bin/ruby.%{rb_suffix}|g' %{SOURCE1}

%install
install -d                                 \
  %{buildroot}%{satellites_dir}            \
  %{buildroot}%{repositories_dir}          \
  %{buildroot}%{build_dir}                 \
  %{buildroot}%{shared_dir}                \
  %{buildroot}%{git_dir}/.ssh/             \
  %{buildroot}%{gitlab_pages_dir}          \
  %{buildroot}%{_datadir}/gitlab/          \
  %{buildroot}%{_libdir}/gitlab/           \
  %{buildroot}%{gitlab_runner_dir}         \
  %{buildroot}%{gitlab_rails_dir}          \
  %{buildroot}%{_prefix}/lib/gitlab/shell/

touch %{buildroot}%{git_dir}/.ssh/authorized_keys
pushd %{buildroot}%{gitlab_rails_dir}/
touch %{secret_files}
popd
pushd %{buildroot}%{_prefix}/lib/gitlab/shell/
ln -sf %{gitlab_rails_dir}/.gitlab_shell_secret
popd

install -m 0755 %{SOURCE1} %{buildroot}%{_prefix}/lib/gitlab/gitlab-generate-secrets

chmod -R u=rwX,g=rX,o= %{buildroot}%{git_dir}
chmod    u=rwX,g=rX,o=X %{buildroot}%{git_dir}
chmod    u=rwX,g=rX,o=X %{buildroot}%{shared_dir}
chmod    u=rwX,g=rX,o=X %{buildroot}%{gitlab_rails_dir}
chmod -R go= %{buildroot}%{git_dir}/.ssh/

%pre
/usr/sbin/groupadd -r %{gitlab_group}  &>/dev/null || :
/usr/sbin/useradd  -g %{gitlab_group} -s /bin/dash -r -c "GitLab" -d %{home_dir} %{gitlab_user} &>/dev/null || :

/usr/sbin/groupadd -r %{gitlab_pages_group}  &>/dev/null || :
/usr/sbin/useradd  -g %{gitlab_pages_group} -s /bin/dash -r -c "GitLab Pages" -d %{gitlab_pages_dir} %{gitlab_pages_user} &>/dev/null || :

/usr/sbin/groupadd -r %{gitlab_runner_group}  &>/dev/null || :
/usr/sbin/useradd  -g %{gitlab_runner_group} -s /bin/dash -r -c "GitLab Runner" -d %{gitlab_runner_dir} %{gitlab_runner_user} &>/dev/null || :

%post
%{_prefix}/lib/gitlab/gitlab-generate-secrets

%files
%defattr(-,root,root)
%dir %attr(-,%{gitlab_user},%{gitlab_group}) %{git_dir}
%dir %attr(-,%{gitlab_user},%{gitlab_group}) %{build_dir}
%dir %attr(-,%{gitlab_user},%{gitlab_group}) %{repositories_dir}
%dir %attr(-,%{gitlab_user},%{gitlab_group}) %{satellites_dir}
%dir %attr(-,%{gitlab_user},%{gitlab_group}) %{shared_dir}
%dir %attr(-,%{gitlab_user},%{gitlab_group}) %{git_dir}/.ssh/
%config(noreplace) %attr(-,%{gitlab_user},%{gitlab_group}) %{git_dir}/.ssh/authorized_keys
%dir %attr(-,%{gitlab_user},%{gitlab_group}) %{gitlab_pages_dir}
%dir %attr(0750,%{gitlab_runner_user},%{gitlab_runner_group}) %{gitlab_runner_dir}
%dir %{_datadir}/gitlab/
%dir %{_prefix}/lib/gitlab/
%dir %{_prefix}/lib/gitlab/shell/
%{_prefix}/lib/gitlab/gitlab-generate-secrets
%config(noreplace) %attr(0640,root,%{gitlab_group}) %{_prefix}/lib/gitlab/shell/.gitlab_shell_secret
%dir /srv/www/vhosts
%dir %attr(-,root,%{gitlab_group})  %{gitlab_rails_dir}
%config(noreplace) %attr(0640,root,%{gitlab_group}) %{gitlab_rails_dir}/.gitlab_pages_secret
%config(noreplace) %attr(0640,root,%{gitlab_group}) %{gitlab_rails_dir}/.gitlab_shell_secret
%config(noreplace) %attr(0640,root,%{gitlab_group}) %{gitlab_rails_dir}/.gitlab_workhorse_secret

%changelog