Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
ng6
Commits
3f7ebbb4
Commit
3f7ebbb4
authored
Oct 18, 2013
by
Penom Nom
Browse files
No commit message
No commit message
parent
55fd4d00
Changes
1
Hide whitespace changes
Inline
Side-by-side
workflows/install/__init__.py
View file @
3f7ebbb4
...
...
@@ -24,7 +24,7 @@ class Install (Workflow):
def
process
(
self
):
#
s
et typo3 variables
#
S
et typo3
and nG6 path
variables
ng6conf
=
NG6ConfigReader
()
[
db_host
,
db_user
,
db_password
,
db_name
]
=
ng6conf
.
get_typo3_db_params
()
...
...
@@ -38,19 +38,19 @@ class Install (Workflow):
fileadmin
=
os
.
path
.
join
(
ng6_web_path
,
"fileadmin"
)
install_tool_password
=
"typo3"
#Downloading typo3 package
#
Downloading typo3 package
urllib
.
urlretrieve
(
self
.
get_resource
(
"typo3_src"
),
dummy_tmp_zipfile
)
#Testing and Unzipping typo3 package
#
Testing and Unzipping typo3 package
with
zipfile
.
ZipFile
(
dummy_tmp_zipfile
,
'r'
)
as
zipf
:
if
zipf
.
testzip
()
is
None
:
zipf
.
extractall
(
dummy_tmp_dir
)
#Rename typo3 folder
#
Rename typo3 folder
typo3_dir
=
os
.
listdir
(
dummy_tmp_dir
)[
0
]
os
.
rename
(
os
.
path
.
join
(
dummy_tmp_dir
,
typo3_dir
),
os
.
path
.
join
(
dummy_tmp_dir
,
ng6_web_path
.
split
(
"/"
)[
-
1
]))
#
cp
n
g
6 folders
#
Copy
n
G
6 folders
dirutil
.
copy_tree
(
os
.
path
.
join
(
ng6_path
,
"ui"
,
"nG6"
),
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"typo3conf"
,
"ext"
,
"nG6"
))
os
.
mkdir
(
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"fileadmin"
,
"templates"
))
...
...
@@ -61,28 +61,28 @@ class Install (Workflow):
os
.
symlink
(
os
.
path
.
join
(
ng6conf
.
get_save_directory
(),
"data"
),
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"fileadmin"
,
"data"
))
#
c
reate config file
#
C
reate config file
with
open
(
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"typo3conf"
,
"localconf.php"
))
as
f
:
config_lines
=
''
.
join
(
f
.
readlines
()[:
-
1
])
with
open
(
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"typo3conf"
,
"localconf.php"
),
"w"
)
as
f
:
f
.
write
(
config_lines
)
#Set config variables for typo3
#
Set config variables for typo3
localconf.php
f
.
write
(
"$TYPO3_CONF_VARS['EXT']['extList'] = 'extbase,css_styled_content,info,perm,func,filelist,fluid,about,version,tsconfig_help,context_help,extra_page_cm_options,impexp,sys_note,tstemplate,tstemplate_ceditor,tstemplate_info,tstemplate_objbrowser,tstemplate_analyzer,func_wizards,wizard_crpages,wizard_sortpages,lowlevel,install,belog,beuser,aboutmodules,setup,taskcenter,info_pagetsconfig,viewpage,rtehtmlarea,t3skin,t3editor,reports,felogin,form,rsaauth,saltedpasswords,nG6';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['SYS']['compat_version'] = '4.7';
\n
"
)
f
.
write
(
"$typo_db_username = '"
+
db_user
+
"';
\n
"
)
f
.
write
(
"$typo_db_password = '"
+
db_password
+
"';
\n
"
)
f
.
write
(
"$typo_db_host = '"
+
db_host
+
"';
\n
"
)
f
.
write
(
"$typo_db = '"
+
db_name
+
"';
\n
"
)
#Risque de conflit si utilisation de l'installeur typo3
f
.
write
(
"$typo_db = '"
+
db_name
+
"';
\n
"
)
#
Risque de conflit si utilisation de l'installeur typo3
f
.
write
(
"$TYPO3_CONF_VARS['BE']['loginSecurityLevel'] = 'rsa';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['FE']['loginSecurityLevel'] = 'rsa';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['EXT']['extList_FE'] = 'extbase,css_styled_content,fluid,version,install,rtehtmlarea,t3skin,felogin,form,rsaauth,saltedpasswords,nG6';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['BE']['disable_exec_function'] = '0';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['GFX']['gdlib_png'] = '0';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['GFX']['im_combine_filename'] = 'composite';
\n
"
)
# Typo3 password hash
# Typo3 password hash
install_tool_password_hash
=
hashlib
.
md5
(
install_tool_password
).
hexdigest
()
f
.
write
(
"$TYPO3_CONF_VARS['BE']['installToolPassword'] = '"
+
install_tool_password_hash
+
"';
\n
"
)
#Testing unzip binary path :
#
Testing unzip binary path :
unzip_path
=
[
"which"
,
"unzip"
]
p
=
Popen
(
unzip_path
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
...
...
@@ -93,7 +93,7 @@ class Install (Workflow):
with
open
(
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"typo3conf"
,
"ENABLE_INSTALL_TOOL"
),
'a'
):
os
.
utime
(
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"typo3conf"
,
"ENABLE_INSTALL_TOOL"
),
None
)
#Modifying database.sql
#
Modifying database.sql
with
open
(
db_path
,
"r"
)
as
f
:
database
=
f
.
readlines
()
for
iline
in
range
(
0
,
len
(
database
)):
...
...
@@ -106,7 +106,8 @@ class Install (Workflow):
with
open
(
db_path
,
"w"
)
as
f
:
for
line
in
database
:
f
.
write
(
line
)
#Creating database typo3
# Creating database typo3
mysql_create_db
=
[
"mysql"
,
"--host="
+
db_host
,
"--user="
+
db_user
,
"--password="
+
db_password
,
"-e"
,
"CREATE DATABASE "
+
db_name
+
";"
]
p
=
Popen
(
mysql_create_db
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
...
...
@@ -114,7 +115,7 @@ class Install (Workflow):
sys
.
stderr
.
write
(
stderr
)
sys
.
exit
(
0
)
#Inserting tables in typo3 database
#
Inserting tables in typo3 database
mysql_tables
=
[
"mysql"
,
"--host="
+
db_host
,
"--user="
+
db_user
,
"--password="
+
db_password
,
"--default-character-set=utf8"
,
"--database="
+
db_name
]
with
open
(
db_path
)
as
f
:
query
=
''
.
join
(
f
.
readlines
())
...
...
@@ -124,12 +125,12 @@ class Install (Workflow):
sys
.
stderr
.
write
(
stderr
)
sys
.
exit
(
0
)
#
f
ix permissions typo3
#
F
ix permissions typo3
folder
for
dir
in
[
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"typo3conf"
),
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"fileadmin"
),
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"typo3temp"
),
os
.
path
.
join
(
dummy_tmp_dir
,
"ng6"
,
"uploads"
)]:
os
.
chmod
(
dir
,
0o777
)
#
cp
typo3 folder to web folder
#
Finally copy
typo3 folder to web folder
dirutil
.
copy_tree
(
os
.
path
.
join
(
dummy_tmp_dir
,
ng6_path
.
split
(
"/"
)[
-
1
]),
ng6_web_path
,
preserve_mode
=
1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment