added ebuild and patches for gitlab-shell-1.9.3
This commit is contained in:
parent
9d04c5fddd
commit
d5533d34de
5 changed files with 228 additions and 0 deletions
5
dev-vcs/gitlab-shell/Manifest
Normal file
5
dev-vcs/gitlab-shell/Manifest
Normal file
|
@ -0,0 +1,5 @@
|
|||
AUX gitlab-shell-1.7.1-paths-from-config.patch 1725 SHA256 b730b953f5cbb7b1c248cf56074832018f78a8bdcc20f2e3869fd30be03b03e4 SHA512 ac214bdcf4d6c63d61914c11d14b24136b4eb0cda4bd09476b58e6bfedfd5a5245a5d20f128d57d05b945afa03fa56f85c4c4df8508767443720596c7beaeddc WHIRLPOOL bed74d3544be5132818a9a42770c9c9775e6b491811ff23eb186f8ea19a86912dbc399c8f92ff7d6c5f951dafd21f4f893495d3d622d5be6af02205ed3b77e06
|
||||
AUX gitlab-shell-1.8.0-redis-db-option.patch 625 SHA256 e707b05a5f81b3769ca8125695617335a9a90eb6ad6b0fd48d99a92f70c235ee SHA512 d5fc946937cb6fcff313c2c620ce24b66c0b6226b298214a36915fa5023ae33f348698ad2505e7e441adc80137dc092dd689d066dac9abbe4261a448ad85f753 WHIRLPOOL fc6365a20089cdb923af210c1f8b825e0bdb7dd539ba272efa224c214237d61bac0d9d0730f8bc9436be16fa874752aba5938e380ab1466f2a3baafaf2bc52cc
|
||||
AUX gitlab-shell-1.9.3-config-paths.patch 1310 SHA256 ed66ac5622ed7e1999e528182ef37bbf5fe979cc2bfdb7e764207dbf9f84833c SHA512 00b188d322f0baede62c494f24ae664ba17ae88a21d30631d14f6639f023aa1f1aa936ae8a81f3252cb2763170b26a1ab69b562e7c401d531b7613de8d174dde WHIRLPOOL e231a1df28f9f1e3295cdc5c0904036bf861fe885b30b0a5bf79b96f7e1d7b5ce34d5e880d00ad043ea518e9f43182ef89c28ef62d9ed72ca761534b13bd3340
|
||||
DIST gitlab-shell-1.9.3.tar.gz 16186 SHA256 8484554f76aea4443a9de19253a784b0164fd76230e8e1caeb6bf84df1a6a11c SHA512 4d14e731c865528650b134e493ce617b24971a927931c648253f9c3614d72eb21533f63984cb7cfc38a0201e3dfec3c2f5f57d6bd29fe791689548eecd8e9c3b WHIRLPOOL d36a79b3fed631fce5b63808a34ced5210243928209b221c18421f4a4e5af85b3476f74c4b2cbb5379a1c44a29bf7904be704bdcc5180d9d62576e6b76da60da
|
||||
EBUILD gitlab-shell-1.9.3.ebuild 3379 SHA256 a2c6cddc638580bdbca77512d8502d31ae3358366e6fd928592d20e00dd2f334 SHA512 2e75c7982fc1bb39076f41ad85722c776163eaa2f501d17cda06b5f44d31324608ef5c39ef57c442acb98887d85cbc0b5e4f460ff8e3054cbcacc2190cb07ccb WHIRLPOOL 115875e45957c1ce70c5aa3f4c13645b00ff3b666d54b893b130852aec6909db13af0bc8eca39b91c1cc0681ad23c4867774f7676a1d50a1f8c424a48ac63a46
|
|
@ -0,0 +1,39 @@
|
|||
--- a/support/rewrite-hooks.sh 2013-08-26 11:59:22.000000000 +0200
|
||||
+++ b/support/rewrite-hooks.sh 2013-09-10 21:31:30.135841009 +0200
|
||||
@@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# $1 is an optional argument specifying the location of the repositories directory.
|
||||
-# Defaults to /home/git/repositories if not provided
|
||||
+# If no argument is provided then path is readed from /etc/gitlab-shell.yml
|
||||
|
||||
-home_dir="/home/git"
|
||||
-src=${1:-"$home_dir/repositories"}
|
||||
+base_path="$(realpath `dirname $(readlink -f "$0")`/..)"
|
||||
+repos_path="$(ruby -ryaml -e 'puts YAML::load_file("/etc/gitlab-shell.yml")["repos_path"]')"
|
||||
+src=${1:-"$repos_path"}
|
||||
|
||||
function create_link_in {
|
||||
- ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update"
|
||||
+ ln -s -f "$base_path/hooks/update" "$1/hooks/update"
|
||||
}
|
||||
|
||||
for dir in `ls "$src/"`
|
||||
--- a/support/truncate_repositories.sh 2013-08-26 11:59:22.000000000 +0200
|
||||
+++ b/support/truncate_repositories.sh 2013-09-10 21:31:30.135841009 +0200
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
-home_dir="/home/git"
|
||||
+repos_path="$(ruby -ryaml -e 'puts YAML::load_file("/etc/gitlab-shell.yml")["repos_path"]')"
|
||||
|
||||
echo "Danger!!! Data Loss"
|
||||
while true; do
|
||||
- read -p "Do you wish to delete all directories (except gitolite-admin.git) from $home_dir/repositories/ (y/n) ?: " yn
|
||||
+ read -p "Do you wish to delete all directories (except gitolite-admin.git) from $repos_path (y/n) ?: " yn
|
||||
case $yn in
|
||||
- [Yy]* ) sh -c "find $home_dir/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs rm -rf"; break;;
|
||||
+ [Yy]* ) sh -c "find $repos_path/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs rm -rf"; break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
|
@ -0,0 +1,21 @@
|
|||
--- a/lib/gitlab_config.rb
|
||||
+++ b/lib/gitlab_config.rb
|
||||
@@ -53,7 +53,7 @@ class GitlabConfig
|
||||
if redis.has_key?("socket")
|
||||
%W(#{redis['bin']} -s #{redis['socket']})
|
||||
else
|
||||
- %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']})
|
||||
+ %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['db']})
|
||||
end
|
||||
end
|
||||
end
|
||||
--- a/config.yml.example
|
||||
+++ b/config.yml.example
|
||||
@@ -25,6 +25,7 @@ redis:
|
||||
bin: /usr/bin/redis-cli
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
+ # db: 0
|
||||
# socket: /tmp/redis.socket # Only define this if you want to use sockets
|
||||
namespace: resque:gitlab
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--- config.yml.example.orig 2014-04-03 17:20:56.000000000 +0200
|
||||
+++ config.yml.example 2014-05-18 17:52:54.290000000 +0200
|
||||
@@ -15,10 +15,10 @@
|
||||
# Give the canonicalized absolute pathname,
|
||||
# REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!!
|
||||
# Check twice that none of the components is a symlink, including "/home".
|
||||
-repos_path: "/home/git/repositories"
|
||||
+repos_path: "/var/lib/git/repositories"
|
||||
|
||||
# File used as authorized_keys for gitlab user
|
||||
-auth_file: "/home/git/.ssh/authorized_keys"
|
||||
+auth_file: "/var/lib/git/.ssh/authorized_keys"
|
||||
|
||||
# Redis settings used for pushing commit notices to gitlab
|
||||
redis:
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
# 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
|
||||
--- lib/gitlab_config.rb.orig 2014-05-18 17:48:34.660000000 +0200
|
||||
+++ lib/gitlab_config.rb 2014-05-18 17:51:15.690000000 +0200
|
||||
@@ -8,11 +8,11 @@
|
||||
end
|
||||
|
||||
def repos_path
|
||||
- @config['repos_path'] ||= "/home/git/repositories"
|
||||
+ @config['repos_path'] ||= "/var/lib/git/repositories"
|
||||
end
|
||||
|
||||
def auth_file
|
||||
- @config['auth_file'] ||= "/home/git/.ssh/authorized_keys"
|
||||
+ @config['auth_file'] ||= "/var/lib/git/.ssh/authorized_keys"
|
||||
end
|
||||
|
||||
def gitlab_url
|
123
dev-vcs/gitlab-shell/gitlab-shell-1.9.3.ebuild
Normal file
123
dev-vcs/gitlab-shell/gitlab-shell-1.9.3.ebuild
Normal file
|
@ -0,0 +1,123 @@
|
|||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="5"
|
||||
|
||||
USE_RUBY="ruby19 ruby20"
|
||||
|
||||
inherit eutils ruby-ng user
|
||||
|
||||
DESCRIPTION="SSH access and repository management for GitLab"
|
||||
HOMEPAGE="https://github.com/gitlabhq/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}-1.7.1-paths-from-config.patch"
|
||||
"${PN}-1.9.3-config-paths.patch"
|
||||
"${PN}-1.8.0-redis-db-option.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})
|
||||
|
||||
# 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}."
|
||||
}
|
Loading…
Reference in a new issue