@@ -68,6 +68,21 @@ def stage(buildpack_dir, build_path, cache_path):
6868 os .path .join (buildpack_dir , "etc" , "m2ee" , "m2ee.yaml" ),
6969 os .path .join (build_path , ".local" , "m2ee.yaml" ),
7070 )
71+
72+ scripts_path_source = os .path .join (buildpack_dir , "etc" , "scripts" )
73+ scripts_path_dest = os .path .join (build_path , ".local" , "scripts" )
74+ shutil .copytree (
75+ scripts_path_source ,
76+ scripts_path_dest ,
77+ dirs_exist_ok = True
78+ )
79+
80+ # Add +x permission for all sh scripts
81+ for root , _ , files in os .walk (scripts_path_dest ):
82+ for file in files :
83+ file_path = os .path .join (root , file )
84+ util .set_executable (file_path )
85+
7186 resolve_runtime_dependency (buildpack_dir , build_path , cache_path )
7287
7388
@@ -613,15 +628,35 @@ def _pre_process_m2ee_yaml():
613628 "-i" ,
614629 f"s|BUILD_PATH|{ os .getcwd ()} |g; "
615630 f"s|RUNTIME_PORT|{ util .get_runtime_port ()} |; "
616- f"s|ADMIN_PORT|{ util .get_admin_port ()} |; "
617- f"s|PYTHONPID|{ os .getpid ()} |" ,
631+ f"s|ADMIN_PORT|{ util .get_admin_port ()} |" ,
618632 ".local/m2ee.yaml" ,
619633 ]
620634 )
621635
622636
637+ def _pre_process_on_error_scripts ():
638+ logging .debug ("Preprocessing on error scripts..." )
639+ subprocess .check_call (
640+ [
641+ "sed" ,
642+ "-i" ,
643+ f"s|PYTHONPID|{ os .getpid ()} |" ,
644+ ".local/scripts/on_error.sh" ,
645+ ]
646+ )
647+ subprocess .check_call (
648+ [
649+ "sed" ,
650+ "-i" ,
651+ f"s|PYTHONPID|{ os .getpid ()} |" ,
652+ ".local/scripts/on_out_of_memory_error.sh" ,
653+ ]
654+ )
655+
656+
623657def setup (vcap_data ):
624658 _pre_process_m2ee_yaml ()
659+ _pre_process_on_error_scripts ()
625660 _activate_license ()
626661
627662 client = m2ee_class (
0 commit comments