1 |
commit: b2f32465e14bc0f9a96193f576dae300fe59ad87 |
2 |
Author: Marc Schiffbauer <mschiff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 21 22:48:57 2014 +0000 |
4 |
Commit: Marc Schiffbauer <mschiff <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 21 22:48:57 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/mschiff.git;a=commit;h=b2f32465 |
7 |
|
8 |
added gitlab-shell ebuild (based on cvut overlay) |
9 |
|
10 |
--- |
11 |
dev-vcs/gitlab-shell/Manifest | 4 + |
12 |
.../gitlab-shell-1.7.1-paths-from-config.patch | 39 +++++++ |
13 |
.../files/gitlab-shell-1.8.0-redis-db-option.patch | 21 ++++ |
14 |
dev-vcs/gitlab-shell/gitlab-shell-1.8.0.ebuild | 122 +++++++++++++++++++++ |
15 |
4 files changed, 186 insertions(+) |
16 |
|
17 |
diff --git a/dev-vcs/gitlab-shell/Manifest b/dev-vcs/gitlab-shell/Manifest |
18 |
new file mode 100644 |
19 |
index 0000000..0a6f8d2 |
20 |
--- /dev/null |
21 |
+++ b/dev-vcs/gitlab-shell/Manifest |
22 |
@@ -0,0 +1,4 @@ |
23 |
+AUX gitlab-shell-1.7.1-paths-from-config.patch 1725 SHA256 b730b953f5cbb7b1c248cf56074832018f78a8bdcc20f2e3869fd30be03b03e4 SHA512 ac214bdcf4d6c63d61914c11d14b24136b4eb0cda4bd09476b58e6bfedfd5a5245a5d20f128d57d05b945afa03fa56f85c4c4df8508767443720596c7beaeddc WHIRLPOOL bed74d3544be5132818a9a42770c9c9775e6b491811ff23eb186f8ea19a86912dbc399c8f92ff7d6c5f951dafd21f4f893495d3d622d5be6af02205ed3b77e06 |
24 |
+AUX gitlab-shell-1.8.0-redis-db-option.patch 625 SHA256 e707b05a5f81b3769ca8125695617335a9a90eb6ad6b0fd48d99a92f70c235ee SHA512 d5fc946937cb6fcff313c2c620ce24b66c0b6226b298214a36915fa5023ae33f348698ad2505e7e441adc80137dc092dd689d066dac9abbe4261a448ad85f753 WHIRLPOOL fc6365a20089cdb923af210c1f8b825e0bdb7dd539ba272efa224c214237d61bac0d9d0730f8bc9436be16fa874752aba5938e380ab1466f2a3baafaf2bc52cc |
25 |
+DIST gitlab-shell-1.8.0.tar.gz 14912 SHA256 ac75e2a5d234f4e64760e2eda5a94c633ec2b31c269deda01e69c6bbc0a25feb SHA512 ab829b597e4610675c773be83035506a97dc623c41f294c94b57fc7351d7985156c5882ba9b1c84d140fe0e0b5c613ab138f8161eee82c4727d049aa39e17efe WHIRLPOOL 72896d55d828d7c9539168391206a908c4a899079eb9bd1461fcdca4947abd806ca91a098d6c4bd67e1f15089636b960704f89285613b86588d039e7b4df4912 |
26 |
+EBUILD gitlab-shell-1.8.0.ebuild 3344 SHA256 85869536daa29d5316a6050bde97d39f707ecaf9078f535f262b35e0e8c509d5 SHA512 0e314f5b32a303b3637d574a89be908fdd756eca1ee257fd12b3722fc5e3bd16624f0c26f90d6522e84d222fcfaa004a92aafbd9a63cf3f1aba91b2575b243a9 WHIRLPOOL 67149f996b6c71e26fd06d6b22ff7f159e1aa46c457b603f873542769631c51b96bbde90b90e0642e0f09f20010a7355591a38bb4e20a36bf99d1c84564e0052 |
27 |
|
28 |
diff --git a/dev-vcs/gitlab-shell/files/gitlab-shell-1.7.1-paths-from-config.patch b/dev-vcs/gitlab-shell/files/gitlab-shell-1.7.1-paths-from-config.patch |
29 |
new file mode 100644 |
30 |
index 0000000..2f79e10 |
31 |
--- /dev/null |
32 |
+++ b/dev-vcs/gitlab-shell/files/gitlab-shell-1.7.1-paths-from-config.patch |
33 |
@@ -0,0 +1,39 @@ |
34 |
+--- a/support/rewrite-hooks.sh 2013-08-26 11:59:22.000000000 +0200 |
35 |
++++ b/support/rewrite-hooks.sh 2013-09-10 21:31:30.135841009 +0200 |
36 |
+@@ -1,13 +1,14 @@ |
37 |
+ #!/bin/bash |
38 |
+ |
39 |
+ # $1 is an optional argument specifying the location of the repositories directory. |
40 |
+-# Defaults to /home/git/repositories if not provided |
41 |
++# If no argument is provided then path is readed from /etc/gitlab-shell.yml |
42 |
+ |
43 |
+-home_dir="/home/git" |
44 |
+-src=${1:-"$home_dir/repositories"} |
45 |
++base_path="$(realpath `dirname $(readlink -f "$0")`/..)" |
46 |
++repos_path="$(ruby -ryaml -e 'puts YAML::load_file("/etc/gitlab-shell.yml")["repos_path"]')" |
47 |
++src=${1:-"$repos_path"} |
48 |
+ |
49 |
+ function create_link_in { |
50 |
+- ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update" |
51 |
++ ln -s -f "$base_path/hooks/update" "$1/hooks/update" |
52 |
+ } |
53 |
+ |
54 |
+ for dir in `ls "$src/"` |
55 |
+--- a/support/truncate_repositories.sh 2013-08-26 11:59:22.000000000 +0200 |
56 |
++++ b/support/truncate_repositories.sh 2013-09-10 21:31:30.135841009 +0200 |
57 |
+@@ -1,12 +1,12 @@ |
58 |
+ #!/bin/bash |
59 |
+ |
60 |
+-home_dir="/home/git" |
61 |
++repos_path="$(ruby -ryaml -e 'puts YAML::load_file("/etc/gitlab-shell.yml")["repos_path"]')" |
62 |
+ |
63 |
+ echo "Danger!!! Data Loss" |
64 |
+ while true; do |
65 |
+- read -p "Do you wish to delete all directories (except gitolite-admin.git) from $home_dir/repositories/ (y/n) ?: " yn |
66 |
++ read -p "Do you wish to delete all directories (except gitolite-admin.git) from $repos_path (y/n) ?: " yn |
67 |
+ case $yn in |
68 |
+- [Yy]* ) sh -c "find $home_dir/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs rm -rf"; break;; |
69 |
++ [Yy]* ) sh -c "find $repos_path/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs rm -rf"; break;; |
70 |
+ [Nn]* ) exit;; |
71 |
+ * ) echo "Please answer yes or no.";; |
72 |
+ esac |
73 |
|
74 |
diff --git a/dev-vcs/gitlab-shell/files/gitlab-shell-1.8.0-redis-db-option.patch b/dev-vcs/gitlab-shell/files/gitlab-shell-1.8.0-redis-db-option.patch |
75 |
new file mode 100644 |
76 |
index 0000000..4ff7d60 |
77 |
--- /dev/null |
78 |
+++ b/dev-vcs/gitlab-shell/files/gitlab-shell-1.8.0-redis-db-option.patch |
79 |
@@ -0,0 +1,21 @@ |
80 |
+--- a/lib/gitlab_config.rb |
81 |
++++ b/lib/gitlab_config.rb |
82 |
+@@ -53,7 +53,7 @@ class GitlabConfig |
83 |
+ if redis.has_key?("socket") |
84 |
+ %W(#{redis['bin']} -s #{redis['socket']}) |
85 |
+ else |
86 |
+- %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']}) |
87 |
++ %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']} -n #{redis['db']}) |
88 |
+ end |
89 |
+ end |
90 |
+ end |
91 |
+--- a/config.yml.example |
92 |
++++ b/config.yml.example |
93 |
+@@ -25,6 +25,7 @@ redis: |
94 |
+ bin: /usr/bin/redis-cli |
95 |
+ host: 127.0.0.1 |
96 |
+ port: 6379 |
97 |
++ # db: 0 |
98 |
+ # socket: /tmp/redis.socket # Only define this if you want to use sockets |
99 |
+ namespace: resque:gitlab |
100 |
+ |
101 |
|
102 |
diff --git a/dev-vcs/gitlab-shell/gitlab-shell-1.8.0.ebuild b/dev-vcs/gitlab-shell/gitlab-shell-1.8.0.ebuild |
103 |
new file mode 100644 |
104 |
index 0000000..9d28d06 |
105 |
--- /dev/null |
106 |
+++ b/dev-vcs/gitlab-shell/gitlab-shell-1.8.0.ebuild |
107 |
@@ -0,0 +1,122 @@ |
108 |
+# Copyright 1999-2014 Gentoo Foundation |
109 |
+# Distributed under the terms of the GNU General Public License v2 |
110 |
+# $Header: $ |
111 |
+ |
112 |
+EAPI="5" |
113 |
+ |
114 |
+USE_RUBY="ruby19 ruby20" |
115 |
+ |
116 |
+inherit eutils ruby-ng user |
117 |
+ |
118 |
+DESCRIPTION="SSH access and repository management for GitLab" |
119 |
+HOMEPAGE="https://github.com/gitlabhq/gitlab-shell" |
120 |
+SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
121 |
+ |
122 |
+LICENSE="MIT" |
123 |
+SLOT="0" |
124 |
+KEYWORDS="amd64 x86" |
125 |
+IUSE="" |
126 |
+ |
127 |
+DEPEND="" |
128 |
+RDEPEND=" |
129 |
+ dev-vcs/git |
130 |
+ dev-db/redis |
131 |
+ virtual/ssh" |
132 |
+ruby_add_bdepend " |
133 |
+ virtual/ruby-ssl" |
134 |
+ |
135 |
+MERGE_TYPE="binary" |
136 |
+ |
137 |
+RUBY_PATCHES=( |
138 |
+ "${PN}-1.7.1-paths-from-config.patch" |
139 |
+ "${PN}-1.8.0-redis-db-option.patch" |
140 |
+) |
141 |
+ |
142 |
+GIT_USER="git" |
143 |
+DEST_DIR="/usr/share/${PN}" |
144 |
+DATA_DIR="/var/lib/git" |
145 |
+LOGS_DIR="/var/log/gitlab" |
146 |
+CONF_FILE="/etc/gitlab-shell.yml" |
147 |
+ |
148 |
+pkg_setup() { |
149 |
+ enewgroup ${GIT_USER} |
150 |
+ enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}" |
151 |
+ |
152 |
+ local git_shell=$(egetshell ${GIT_USER}) |
153 |
+ if [ ! ${git_shell} -ef '/bin/bash' ]; then |
154 |
+ ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}." |
155 |
+ ewarn "Changing shell to /bin/bash ..." |
156 |
+ |
157 |
+ usermod -s /bin/bash ${GIT_USER} \ |
158 |
+ || die "failed to change login shell for ${GIT_USER}" |
159 |
+ fi |
160 |
+} |
161 |
+ |
162 |
+all_ruby_prepare() { |
163 |
+ # fix paths |
164 |
+ sed -i -E \ |
165 |
+ -e "s|/home/git|${DATA_DIR}|" \ |
166 |
+ -e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \ |
167 |
+ config.yml.example || die "failed to filter config.yml.example" |
168 |
+ |
169 |
+ sed -i \ |
170 |
+ -e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \ |
171 |
+ lib/gitlab_config.rb || die "failed to filter gitlab_config.rb" |
172 |
+} |
173 |
+ |
174 |
+all_ruby_install() { |
175 |
+ # install lib |
176 |
+ insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION |
177 |
+ |
178 |
+ # install scripts |
179 |
+ exeinto ${DEST_DIR}/bin; doexe bin/* |
180 |
+ exeinto ${DEST_DIR}/hooks; doexe hooks/* |
181 |
+ exeinto ${DEST_DIR}/support; doexe support/* |
182 |
+ |
183 |
+ # create symlinks to bin |
184 |
+ local name; for name in $(basename -a bin/gitlab-*); do |
185 |
+ dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}" |
186 |
+ done |
187 |
+ |
188 |
+ insinto $(dirname ${CONF_FILE}) |
189 |
+ newins config.yml.example $(basename ${CONF_FILE}) |
190 |
+ |
191 |
+ # prepare directories |
192 |
+ diropts -m750; dodir ${DATA_DIR} |
193 |
+ diropts -m770; keepdir ${DATA_DIR}/repositories |
194 |
+ diropts -m755; dodir ${LOGS_DIR} |
195 |
+ |
196 |
+ # GitLab stupidly expects that gitlab-shell is in home of git user... |
197 |
+ dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell |
198 |
+ |
199 |
+ # fix permissions |
200 |
+ fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR} |
201 |
+} |
202 |
+ |
203 |
+pkg_postinst() { |
204 |
+ # check git home directory |
205 |
+ local git_home=$(egethome ${GIT_USER}) |
206 |
+ if [ ! "${git_home}" -ef ${DATA_DIR} ]; then |
207 |
+ ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh," |
208 |
+ ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must" |
209 |
+ ewarn "either change the authorized_keys location in ${CONF_FILE}," |
210 |
+ ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}" |
211 |
+ ewarn "and move ${git_home}/.ssh here." |
212 |
+ ewarn |
213 |
+ fi |
214 |
+ |
215 |
+ local auth_dir="${git_home}/.ssh" |
216 |
+ |
217 |
+ elog "Initializing authorized_keys file in ${auth_dir}" |
218 |
+ mkdir -p ${auth_dir} |
219 |
+ touch ${auth_dir}/authorized_keys |
220 |
+ chmod -R u=rwX,go=- ${auth_dir} |
221 |
+ chown -R ${GIT_USER}:${GIT_USER} ${auth_dir} |
222 |
+ |
223 |
+ elog |
224 |
+ elog "GitLab Shell was initialized. Repositories are located in" |
225 |
+ elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin." |
226 |
+ elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path." |
227 |
+ elog |
228 |
+ elog "You should change your gitlab_url in: ${CONF_FILE}." |
229 |
+} |