srchub-install

srchub-install Commit Details


Date:2015-10-31 21:07:38 (9 years 1 month ago)
Author:Natalie Adams
Branch:master
Commit:f57c961af21cf4066f6f5991f32bdced2b684169
Parents: 798902bc0fca936b5a89949c809d6cb497b18fd4
Message:updating

Changes:

File differences

srchub-install.py
22
33
44
5
56
67
78
......
5556
5657
5758
58
59
6059
61
62
63
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
64147
148
149
65150
66151
67152
68153
69154
70155
71
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
72215
73216
74217
......
79222
80223
81224
82
225
83226
84227
85228
......
87230
88231
89232
90
233
91234
92235
93236
......
116259
117260
118261
262
119263
120
264
265
266
267
268
269
270
271
272
273
274
121275
122
276
277
278
279
280
281
282
283
284
285
286
287
288
289
123290
124291
125
292
293
from dialog import Dialog
from subprocess import call
import sys
import os
# This is almost always a good thing to do at the beginning of your programs.
locale.setlocale(locale.LC_ALL, '')
AuthUserFile /home/svn/dav_svn.passwd
</Location>
"""
d = Dialog(dialog="dialog", autowidgetsize=True)
distro = ""
def install_debian_package(package):
d.infobox(package, title="Installing...")
# install package
GIT_DAEMON_CONF = """#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugit:git \
"$(git --exec-path)"/git-daemon --verbose --base-path=/home/git/repositories /home/git/repositories
"""
HTACCESS = """
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.php/$1
"""
FINAL_MSG = """
I did NOT modify Apache for you -
In /etc/apache2/sites-available you should find 3 files:
[1] - indefero.base - this is what is needed for private repos
[2] - indefero.svn - this is what is needed for subversion repos
[3] - indefero.hg - this is what is needed for mercurial repos
Add what you want into your virtualhost config
SUBVERSION AND MERCURIAL WILL NOT WORK OTHERWISE!
Please add the following to your sudoers (visudo) file - this grants Apache the ability to reload itself:
www-data ALL=(ALL) NOPASSWD: /etc/init.d/apache2 reload
You will need to edit /home/www/indefero/src/IDF/conf/idf.php and fill in your database information
Then run:
php /home/www/pluf/src/migrate.php --conf=IDF/conf/idf.php -a -i -d
Then finally to create the user:
php /home/www/indefero/scripts/bootstrap.php
to create the admin user (username: admin, password: admin)
"""
AUTHBASIC_PATCH = """
--- Authbasic.php 2013-07-23 22:33:50.000000000 -0500
+++ /usr/share/php/File/Passwd/Authbasic.php 2013-06-03 19:07:37.000000000 -0500
@@ -17,7 +17,7 @@
* @author Michael Wallner <mike@php.net>
* @copyright 2003-2005 Michael Wallner
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id$
+ * @version CVS: $Id: Authbasic.php,v 1.17 2005/03/30 18:33:33 mike Exp $
* @link http://pear.php.net/package/File_Passwd
*/
@@ -52,7 +52,7 @@
*
* @author Michael Wallner <mike@php.net>
* @package File_Passwd
-* @version $Revision$
+* @version $Revision: 1.17 $
* @access public
*/
class File_Passwd_Authbasic extends File_Passwd_Common
@@ -79,7 +79,7 @@
* @var array
* @access private
*/
- var $_modes = array('md5' => 'm', 'des' => 'd', 'sha' => 's');
+ var $_modes = array('plain' => 'p', 'md5' => 'm', 'des' => 'd', 'sha' => 's');
/**
* Constructor
@@ -298,7 +298,7 @@
$mode = strToLower($mode);
if (!isset($this->_modes[$mode])) {
return PEAR::raiseError(
- sprintf(FILE_PASSWD_E_INVALID_ENC_MODE_STR, $mode),
+ sprintf(FILE_PASSWD_E_INVALID_ENC_MODE_STR, $this->_mode),
FILE_PASSWD_E_INVALID_ENC_MODE
);
}
@@ -326,7 +326,9 @@
return File_Passwd::crypt_des($pass, $salt);
} elseif ($mode == 'sha') {
return File_Passwd::crypt_sha($pass, $salt);
- }
+ } elseif ($mode == 'plain') {
+ return $pass;
+ }
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_INVALID_ENC_MODE_STR, $mode),
"""
d = Dialog(dialog="dialog", autowidgetsize=True)
distro = ""
def exit_msg():
print "Thank you for using the srchub installer\n"
print "Please send feedback to adamsna@datanethost.net"
def install_cron_jobs():
return d.yesno("Do you want me to attempt to install the cron jobs?")
answer = d.yesno("Do you want me to attempt to install the cron jobs?")
if answer == d.DIALOG_OK:
d.infobox("Setting up cron jobs...")
commands = []
commands.append("0 1 * * * %s" % ("/usr/bin/php5 /home/www/indefero/scripts/activitycron.php"))
commands.append("*/5 * * * * %s" % ("/bin/sh /home/www/indefero/scripts/SyncMercurial.sh"))
commands.append("15 * * * * /usr/bin/php5 /home/www/indefero/scripts/calculateforgecron.php")
commands.append("*/5 * * * * /usr/bin/php5 /home/www/indefero/scripts/queuecron.php")
for command in commands:
call(["(crontab -l; echo '%s') | crontab" % command])
def update_mercurial_hooks():
hgconf = ""
d.infobox("Checking for mercurial hooks...")
with open('/etc/mercurial/hgrc', 'r') as content_file:
hgconf = content_file.read()
if "hgchangegroup" not in hgconf:
hgconf += "\n[hooks]\nchangegroup = /home/www/indefero/scripts/hgchangegroup.php"
with open('/etc/mercurial/hgrc', 'w') as content_file:
content_file.write(hgconf)
def setup_git_daemon():
d.infobox("Setting up git daemon...")
if not os.path.isfile("/etc/sv/git-daemon/run.srchub"):
call(["mv", "/etc/sv/git-daemon/run", "/etc/sv/git-daemon/run.srchub"])
with open('/etc/sv/git-daemon/run', 'w') as content_file:
content_file.write(GIT_DAEMON_CONF)
call(["adduser", "git"])
def setup_web_links():
code, user_input = d.inputbox("I need to setup some web links. Where is your web root? (no leading slash)", init="/var/www")
call(["ln", "-s", "/home/www/indefero/www/index.php", "%s/index.php" % user_input])
call(["ln", "-s", "/home/www/indefero/www/media", "%s/media" % user_input])
with open("%s/.htaccess" % user_input, 'w') as content_file:
content_file.write(HTACCESS)
def install_pear_modules():
call(["pear", "install", "File_Passwd"])
call(["pear", "upgrade-all"])
call(["pear", "install", "--alldeps", "Mail"])
call(["pear", "install", "--alldeps", "Mail_mime"])
def fix_auth_basic():
with open('/tmp/patch', 'w') as content_file:
content_file.write(AUTHBASIC_PATCH)
call(["patch", "-N", "/usr/share/php/File/Passwd/Authbasic.php", "<", "/tmp/Authbasic.patch"])
call(["rm /tmp/patch"])
def prep_apache():
call(["a2enmod", "rewrite"])
with open('/etc/apache2/sites-available/indefero.base', 'w') as content_file:
content_file.write(INDEFERO_BASE_APACHE)
with open('/etc/apache2/sites-available/indefero.hg', 'w') as content_file:
content_file.write(INDEFERO_HG_APACHE)
with open('/etc/apache2/sites-available/indefero.svn', 'w') as content_file:
content_file.write(INDEFERO_SVN_APACHE)
def final_msg():
d.msgbox(FINAL_MSG)
def install_package(package):
if distro == "Debian":
if code == d.OK:
d.gauge_start("Installing...")
packages = ["git", "mercurial", "subversion", "mariadb-server", "mariadb-client", "libapache2-mod-php5",
"php5-curl", "php5-mysql", "php5-cli", "git-daemon-run", "gitweb", "php-pear"]
"php5-curl", "php5-mysql", "php5-cli", "git-daemon-run", "gitweb", "php-pear", "patch"]
percent = 0
i = 0
for package in packages:
install_package(package)
i += 1
percent = (i / len(packages)) * 100
d.gauge_stop()
d.set_background_title("Srchub Installer")
])
if code == d.OK:
install_packages()
if tag == "1": # Install srchub
pass
call(["git", "clone", "git://srchub.org/srchub-git.git", "/home/www"])
install_cron_jobs()
update_mercurial_hooks()
setup_git_daemon()
setup_web_links()
install_pear_modules()
fix_auth_basic()
prep_apache()
final_msg()
print FINAL_MSG
else: # Install indefero vanilla
pass
call(["git", "clone", "git://srchub.org/indefero.git", "/home/www/indefero"])
call(["git", "clone", "git://srchub.org/pluf2.git", "/home/www/pluf"])
install_cron_jobs()
update_mercurial_hooks()
setup_git_daemon()
setup_web_links()
install_pear_modules()
prep_apache()
final_msg()
print FINAL_MSG
exit_msg()
exit_msg()
sys.exit()

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.07066s using 14 queries.