bernd commited on 2011-12-21 16:51:49
Zeige 7 geänderte Dateien mit 161 Einfügungen und 0 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2090 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -0,0 +1,30 @@ |
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+if [ -f "sshkey" ] ; then |
|
4 |
+ echo 'SSH-Key exists!' |
|
5 |
+ exit 1 |
|
6 |
+fi |
|
7 |
+ |
|
8 |
+WORKDIR="$(realpath "$(dirname ${0})")" |
|
9 |
+ |
|
10 |
+ssh-keygen -t ecdsa -P '' -f "${WORKDIR}/sshkey" |
|
11 |
+ |
|
12 |
+echo 'Paste the following public key in gitolite-config and allow it to access the gitolite-admin repository!' |
|
13 |
+echo '----------------------' |
|
14 |
+cat sshkey.pub |
|
15 |
+echo '----------------------' |
|
16 |
+echo -n 'Press ENTER when ready...' |
|
17 |
+read |
|
18 |
+ |
|
19 |
+export GIT_SSH="${WORKDIR}/ssh-wrapper.sh" |
|
20 |
+git clone "git@git.$(hostname -d):gitolite-admin" |
|
21 |
+ |
|
22 |
+cd "gitolite-admin" |
|
23 |
+echo 'Probing pull...' |
|
24 |
+git pull |
|
25 |
+echo 'Probing push...' |
|
26 |
+git push |
|
27 |
+ |
|
28 |
+echo 'Everything set up!' |
|
29 |
+ |
|
30 |
+ |
... | ... |
@@ -0,0 +1,103 @@ |
1 |
+<?php |
|
2 |
+require_role(ROLE_SYSTEMUSER); |
|
3 |
+ |
|
4 |
+$data_dir = realpath( dirname(__FILE__).'/../data/' ); |
|
5 |
+$config_file = $data_dir.'/gitolite-admin/conf/webinterface.conf'; |
|
6 |
+$config_dir = $data_dir.'/gitolite-admin/conf/webinterface'; |
|
7 |
+$key_dir = $data_dir.'/gitolite-admin/keydir'; |
|
8 |
+DEBUG("gitolite-data_dir: ".$data_dir); |
|
9 |
+$git_wrapper = $data_dir . '/git-wrapper.sh'; |
|
10 |
+ |
|
11 |
+ |
|
12 |
+function check_env() |
|
13 |
+{ |
|
14 |
+ global $git_wrapper, $data_dir, $config_file, $config_dir, $key_dir; |
|
15 |
+ if (!is_executable($git_wrapper)) { |
|
16 |
+ system_failure("git_wrapper.sh is not executable: {$git_wrapper}"); |
|
17 |
+ } |
|
18 |
+ if (! (is_file($data_dir.'/sshkey') && is_file($data_dir.'/sshkey.pub'))) { |
|
19 |
+ system_failure("SSH-key not found. Please setup the gitolite-module correctly. Run ./data/initialize.sh"); |
|
20 |
+ } |
|
21 |
+ if (! is_dir($data_dir.'/gitolite-admin')) { |
|
22 |
+ system_failure("Repository gitolite-admin ot found. Initial checkout must be made manually. Run ./data/initialize.sh"); |
|
23 |
+ } |
|
24 |
+ if (! is_dir($config_dir)) { |
|
25 |
+ system_failure("gitolite-admin repository is not prepared."); |
|
26 |
+ } |
|
27 |
+ if (! (is_dir($key_dir) && is_writeable($$config_file))) { |
|
28 |
+ system_failure("Repository gitolite-admin is corrupted or webinterface.conf is not writeable."); |
|
29 |
+ } |
|
30 |
+} |
|
31 |
+ |
|
32 |
+ |
|
33 |
+function git_wrapper($commandline) |
|
34 |
+{ |
|
35 |
+ global $git_wrapper, $data_dir; |
|
36 |
+ |
|
37 |
+ $command = $git_wrapper.' '.$commandline; |
|
38 |
+ $output = array(); |
|
39 |
+ $retval = 0; |
|
40 |
+ DEBUG($command); |
|
41 |
+ exec($command, $output, $retval); |
|
42 |
+ DEBUG($output); |
|
43 |
+ DEBUG($retval); |
|
44 |
+ if ($retval > 0) { |
|
45 |
+ system_failure('Interner Fehler!'); |
|
46 |
+ // FIXME: Hier sollte auf jeden Fall ein Logging angeworfen werden! |
|
47 |
+ } |
|
48 |
+} |
|
49 |
+ |
|
50 |
+function refresh_gitolite() |
|
51 |
+{ |
|
52 |
+ check_env(); |
|
53 |
+ git_wrapper('pull'); |
|
54 |
+} |
|
55 |
+ |
|
56 |
+ |
|
57 |
+function read_config() |
|
58 |
+{ |
|
59 |
+ global $gitolite_conf; |
|
60 |
+ $customerno = (int) $_SESSION['customerinfo']['customerno']; |
|
61 |
+ $groups = array(); |
|
62 |
+ |
|
63 |
+ $data = parse_ini_file($gitolite_conf, TRUE); |
|
64 |
+ DEBUG($data); |
|
65 |
+ |
|
66 |
+} |
|
67 |
+ |
|
68 |
+ |
|
69 |
+function list_repos() |
|
70 |
+{ |
|
71 |
+ global $config_file, $config_dir; |
|
72 |
+ $username = $_SESSION['userinfo']['username']; |
|
73 |
+ $userconfig = $config_dir . '/' . $username . '.conf'; |
|
74 |
+ DEBUG("using config file ".$userconfig); |
|
75 |
+ if (! is_file($userconfig)) { |
|
76 |
+ DEBUG("user-config does not exist"); |
|
77 |
+ return array(); |
|
78 |
+ } |
|
79 |
+ |
|
80 |
+ $repos = array(); |
|
81 |
+ $lines = file($userconfig); |
|
82 |
+ $current_repo = NULL; |
|
83 |
+ foreach ($lines as $line) { |
|
84 |
+ $m = array(); |
|
85 |
+ if (preg_match('_^[ \t]*repo ([^]]+)_', $line, $m) != 0) { |
|
86 |
+ DEBUG("found repo ".$m[1]); |
|
87 |
+ $repos[] = $m[1]; |
|
88 |
+ } |
|
89 |
+ } |
|
90 |
+ DEBUG($repos); |
|
91 |
+ return $repos; |
|
92 |
+} |
|
93 |
+ |
|
94 |
+ |
|
95 |
+ |
|
96 |
+ |
|
97 |
+function add_key($pubkey, $handle) |
|
98 |
+{ |
|
99 |
+ |
|
100 |
+} |
|
101 |
+ |
|
102 |
+ |
|
103 |
+ |