From a6d9845d9ad1f9828a1bf67abef590c8754dc86f Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Mon, 28 Mar 2016 00:07:22 +0200 Subject: [PATCH] added ebuild for dev-vcs/gitlab-shell-2.6.11 --- dev-vcs/gitlab-shell/Manifest | 2 + .../gitlab-shell/gitlab-shell-2.6.11.ebuild | 126 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 dev-vcs/gitlab-shell/gitlab-shell-2.6.11.ebuild diff --git a/dev-vcs/gitlab-shell/Manifest b/dev-vcs/gitlab-shell/Manifest index fd1fab8..02a6b05 100644 --- a/dev-vcs/gitlab-shell/Manifest +++ b/dev-vcs/gitlab-shell/Manifest @@ -1,4 +1,6 @@ AUX gitlab-shell-2.0.0-config-paths.patch 1356 SHA256 442a8e18b4d8e6092db0d39659cba5e41404e90f21070ed50b5460177f28f1b2 SHA512 0445cd42086b2d77825c487d604ddcb11f8fdf4eb8dcdfa1fe1b8e8c24d7b8f273834dbec0bfbb763a35a74605d558cc8d3feaa056eb02a113d18124a764551e WHIRLPOOL 0e3367b229ea4f13818fe2e485dc8da83ad695aec496881cb5eb918b183029b0013518ca64acba1568d93dc418dfaf083c2a86b9f2e3adf9fe15cad038011b30 DIST gitlab-shell-2.6.10.tar.gz 35574 SHA256 c83f1cc9371f90fd0c9907c5cc7e64ba77dff228bb3d427afda999f583ba59a5 SHA512 f03b0d4b1e4b6f3e934acd29ca4e7fb478e7891e31d7fa8e6dfb7cb0d4b1dadd14a88254262d2e71691e01742610a86de1039fd738bde0ba05d6d19fe17fbf10 WHIRLPOOL 6c787b5bdfc6fa0e3ce66a4915d3737fa8fc1f47c1be44c0cecdda802e1bee1cf11f0154d6bb63e799458368bc71553f316024895b2465016d699f597cdfb851 +DIST gitlab-shell-2.6.11.tar.gz 36109 SHA256 58a2b9f1816bed89e084242308901ab7e468ebc0b27c5917c7b33427a63bfc5a SHA512 a65124fe3d732e061cedc734bad346c583f39a213cf4367eda5614952b904b65e57936c0f17d67f1d96807dd4f29070f67eea4de5729c50deee49d1cb5a57fa5 WHIRLPOOL 6ffa9ad111c70270fba0ac71d03843ec956d3635e9f27ea16ec2b3b8c5a1a4baf73280aaaee91f5a5f6696a7dc696265b88c8c9d34ff0a9107a43b0507b32f23 EBUILD gitlab-shell-2.6.10.ebuild 3516 SHA256 fbb3c7c08b5ebf3d4543701e9df739c22cc75c41932fa1dfbe3e691bcb97cd47 SHA512 8d40e7b6c83ee242dd21a176eb729e6d72fbc74c79ecad9c2e3f4df81022d9989044ee789364dece11eb4b2d07d3e60e5be8d8378dc0ad3751ed9cf78efa39f8 WHIRLPOOL d191fb8efe6ad3272e612032febed5104bc1fc12d075191ad4b7b6a36190e16ad4b09dcbb08a00cc0933890cd62d9d96facb2b9b5f2024d45f54587dc8e3ce0c +EBUILD gitlab-shell-2.6.11.ebuild 3516 SHA256 5ae386bd0f8960b1d068530a5b8502651c76cb43195502f76551a4249a510efc SHA512 ed9d009a894ee3ae2f1d140aec64f8c9ad4013178419f87f96e57f5cda4dbd7b099436568cf3d718d25753e405d859bb7bc8aea2c4683a14b024b942503eaa13 WHIRLPOOL b325873e31a1b5b8afaa4ba3678ae8435c20678b5ad720482283f48ba217f48cfe50c533b13c7e9bfb4e32719dc8155512d743b7f7db3dae6262e07612519331 MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431 diff --git a/dev-vcs/gitlab-shell/gitlab-shell-2.6.11.ebuild b/dev-vcs/gitlab-shell/gitlab-shell-2.6.11.ebuild new file mode 100644 index 0000000..de89159 --- /dev/null +++ b/dev-vcs/gitlab-shell/gitlab-shell-2.6.11.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 ~arm ~arm64" +IUSE="" + +DEPEND="" +RDEPEND=" + >=dev-vcs/git-2.7.4 + 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}." +}