From e4683c83b005f941a2c6e4973a5f8d51038605b1 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Tue, 10 Jan 2017 22:48:56 +0100 Subject: [PATCH] added ebuild for gitlab-shell-4.1.1 --- dev-vcs/gitlab-shell/Manifest | 3 + .../gitlab-shell-4.1.1-config-paths.patch | 69 ++++++++++ .../gitlab-shell/gitlab-shell-4.1.1.ebuild | 130 ++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100644 dev-vcs/gitlab-shell/files/gitlab-shell-4.1.1-config-paths.patch create mode 100644 dev-vcs/gitlab-shell/gitlab-shell-4.1.1.ebuild diff --git a/dev-vcs/gitlab-shell/Manifest b/dev-vcs/gitlab-shell/Manifest index 1657ca3..ae69ba1 100644 --- a/dev-vcs/gitlab-shell/Manifest +++ b/dev-vcs/gitlab-shell/Manifest @@ -1,9 +1,12 @@ AUX gitlab-shell-3.2.0-config-paths.patch 1826 SHA256 c83db7c37dcac577ce499eab4bb0168253f49d303ba1991fdec90d13cc3fe37a SHA512 7524b6b8cd7cd141a56c468efa303b1d21576ac9e03cb866cbf9dcac34e1b8d4f356333737050e2e5dfeb0f0ad904b3f548c40e1209c1f35054ed2027b1d8271 WHIRLPOOL fdbd2dfe43ff4a2af97227fbf8c4589ca3734ebf0320b7e9c5e8ea39882c49d45815a0ee3c765a141affacbe48f4063987b9664a918e0e216b49ca46a475cc5f +AUX gitlab-shell-4.1.1-config-paths.patch 2152 SHA256 e789f0c8a8b7ec8a840ce26dd63d6e5386a149f619d7ad5a6788577d897c4826 SHA512 6ae5af0c364061af4c9675804e2f6d6b662ed4891ed4c80bc1be39e9da6343db372e58bf04a0d3c8a4fc218daeb8cda45636e0da0c67ec801168e84004d05b86 WHIRLPOOL b8136b81ef943c15feeca303d1d7f0d55c85ff7f7ec82bfceea026ce334ca24fce0dfb599946562bd0aceb89a2216bcfaa894235c43f41e3031a305f85e756b4 DIST gitlab-shell-3.6.6.tar.gz 77199 SHA256 db3f54b561bb81059256c634967b181707e11cc25e30b0fa76eb034718d0eaf9 SHA512 d1d15687169f7b151caf3b371d6570099129a2a69d7732e6be7337f70aaef7e36c87e8aa5140e9697c7be36185743bb939d862790b440fc18d7a864d570fcb6b WHIRLPOOL 4161901369cc12a89fb89c41bd98cfc2cfdeb5aac6d317597ae11f10bcd401e4c18148ce9a20f5e967a6fb11559f33aa72c82dff1a52764c5a19bcd0f06250c1 DIST gitlab-shell-4.0.0.tar.gz 76582 SHA256 2d8d5e31eac5007a70720465d71c6cee74428a71c2fda7e21ca8393bc8c8966f SHA512 dd44528dc2914025e850b7172df1c5e0b39f8c1764adeea62a824643723c3264c462006ddf0cc6f4519d0caf0c39e6cee601f9f7988eb54138118176178045e4 WHIRLPOOL 462886da23a1723049914759f0b315d39c42488e55dfab4debae57c7b20878a421dac36a77d5e82603119e4eb142c83dbf18e28213670abd81396de1d0c683cf DIST gitlab-shell-4.0.3.tar.gz 76721 SHA256 66f9a3572e6cd06632a267a5248c4878bf48ff62f5360b3108f42100b3ffd361 SHA512 b45027141557403a9e7818dec93b3e790a38887c22f3a2d0f298f1238e51ce4d96f603b2b225433275afd601e7544a611b98ec6711b0ed95228f321fe4b8d898 WHIRLPOOL 836e7476c874cfede14b66ee445cfac08db2cf22f2803fc0def8a20924e2578b441d605d85a923f2951bd5a6a9d11e79f1a15762bd401b8111e61fbe1d28b56e +DIST gitlab-shell-4.1.1.tar.gz 78829 SHA256 61f684b4528b0b789aad80efbfd8f9870d113f6e2794e589e0db9e74e6737e1d SHA512 17b929da1c6148a9af2787ca4a18081e3108622a40c6fb3f02f36f4ba41f2a1d61cf83509ace849093334af8f4ad74d8a36393bf9fca7ab21163d2f48b499879 WHIRLPOOL cfd258e93abeae4a33c1578114d56186c81a7c5894a3ccb9b690dd9a78051746916f3bac2b7146b8378534d5e177ba4cacb4c2011b64011328b056d4d397967e EBUILD gitlab-shell-3.6.6.ebuild 3653 SHA256 49c383d1d5895069a6783e44d492935879801efd95f57548a81e10df48339038 SHA512 4e6dd5c34a56ed0e1fc45819c93239c61d900304cc8df20855f4e71e4fab234b5e81612f256155022f362f4f9a0959531a3999eb7ece9013914129e4343795cf WHIRLPOOL 92d40a6cb8dd19a42093a746e29ead878eeb9b0c741e23ca3e6213c0a14b820584633db8f2d5ac60cd28da15546232de417db72ccdf8608bc49ac333107f7193 EBUILD gitlab-shell-4.0.0.ebuild 3653 SHA256 1413668c9a75cc89b4043e497b9339639bcfce942486d8dada512968c53633b9 SHA512 0f825e5812084601b56f790d880da266986717cd2a35a4033cb75710b3cae624fe5015412a0674dab3c2099eaf29a956af19ffcc6d671bcddf72dfb8507f47e1 WHIRLPOOL dff4dc61e0f568767e25e865546a57018f82b2f28c5bc974df263021d19c0cf194a269b21b8422878e09cb3fd8c7cb34600e005c49dacde0c56df1701bb5e64c EBUILD gitlab-shell-4.0.3.ebuild 3653 SHA256 4c47b55bc61c0d86499f2b7ab3a94ae1b5b6886faf9035f2a98094ebf7701aea SHA512 7de7b0c8b164d50de2cac220f66fe5a9a51809db8e565e74d27449ac2629c566b0d5d90b3d6f9dd0a2bf609526ec4cc62744d2c80d27b302d5719ec28f3485c3 WHIRLPOOL 79ea419a1107ea54aa0937cee7043e7691799ead6dabea69bb11ea57af0403102e5e7ab4de844f2358449578dd583d433eebfc567f88c1e2110e7fe1731ca47b +EBUILD gitlab-shell-4.1.1.ebuild 3653 SHA256 06702f4658b8ac1bada6b322b833f65270656730417d8c9bb000ab1fb23af8f0 SHA512 dc63160d98dabfcbaa9982fe841fd581a1b1b2a968e7c7bd1ee336e449214fa89da33477f0d4744941ee3ecb8688386883a5923e78025bdcfd1556e68ea7371c WHIRLPOOL cd59e133d1d02f082f10312b358c6c8718898aa008a967fc85934656500ceefc44a6affae286123c481aa902fa51cdb7e7f98788057fdd08304ed99f643ef27c MISC ChangeLog 2576 SHA256 bdf6d8055e11a9d46fa77cd325fca046028cc50e6c5cfdb2350ad4aa5190370a SHA512 e88f5072f982524104ebef77c018946d1f37a1f0bb572c29e9bb529de4a774a6ceba1844a0b5d40a130f4c29b8dae177387f8bbf7b28c2736ee621a7fec8cdcc WHIRLPOOL f4852d792d410e59b97bcc65e14575f1ca77f562eba89dde926375efb8d5660c27e0ab4d2336f33bf898b2c468b6b6b82b9168e36bb96305107d17ebf2464efc MISC metadata.xml 248 SHA256 7b43be15755627edf5c12cf1b50c607d781558640bf8375d685d51d7ade99a32 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 WHIRLPOOL 993013c9878ead35469db13d3072f694a341ee654182e0c31d0678f5dd6de4bdc8d59a0b7bb6d685dc41ea6b55dac518cd8034131baea8002170c680e50304d1 diff --git a/dev-vcs/gitlab-shell/files/gitlab-shell-4.1.1-config-paths.patch b/dev-vcs/gitlab-shell/files/gitlab-shell-4.1.1-config-paths.patch new file mode 100644 index 0000000..11c4a4d --- /dev/null +++ b/dev-vcs/gitlab-shell/files/gitlab-shell-4.1.1-config-paths.patch @@ -0,0 +1,69 @@ +diff --git a/config.yml.example b/config.yml.example +index cf6c91b..7e144fe 100644 +--- a/config.yml.example ++++ b/config.yml.example +@@ -25,15 +25,15 @@ http_settings: + self_signed_cert: false + + # File used as authorized_keys for gitlab user +-auth_file: "/home/git/.ssh/authorized_keys" ++auth_file: "/var/lib/git/.ssh/authorized_keys" + + # File that contains the secret key for verifying access to GitLab. +-# Default is .gitlab_shell_secret in the gitlab-shell directory. +-# secret_file: "/home/git/gitlab-shell/.gitlab_shell_secret" ++# Default is /opt/gitlab/.gitlab_shell_secret. ++# secret_file: "/opt/gitlab/.gitlab_shell_secret" + + # Parent directory for global custom hook directories (pre-receive.d, update.d, post-receive.d) + # Default is hooks in the gitlab-shell directory. +-# custom_hooks_dir: "/home/git/gitlab-shell/hooks" ++# custom_hooks_dir: "/usr/share/gitlab-shell/hooks" + + # Redis settings used for pushing commit notices to gitlab + redis: +@@ -55,7 +55,7 @@ redis: + + # Log file. + # Default is gitlab-shell.log in the root directory. +-# log_file: "/home/git/gitlab-shell/gitlab-shell.log" ++log_file: "/var/log/gitlab/gitlab-shell.log" + + # Log level. INFO by default + log_level: INFO +diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb +index a51a32c..7763802 100644 +--- a/lib/gitlab_config.rb ++++ b/lib/gitlab_config.rb +@@ -4,11 +4,11 @@ class GitlabConfig + attr_reader :config + + def initialize +- @config = YAML.load_file(File.join(ROOT_PATH, 'config.yml')) ++ @config = YAML.load_file('/etc/gitlab-shell.yml') + end + + def home +- ENV['HOME'] ++ "/var/lib/git" + end + + def auth_file +@@ -16,7 +16,7 @@ class GitlabConfig + end + + def secret_file +- @config['secret_file'] ||= File.join(ROOT_PATH, '.gitlab_shell_secret') ++ @config['secret_file'] ||= "/opt/gitlab/.gitlab_shell_secret" + end + + # Pass a default value because this is called from a repo's context; in which +@@ -43,7 +43,7 @@ class GitlabConfig + end + + def log_file +- @config['log_file'] ||= File.join(ROOT_PATH, 'gitlab-shell.log') ++ @config['log_file'] ||= "/var/log/gitlab/gitlab-shell.log" + end + + def log_level diff --git a/dev-vcs/gitlab-shell/gitlab-shell-4.1.1.ebuild b/dev-vcs/gitlab-shell/gitlab-shell-4.1.1.ebuild new file mode 100644 index 0000000..2f0e4f7 --- /dev/null +++ b/dev-vcs/gitlab-shell/gitlab-shell-4.1.1.ebuild @@ -0,0 +1,130 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +USE_RUBY="ruby21 ruby23" + +inherit eutils ruby-ng user + +MY_PV="v${PV/_/-}" +MY_GIT_COMMIT="a3712cc18de8283b25c3a8a034ecc8c9b7feca48" + +DESCRIPTION="SSH access and repository management for GitLab" +HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-shell" +SRC_URI="https://gitlab.com/gitlab-org/gitlab-shell/repository/archive.tar.gz?ref=${MY_PV} -> ${P}.tar.gz" +RUBY_S="${PN}-${MY_PV}-${MY_GIT_COMMIT}" + +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}-4.1.1-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}." +}