kconfig
介绍 (Intro)
Every Linux professional write scripts. Someеimes light, linear. Sometimes complex script with functions and libs(yes, you can write your bash-library for use in other scripts).
每个Linux专业人士都编写脚本。 淡淡的,线性的。 有时带有功能和库的复杂脚本(是的,您可以编写bash库以供其他脚本使用)。
But some of the scripts need a configuration file to work. For instance, I wrote a script that builds the ubuntu image for pxe, and I need to change the build process without build-script changes. The best way to resolve this task is to add configuration files.
但是某些脚本需要配置文件才能起作用。 例如,我编写了一个脚本来为pxe构建ubuntu图像,我需要更改构建过程而无需更改构建脚本。 解决此任务的最佳方法是添加配置文件。
Writing this config by hands is not a great idea:
手动编写此配置不是一个好主意:
- every user should know all available options 每个用户都应该知道所有可用选项
- hight risk of incorrect data entry 错误输入数据的高风险
- uncomfortable 不舒服
- maybe something else 也许别的
Linux kernel gave us a great solution — KConfig. This system resolves all these troubles:
Linux内核为我们提供了一个很好的解决方案-KConfig。 该系统解决了所有这些问题:
- New config generated automatically 自动生成新配置
- You can set the default value 您可以设置默认值
- The previous version of config saved automatically 以前版本的config自动保存
- text/graphical interface available 提供文字/图形界面
These are not all the benefits. You can see more here.
这些并不是全部好处。 你可以在这里看到更多。