From 17c1d24eae22b45f289f8839d689f64dc9af736e Mon Sep 17 00:00:00 2001 From: Kyle Glaws Date: Thu, 5 May 2022 19:54:28 -0400 Subject: [PATCH] update example_extension README --- example_extension/README | 52 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/example_extension/README b/example_extension/README index 0d14928..ac4d6da 100644 --- a/example_extension/README +++ b/example_extension/README @@ -1,5 +1,7 @@ This directory contains an example MyLFS extension. +!!! THIS FUNCTIONALITY IS A WORK IN PROGRESS, A LOT OF THIS DOES NOT WORK !!! + What is a MyLFS extension? MyLFS by itself builds the Linux From Scratch System V Init version almost exactly according to the book. The end result is of course very @@ -38,7 +40,7 @@ How to create an extension: - Once you have established the list of package URLs inside of pkgs.sh, - you can add the build scripts for each respective package. + you can add the build scripts for each respective package. For example: my_extension/lynx.sh -> builds PKG_LYNX @@ -107,6 +109,54 @@ How to create an extension: ``` +- You can also optionally do the following: + + 1. Add a directory called "static" that contains files that will be copied + as-is into the LFS file system. The files should be named according to + their destination path, except "/" should be replaced with "__". + + For example: + static/home__user__.bashrc -> will be copied to /home/user/.bashrc + + This will replace any files that already exist with the same name. + + + 2. Add a file called "config.sh". It can contain any code you want, but + ideally it would provide exported variables that you can then use in + your build scripts, or as you will see, in file templates. + + Be careful with how you name your variables. You may override some important + environment variable that affects the behavior of the script in unexpected + ways. Don't expect your config.sh to change the behavior of the baseline LFS + build. Your extension's config.sh will only be sourced into the script at the + *end* of the LFS build (which is also the beginning of the extension build). + + + 2. Add a directory called "templates" that contains files named in the + same manner as those under "static", the difference being that certain + keywords within the files will be replaced. Those keywords should be + the same as those of the variables that should replace them. + + For example: + + ``` + # config.sh + export MYHOSTNAME=mycoolhostname + ... + ``` + + ``` + # templates/etc__hosts + 127.0.0.1 localhost + 127.0.1.1 MYHOSTNAME <- this will be replaced with "mycoolhostname" + ... + ``` + + Also, keep in mind the script will replace all occurences of strings that are present + in the environment, so you may end up with more text replacements than you intended if + you aren't careful. + + More Notes: - The logs of the build outputs for each of the packages in the extension