From bfe1b5da4b4465cb4e518dc7101f8284a7f1b174 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Tue, 1 Dec 2015 11:50:27 +0100 Subject: [PATCH] added ebuild for dev-vcs/gitlab-shell-2.6.8 --- dev-vcs/gitlab-shell/Manifest | 2 + .../gitlab-shell/gitlab-shell-2.6.8.ebuild | 126 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 dev-vcs/gitlab-shell/gitlab-shell-2.6.8.ebuild diff --git a/dev-vcs/gitlab-shell/Manifest b/dev-vcs/gitlab-shell/Manifest index 74f662a..cd5afd6 100644 --- a/dev-vcs/gitlab-shell/Manifest +++ b/dev-vcs/gitlab-shell/Manifest @@ -2,7 +2,9 @@ AUX gitlab-shell-2.0.0-config-paths.patch 1356 SHA256 442a8e18b4d8e6092db0d39659 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 diff --git a/dev-vcs/gitlab-shell/gitlab-shell-2.6.8.ebuild b/dev-vcs/gitlab-shell/gitlab-shell-2.6.8.ebuild new file mode 100644 index 0000000..46f4828 --- /dev/null +++ b/dev-vcs/gitlab-shell/gitlab-shell-2.6.8.ebuild @@ -0,0 +1,126 @@ +# 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}." +}