From 5476f1c799b3fc0ac38d11ad991819f5e1ccd427 Mon Sep 17 00:00:00 2001 From: titoko Date: Wed, 17 Jul 2013 17:33:45 +0200 Subject: [PATCH 1/3] make webapp have their own apache conf files --- yunohost_app.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/yunohost_app.py b/yunohost_app.py index 26e5e2b6..5daadaec 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -511,21 +511,23 @@ def app_install(app, domain, path='/', label=None, mode='private'): ########## # Apache # ########## + if lvl(manifest,'yunohost','webapp','custom_apache_conf'): + os.system('mv '+app_tmp_folder+'/'+manifest['yunohost']['webapp']['custom_apache_conf']+' '++a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf') + else: + a2_conf_lines = [ 'Alias '+ path +' '+ app_final_path + manifest['launch_path'] ] + if path != '/': + a2_conf_lines.append('Alias '+ path[:len(path)-1] +' '+ app_final_path + manifest['launch_path']) - a2_conf_lines = [ 'Alias '+ path +' '+ app_final_path + manifest['launch_path'] ] - if path != '/': - a2_conf_lines.append('Alias '+ path[:len(path)-1] +' '+ app_final_path + manifest['launch_path']) + a2_conf_lines.append('') - a2_conf_lines.append('') + if lvl(manifest, 'yunohost', 'webapp', 'language') and manifest['yunohost']['webapp']['language'] == 'php': + for line in open(a2_template_path +'/php.conf'): a2_conf_lines.append(line.rstrip()) - if lvl(manifest, 'yunohost', 'webapp', 'language') and manifest['yunohost']['webapp']['language'] == 'php': - for line in open(a2_template_path +'/php.conf'): a2_conf_lines.append(line.rstrip()) + a2_conf_lines.append('') - a2_conf_lines.append('') - - with open(a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf', 'w') as a2_conf: - for line in a2_conf_lines: - a2_conf.write(line + '\n') + with open(a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf', 'w') as a2_conf: + for line in a2_conf_lines: + a2_conf.write(line + '\n') ######################################### From 1e0a66266ba13ed3673fd99c99d98ff538ce53f8 Mon Sep 17 00:00:00 2001 From: titoko Date: Wed, 17 Jul 2013 17:42:22 +0200 Subject: [PATCH 2/3] bugfix --- yunohost_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yunohost_app.py b/yunohost_app.py index 5daadaec..2485b3f7 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -512,7 +512,7 @@ def app_install(app, domain, path='/', label=None, mode='private'): # Apache # ########## if lvl(manifest,'yunohost','webapp','custom_apache_conf'): - os.system('mv '+app_tmp_folder+'/'+manifest['yunohost']['webapp']['custom_apache_conf']+' '++a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf') + os.system('mv '+app_tmp_folder+'/'+manifest['yunohost']['webapp']['custom_apache_conf']+' '+a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf') else: a2_conf_lines = [ 'Alias '+ path +' '+ app_final_path + manifest['launch_path'] ] if path != '/': From 77e791c3beba183bcdbdf8d65f4ec1ae97ccd679 Mon Sep 17 00:00:00 2001 From: titoko Date: Fri, 19 Jul 2013 10:18:20 +0200 Subject: [PATCH 3/3] Update yunohost_app.py chown only if not privileged or certified --- yunohost_app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yunohost_app.py b/yunohost_app.py index 2485b3f7..9a743be3 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -332,7 +332,8 @@ def app_upgrade(app, instance=[], url=None, file=None): os.system('cp -a "'+ app_tmp_folder +'" "'+ app_final_path +'"') if is_web: - os.system('chown -R www-data: "'+ app_final_path +'"') + if app_type != 'privileged' and app_type != 'certified': + os.system('chown -R www-data: "'+ app_final_path +'"') os.system('service apache2 reload') shutil.rmtree(app_final_path + manifest['yunohost']['script_path']) @@ -543,7 +544,8 @@ def app_install(app, domain, path='/', label=None, mode='private'): os.system('cp -a "'+ app_tmp_folder +'" "'+ app_final_path +'"') if is_web: - os.system('chown -R www-data: "'+ app_final_path +'"') + if app_type != 'privileged' and app_type != 'certified': + os.system('chown -R www-data: "'+ app_final_path +'"') os.system('service apache2 reload') shutil.rmtree(app_final_path + manifest['yunohost']['script_path'])