security release 8.2.2. I therefore removed versions 8.2.0 and 8.2.1, along with the vulnerable gitlab-shell-2.6.7

This commit is contained in:
Manuel Friedli 2015-12-04 14:59:45 +01:00
parent aabddf5e1b
commit f498667a79
5 changed files with 3 additions and 500 deletions

View file

@ -1,10 +1,8 @@
AUX gitlab-shell-2.0.0-config-paths.patch 1356 SHA256 442a8e18b4d8e6092db0d39659cba5e41404e90f21070ed50b5460177f28f1b2 SHA512 0445cd42086b2d77825c487d604ddcb11f8fdf4eb8dcdfa1fe1b8e8c24d7b8f273834dbec0bfbb763a35a74605d558cc8d3feaa056eb02a113d18124a764551e WHIRLPOOL 0e3367b229ea4f13818fe2e485dc8da83ad695aec496881cb5eb918b183029b0013518ca64acba1568d93dc418dfaf083c2a86b9f2e3adf9fe15cad038011b30
DIST gitlab-shell-2.6.5.tar.gz 33445 SHA256 586092a62b053adf0b046372aa5983b1170446456cd24e63c145460acc927648 SHA512 52f5c1db5b813dcd68183c6ca02e1fa0eb693040d2e6dedbb903743c285feaddd2a2836726228673eb6da99da07fcd04103e9207443b9f4fb42ba6d1bd4e29db WHIRLPOOL f52937b73942bd2064bc4414f9d4c8b34366dac59912ee926347ba02b7d44c28630a8f530beea82c3df5b6b801db5249080269a9a4e2f8daf33c484a3d203754
DIST gitlab-shell-2.6.6.tar.gz 33660 SHA256 0352a5f9247abac00dbd9914371eafef1b8521879479337a5d520adbe3ec7494 SHA512 f41519bb71331ac4a0cf55deb4cae40030a3b1692d9c85007cff73ee4e4b953d134ad06c321dc27d156f17b8a0946da26e07c7d6813def97945fe88dc8def0ab WHIRLPOOL a93f076eceed3a3f00f61d43c146db10ab4e0c8ec3ddc7e33043a8403230067defdfdeb3a1a103fe591c83d473844389ada318acd808ca1132de4e963cee022d
DIST gitlab-shell-2.6.7.tar.gz 35198 SHA256 15c00d916093d5df8968e652793771442e9c001079edae0b3c87d543540a47c0 SHA512 308cf98462353e7ccdc570b4bfa9a617a6e98fbca54f0824333a0488ce45653544f79ed66bf0ecbaf46ef7d3bb7ed364e6ee09c425c0535e382d1cc7fcc9733f WHIRLPOOL 028c1356fc885024f4ed1e6aa4f225e55531b489c8d84fbe7de7211ac59ba9416fda8a9aecca9385253dbb7f71e615637e8db4b1fbc94b752fb3ecb3fbcc60fb
DIST gitlab-shell-2.6.8.tar.gz 35191 SHA256 196ac258f036ab6d41439b8149ad46dcaeebae727b69bea53a9747c46757ac1c SHA512 8093476675a63b97a56f50838a27fed1f0f355533177927056acdad5d5da450ff4a82242d9b618bc5f6c289820a01f1aaa924787966779e087ce3c8b2c84507d WHIRLPOOL a8a7a8f6dd0a3e49f2a6b6d03200a320802929d5cc283bbf6eddad90644664a3ca8ff14f9ba7760c8026351801f78ce47ca6a5a95d7bc3ab7c1aaad157423d64
EBUILD gitlab-shell-2.6.5.ebuild 3496 SHA256 942e2c5af4d03353b4d5b48a46bcf05c837cf1d0375434ff083ceee7e389ff61 SHA512 34600582b7e2defd8470a2a4f70213f598ac540f57ce9748cdaf16192f1e79a59eb950d1b15231d27b8c07649116364208fd12294e89453159a39f2e56048474 WHIRLPOOL a17a4881720eb0a7e68db927a93cb40d852250acb5b2f6daa4625e5338c6dce6707b90683885ead72769bc9a36d0e173178d3df8616ceab4eb32114955aa2300
EBUILD gitlab-shell-2.6.6.ebuild 3496 SHA256 942e2c5af4d03353b4d5b48a46bcf05c837cf1d0375434ff083ceee7e389ff61 SHA512 34600582b7e2defd8470a2a4f70213f598ac540f57ce9748cdaf16192f1e79a59eb950d1b15231d27b8c07649116364208fd12294e89453159a39f2e56048474 WHIRLPOOL a17a4881720eb0a7e68db927a93cb40d852250acb5b2f6daa4625e5338c6dce6707b90683885ead72769bc9a36d0e173178d3df8616ceab4eb32114955aa2300
EBUILD gitlab-shell-2.6.7.ebuild 3496 SHA256 942e2c5af4d03353b4d5b48a46bcf05c837cf1d0375434ff083ceee7e389ff61 SHA512 34600582b7e2defd8470a2a4f70213f598ac540f57ce9748cdaf16192f1e79a59eb950d1b15231d27b8c07649116364208fd12294e89453159a39f2e56048474 WHIRLPOOL a17a4881720eb0a7e68db927a93cb40d852250acb5b2f6daa4625e5338c6dce6707b90683885ead72769bc9a36d0e173178d3df8616ceab4eb32114955aa2300
EBUILD gitlab-shell-2.6.8.ebuild 3496 SHA256 942e2c5af4d03353b4d5b48a46bcf05c837cf1d0375434ff083ceee7e389ff61 SHA512 34600582b7e2defd8470a2a4f70213f598ac540f57ce9748cdaf16192f1e79a59eb950d1b15231d27b8c07649116364208fd12294e89453159a39f2e56048474 WHIRLPOOL a17a4881720eb0a7e68db927a93cb40d852250acb5b2f6daa4625e5338c6dce6707b90683885ead72769bc9a36d0e173178d3df8616ceab4eb32114955aa2300
MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431

View file

@ -1,126 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View file

@ -17,12 +17,10 @@ AUX gitlab.conf 27 SHA256 cd9be088bbb67a5400407fc6f63c061eb224f16748b7d0812ff2c1
DIST gitlab-ce-7.14.3.tar.gz 6393535 SHA256 3814a3bdff9610b269be15b8cf35701fcdd78a5a80fb1b366269acc49b23f5e4 SHA512 f2088c151b424cbca0fbc65073c1198ea9c3619570ca3543cf5f0ddd193a6105941608df418eeb506bde83f2c0bbd34cea267caaed70092afcca54219e84004d WHIRLPOOL 70574a135eb426e93086502ad7a0d5b73e1070a19c529852fe2aa60c2081d27bbb4289340b73b469ecfd489779cc409bb56de263e47aaa07859ed0a14dd51f44
DIST gitlab-ce-8.0.5.tar.gz 8238566 SHA256 476185a191bfe8757ca1a981419ff5d31449136e76029daa77e89086539d30c6 SHA512 af9d11f0ed744d0c92c9329ba94fe51534996f18dbb2c110d70912cd3ce9e60c3a127b7c8597c95b010b0e2251f98aabdddc314ddae53ab26a44c19b4ba7a7d7 WHIRLPOOL 6e4bc8c43cbfe215efd21a87a5d0395abde4f9998564fc0295d946ffa6a7021d2b5bc2ea625482fb400088bcc57431b3969a6c9dfa0f2121420356d153d297f0
DIST gitlab-ce-8.1.4.tar.gz 8761954 SHA256 619ac3b8c83ac2e3dfa81054b5ae0e76ae81497cf38587410504d6a603181897 SHA512 3973af3480f7e52dc64aec2ef99ff13cac9296fbbc76bfb59387416ee683099109fce361cd1619b4d3fa55032f7e1029b272e07cd15e0b6e353ac6f6c730f2bd WHIRLPOOL d3ce2dfaf013dbd99b023cf9d7ab3494d54d8628093761dd7b9cfe522ac8fb2c00a53d4534843dc292fa38ca1200f2dbe2c376efbd1c40e6e0ca1f9a31762936
DIST gitlab-ce-8.2.0.tar.gz 9957894 SHA256 e8fa11eda35a869546ee43c2f39f68bafbaf7ee7c96896e0d3702a459b148d9f SHA512 af6f02a3d5b1d789089b0dcfce1ea59fc30621ccca6e62edc831e5c85731769bc387db9c8d3d261f09b6b8441a111500c13082d8a2bdb115d9e46542155ff2aa WHIRLPOOL de96d16e44ac6a1354ed9dbc12cc888f43500e0e8028eef89c77a9e73dd72bdec30dce19d891171b9bf1ce79f39937bd073c35b7ea98b4fb78c6a5aef028777d
DIST gitlab-ce-8.2.1.tar.gz 9960073 SHA256 505467b7efcf713a6bada73513aafb58f0be731ec0d5ed2933797ffd74064076 SHA512 8030e60fbc3b61098913cd5debe1e138b95d0cb824f8f8949247d444d9dff9d4dee1e3a4f5bef5078fceee6ffa099dac7fb2aa9429e9dabda10c532226a0fc65 WHIRLPOOL e8c3fbf06a0545c6c2517ac3d285474702ff26c6f2412b5d64bc91513fa122ece10544ed2f3f8718e2214fab28656bb3619f9dfa256a90eb0877538a576c0f5b
DIST gitlab-ce-8.2.2.tar.gz 9960227 SHA256 4d13d74352da255955b6f3c9e641c6f11fb095b5fd5b9ceba7328de30c0bd35b SHA512 cfb3be1538aa60fe99ea9f6df947a8291e7ca76137ff52b1b33c8d2551f40762aec11cf5da6a063cae83fd66a658c75cae13a50c6b30633fe946db31b6e2c779 WHIRLPOOL 5c920f23b779777a1f60e37eef6f8e0ce7b7c2e2748836e3e3fd509f968476166b9f0dce78c55c8456fc6d2c6117dea68ff1061522dd1ffe3d1fa2e0701548fc
EBUILD gitlab-ce-7.14.3.ebuild 10996 SHA256 a632476e8fe87ec1a478d2229f9e27cbe9e7cc86351e411d9f15105178a4c69f SHA512 a8646de0798d7dae299e500e0a42e6b093e229cb666614b895b979decb1d4b6b398ec2b2f1d19e07cc115f2acb16536426d1769b65412bc51349ac1b262b3053 WHIRLPOOL 2ba4e53846507899b3e6ebb38063e11ee92904262b8a6e00817ab50d6634ed0f0b1013f4a0d8a1cbb26e18c4008e5ab457d3cbd0fdc5f92e5c6214cb45c692f5
EBUILD gitlab-ce-8.0.5.ebuild 11185 SHA256 1240818953ae8f61b6c88c91c3c1dd32fb7d03c8a62964f5d3ad2e98ff5dad11 SHA512 fd411dd3cd8a4dd1ee0040438fe5da01f81ccf4f97b7b7b3157fcbb35bfacbfd0eda8754fb01e0061e6b0c5bd0e752b0eaff4d663d11b764623e7baafb4f56da WHIRLPOOL 9514cd8f83c7fbaba82b49352cb9b8e62d1a5317a09bfea85ce945abd1402e634a88f6eb033494729519ac6fc1282c18bfc8224b9bbe6f41ac89a1286b1d5d0a
EBUILD gitlab-ce-8.1.4.ebuild 11177 SHA256 6b920132ff2c4926f2ed3edb3fff7cdf3e88c0314f8a0a9c077cdaae9fad4a0e SHA512 617656f6fd52d0c4751e0726983fc7d2c1532e8bc44761dbbe5bfb7f489e18ef66a68769bb0f7736c9d49d536e8103a5486e92869a9bba4d1aa92c4068eedf6e WHIRLPOOL 1c8a0968a1fa7b95ceb47f66610a72585666cc5b2f7f3157d1f5c04f98a2c89d79ac1875a28c57b3116105d2e0af17dabcecaa00159af42166565ae7fa88647e
EBUILD gitlab-ce-8.2.0.ebuild 10943 SHA256 ff32f176ed10eb1e9186eb94aff1bd2a780a6eeafa1839fef695d8f641634bb0 SHA512 6ad0977fd94d8d3d50de3f4fdee80eac4d6c4e8ce82d93dfd856bc2dd69025877f27e79e5e407a1a17f56b82278053f56930e67e2d9b345ef0eac020d587557d WHIRLPOOL b7c15061a1b23ca21511e103ea1e686e372754f156bf012d81f2a68efc1cbaecbf80bc61306934a7c940f27b273cfa4ac6ec6c460aa0a3179e54078418c5b9e4
EBUILD gitlab-ce-8.2.1.ebuild 11187 SHA256 7c1cd3de0c0d44687b4ba300b0dba4d5042036bdd30830616574e01976199b27 SHA512 dd102a1b82f065022b0cdca59c05f163ffadcc2a40d950f91c8c4ead0f51c25a0a5637fdfa88a53f985def1dbcba5af9c17c436b5fe98a6d7be10682d6c83340 WHIRLPOOL c5dc65cd90c2fd5aa00fb12c65eb1dd65bcd37dd8275cf86dd15758703114ae057cf7c19955cd2c7e24fe403a214c78e9021edfd648d307e384600f8a882eaa4
EBUILD gitlab-ce-8.2.2.ebuild 11149 SHA256 b9ea26478efe2bb798334178589f94c014550360bcce109af55cf9e9431519f1 SHA512 8cb298285f338c2f45a6b2048d597067ecdb51f3c70ab4c893810029b4773a20b7f058c4262019ae9f88cef5cbaf993726b653d5e214005495acb064bc00d83c WHIRLPOOL bbcfa2b53863fe887b2eaf62d1495463f1590eb5f04856dddb2d95f28a9cec377d29eeac04bb90eeaf8be657a7a71c73edac8ee5fc123f905b694aa2a50aeba9
EBUILD gitlab-ce-9999.ebuild 10960 SHA256 9d771927fc3fb9e0227bf909eeb1c3376f05c5a9bbf2571dc214535321436cde SHA512 209d42d491e6ed180773ca6b7252ab3aeb0eb103b9ea935e6e23d79e7e132e1485936db0aa9336104fc3bbb94c73b740080c81967523b0c28dbcc0f14e0abbee WHIRLPOOL b7b9fc3112965cd40c12039f73cb8d9e6bfaeae17c1022e5d3838c599e76f83c31882c9676a83b379dca474f142f1e2ffa9443259e0fc1a761b48f0b4e0ba350
MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1

View file

@ -1,366 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
# Maintainer notes:
# - This ebuild uses Bundler to download and install all gems in deployment mode
# (i.e. into isolated directory inside application). That's not Gentoo way how
# it should be done, but GitLab has too many dependencies that it will be too
# difficult to maintain them via ebuilds.
#
USE_RUBY="ruby21"
PYTHON_COMPAT=( python2_7 )
inherit eutils python-r1 ruby-ng user systemd
MY_PKGNAME="gitlabhq"
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://about.gitlab.com/"
SRC_URI="https://github.com/${MY_PKGNAME}/${MY_PKGNAME}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RUBY_S="${MY_PKGNAME}-${PV}"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos mysql +postgres +unicorn systemd rugged_use_system_libraries"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# rugged dev-util/cmake, virtual/pkgconfig
# json dev-util/ragel
# pygments.rb python 2.7+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-util/ragel
net-libs/nodejs
postgres? ( >=dev-db/postgresql-9.1:* )
mysql? ( virtual/mysql )
kerberos? ( virtual/krb5 )"
CDEPEND="
dev-util/cmake
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.7
dev-vcs/git
~dev-vcs/gitlab-workhorse-0.4.2
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/23 )"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ce/blob/v${PV}/bin/background_jobs
SIDEKIQ_QUEUES="post_receive,mailer,archive_repo,system_hook,project_web_hook,gitlab_shell,incoming_email,runner,common,default"
all_ruby_prepare() {
# fix paths
local satellites_path="${TEMP_DIR}/repo_satellites"
local repos_path=/var/lib/git/repositories
local shell_path=/usr/share/gitlab-shell
sed -i -E \
-e "/satellites:$/,/\w:$/ s|(\s*path:\s).*|\1${satellites_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*path:\s).*|\1${shell_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*repos_path:\s).*|\1${repos_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*hooks_path:\s).*|\1${shell_path}/hooks/|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
local run_path=/run/${MY_NAME}
sed -i -E \
-e "s|/home/git/gitlab/tmp/(pids\|sockets)|${run_path}|" \
-e "s|/home/git/gitlab/log|${LOGS_DIR}|" \
-e "s|/home/git/gitlab|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/git/gitlab/tmp/sockets|${run_path}|" \
lib/support/nginx/gitlab || die "failed to filter nginx/gitlab"
# modify default database settings for PostgreSQL
sed -i -E \
-e 's|(username:).*|\1 gitlab|' \
-e 's|(password:).*|\1 gitlab|' \
-e 's|(socket:).*|\1 /run/postgresql/.s.PGSQL.5432|' \
config/database.yml.postgresql \
|| die "failed to filter database.yml.postgresql"
# rename config files
mv config/gitlab.yml.example config/gitlab.yml
mv config/unicorn.rb.example config/unicorn.rb
local dbconf=config/database.yml
if use postgres && ! use mysql; then
mv ${dbconf}.postgresql ${dbconf}
rm ${dbconf}.mysql
elif use mysql && ! use postgres; then
mv ${dbconf}.mysql ${dbconf}
rm ${dbconf}.postgresql
fi
# remove useless files
rm -r lib/support/{deploy,init.d}
use unicorn || rm config/unicorn.rb
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
diropts -m755
dodir ${conf} ${dest}/public/uploads
dosym ${temp} ${dest}/tmp
dosym ${logs} ${dest}/log
# install configs
insinto ${conf}
doins -r config/*
dosym ${conf} ${dest}/config
echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
# remove needless dirs
rm -Rf config tmp log
# install the rest files
# using cp 'cause doins is slow
cp -Rl * "${D}/${dest}"/
# install logrotate config
dodir /etc/logrotate.d
cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF
${logs}/*.log {
missingok
delaycompress
compress
copytruncate
}
EOF
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test aws"
local flag; for flag in mysql postgres unicorn kerberos; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
use "rugged_use_system_libraries" && export RUGGED_USE_SYSTEM_LIBRARIES="YES"
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
# clean gems cache
rm -Rf vendor/bundle/ruby/*/cache
rm -Rf vendor/bundle/ruby/*/bundler/gems/charlock_holmes-dde194609b35/.git
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
## RC script ##
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dounit "${FILESDIR}/gitlab-workhorse.service"
systemd_dounit "${FILESDIR}/gitlab-mailroom.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq-8.2.init
use unicorn && rcscript=gitlab-unicorn-8.2.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
fi
}
pkg_postinst() {
elog
elog "1. Configure your GitLab's settings in ${CONF_DIR}/gitlab.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Then you should create a database for your GitLab instance, if you"
elog "haven't done so already."
elog
if use postgres; then
elog "If you have local PostgreSQL running, just copy&run:"
elog " su postgres"
elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab gitlabhq_production"
elog " Note: You should change your password to something more random..."
elog
fi
elog "4. Finally execute the following command to initlize environment:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog " Note: Do not forget to start Redis server first!"
elog
elog "If this is an update from previous version, it's HIGHLY recommended"
elog "to backup your database before running the config phase!"
elog
elog "If you're running GitLab behind an SSL proxy such as nginx or Apache and"
elog "you can't login after the upgrade, be sure to read the section about the"
elog "verification of the CSRF token in GitLab's trouble-shooting guide at"
elog "http://goo.gl/5XGRGv."
}
pkg_config() {
local shell_conf='/etc/gitlab-shell.yml'
einfo "Checking configuration files"
if [ ! -r "${CONF_DIR}/database.yml" ]; then
eerror "Copy ${CONF_DIR}/database.yml.* to"
eerror "${CONF_DIR}/database.yml and edit this file in order to configure your"
eerror "database settings for \"production\" environment."; die
fi
# check gitlab-shell configuration
if [ -r ${shell_conf} ]; then
local shell_repos_path="$(ryaml ${shell_conf} repos_path)"
local gitlab_repos_path="$(ryaml ${CONF_DIR}/gitlab.yml \
production gitlab_shell repos_path)"
if [ ! "${shell_repos_path}" -ef "${gitlab_repos_path}" ]; then
eerror "repos_path in ${CONF_DIR}/gitlab.yml and ${shell_conf}"
eerror "must points to the same location! Fix the repos_path location and"
eerror "run this again."; die
fi
else
ewarn "GitLab Shell checks skipped, could not find config file at"
ewarn "${shell_conf}. Make sure that you have gitlab-shell properly"
ewarn "installed and that repos_path is the same as in GitLab."
fi
local email_from="$(ryaml ${CONF_DIR}/gitlab.yml production gitlab email_from)"
local git_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${git_home}/.gitconfig" ]; then
einfo "Setting git user"
su -l ${MY_USER} -c "
git config --global user.email '${email_from}';
git config --global user.name 'GitLab'" \
|| die "failed to setup git name and email"
fi
if [ ! -d "${DEST_DIR}/.git" ]; then
# create dummy git repo as workaround for
# https://github.com/bundler/bundler/issues/2039
einfo "Initializing dummy git repository to avoid false errors from bundler"
su -l ${MY_USER} -c "
cd ${DEST_DIR}
git init
git add README.md
git commit -m 'Dummy repository'" >/dev/null
fi
## Initialize app ##
local RAILS_ENV="production"
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
local dbname="$(ryaml ${CONF_DIR}/database.yml production database)"
if [ -f "${DEST_DIR}/.secret" ]; then
local update=true
einfo "Migrating database ..."
exec_rake db:migrate
# https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496
einfo "Migrating iids ..."
exec_rake migrate_iids
einfo "Cleaning old precompiled assets ..."
exec_rake assets:clean
einfo "Cleaning cache ..."
exec_rake cache:clear
else
local update=false
einfo "Initializing database ..."
exec_rake gitlab:setup
fi
einfo "Precompiling assests ..."
exec_rake assets:precompile
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/"
ewarn "for any additional migration tasks specific to your previous GitLab"
ewarn "version."
fi
}
ryaml() {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
}
exec_rake() {
local command="${BUNDLE} exec rake $@ RAILS_ENV=${RAILS_ENV}"
echo " ${command}"
su -l ${MY_USER} -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${command}" \
|| die "failed to run rake $@"
}

View file

@ -12,9 +12,8 @@ EAPI="5"
#
USE_RUBY="ruby21"
PYTHON_COMPAT=( python2_7 )
inherit eutils python-r1 ruby-ng user systemd
inherit eutils ruby-ng user systemd
MY_PKGNAME="gitlabhq"