From 0e15f28fb76f988fe1a7dc83fa5c8c7e282bdc9b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 19 May 2017 12:15:43 -0400 Subject: [PATCH 1/2] feat: allow users to specify an alternative init directory In some existing environments, packages might already use another environment for the purpose this `/etc/my_init.d` directory serves. --- image/bin/my_init | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/image/bin/my_init b/image/bin/my_init index 05c0b6a..b68165a 100755 --- a/image/bin/my_init +++ b/image/bin/my_init @@ -12,6 +12,8 @@ import stat import sys import time +ENV_INIT_DIRECTORY = os.environ.get('ENV_INIT_DIRECTORY', '/etc/my_init.d') + KILL_PROCESS_TIMEOUT = int(os.environ.get('KILL_PROCESS_TIMEOUT', 5)) KILL_ALL_PROCESSES_TIMEOUT = int(os.environ.get('KILL_ALL_PROCESSES_TIMEOUT', 5)) @@ -250,9 +252,9 @@ def kill_all_processes(time_limit): def run_startup_files(): - # Run /etc/my_init.d/* - for name in listdir("/etc/my_init.d"): - filename = "/etc/my_init.d/" + name + # Run ENV_INIT_DIRECTORY* + for name in listdir(ENV_INIT_DIRECTORY): + filename = os.path.join(ENV_INIT_DIRECTORY, name) if is_exe(filename): info("Running %s..." % filename) run_command_killable_and_import_envvars(filename) From 1a235a13e1b40ddec7f1b782c836673074a43c36 Mon Sep 17 00:00:00 2001 From: Travis Rowland Date: Tue, 23 May 2017 14:13:35 -0700 Subject: [PATCH 2/2] Update my_init --- image/bin/my_init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/bin/my_init b/image/bin/my_init index b68165a..7e95ed2 100755 --- a/image/bin/my_init +++ b/image/bin/my_init @@ -252,7 +252,7 @@ def kill_all_processes(time_limit): def run_startup_files(): - # Run ENV_INIT_DIRECTORY* + # Run ENV_INIT_DIRECTORY/* for name in listdir(ENV_INIT_DIRECTORY): filename = os.path.join(ENV_INIT_DIRECTORY, name) if is_exe(filename):