Monday, February 6, 2017

Nested bash scripts call graph

One time I had to investigate complex build system from proprietary Linux BSP. It consists of many nested bash scripts. Googling through the Internet I found, that there are no ready tools to create bash call tree. But someone suggested to wrap the shell itself by a custom application, which logs who called it and exec the original shell.
Here you can see my implementation of the wrapper
https://github.com/lvitya/bash_wrapper
bash_wrapper produces a colored log of executed scripts. The log also includes call stack for every script.
The code can be easily modified to help investigate complex nested scripts often used by third-parties to build Linux kernel, rootfs and applications, and to pack it into resulted firmware image.


No comments:

Post a Comment