LFScript Switches

From LFScript

LFScript is a command line application. You must provide LFScript with one or more switches to control what LFScript will build. Some switches (also called 'options') require additional arguments.

If you want to give several options without arguments, you can collapse them. The following two commands produce identical results:

./lfscript -B -u -x nano -k myconfig.config
./lfscript -Bux nano -k myconfig.config

If you want to give a switch multiple arguments you must enclose them in quote marks.

./lfscript -Bx nano which      # WRONG!
./lfscript -Bx "nano which"    # Right

Every switch should be used only once per session, and not every switch will allow the use of others. However, with the right options set, it is possible to build and install your entire system in a single session.

Building the base system

Every time you use LFScript, you must specify a base system at least. Even if you've already build it and only want to extend or install your system, you must always specify which base system to use.

-B

This will automatically select the base system for you, if only one is available.

Normally, LFScript is distributed with scripts for a single base system, making this option the easiest to use of the two 'b' options.

-b <basesystem>

With this option you can specify which base system to build.

-k <kernel_configuration>

Uses the specified Linux configuration file when building the kernel. If this option has not been set, LFScript will run make defconfig on the kernel, producing a default kernel configuration which probably lacks drivers and other support for your system. See Kernel configuration for more information on how to create this configuration file.

Scripts named "kernel", or have the keyword "kernel" in their TAGS variable (see Script layout) will receive the configuration file.

LFScript has sample kernel configurations (used by the fsOS Live CD) in the "fsos" folder.

Examples

./lfscript -B                            # Builds an LFS system
./lfscript -b lfs-9713                   # Builds LFS SVN revision 9713 (if scripts for it exist)
./lfscript -Bk fsos/3.2.1-i486.config    # Builds an LFS system and uses an fsOS kernel configuration file

Building beyond the base system

In LFScript 4, you can build your entire operating system including a base system, X Window System, and any other software in a single session.

-x "<package1> [package2] [pa..."

Builds the selected additional packages when the base system has been completed. Unlike with the base system, which defines the software it uses in buildbase.lfs, LFScript will automatically resolve dependencies for the selected packages and build them too.

If there are multiple scripts suitable to build the packages you selected, LFScript will ask you to be more specific in this list. For example, if you want to build the X Window System and there are multiple scripts available for libpng, one in the scripts/blfs-9193 folder and one in the scripts/custom folder you can select one like this:

./lfscript -Bx "x-window-system custom/nano"

-s "<package1> [package2] [pa..."

Excludes the selected extra packages from the build or installation. This does not affect the base system (modify the buildbase.lfs file to disable building software in LFS).

Sometimes when you build custom scripts, one may fail for some reason. If you do not want to address that issue immediately, you can add that script to this list to temporarily remove it (and all other scripts that depend on it) from the build process.

The following command will build all packages of the X Window System, except those that depend on libpng.

./lfscript -Bx "x-window-system" -s libpng

Resuming a build

It is possible to abort a build and resume it later, or build additional packages after a session has completed. You can find more detailed information about this in Aborting and Resuming.

-u

Restores the toolchain and uses your precompiled packages where available. This option is only available for base systems for which the temporary toolchain has already been built.

-U "<package1> [package2] [pa..."

Like -u, but rebuilds the selected packages anyway if a precompiled version has been found.

-C

Like -u, but restarts the build process after completing each package. This ensures that software only links against packages that it depends on (as defined in the REQUIRES variable of their script).

Without this option, a build is performed linearly. Linear builds only can cause problems (failure to locate shared object files) if you later decide to not install every package you built.

This option currently makes the build more intensive for your hard disk and uses more time to complete, as it resets the build environment for every package.

Examples

./lfscript -Bu                              # Resumes building your base system
./lfscript -BU kernel -k myconfig.config    # Rebuilds your Linux kernel, and any missing base system packages
./lfscript -Bux nano                        # Builds the 'nano' editor, and any missing base system packages

Installing your system

You can use LFScript to install your OS, but at the moment it does not configure a boot loader nor does it install /etc/fstab. See Installing your system for a complete guide on installing your system.

It is recommended that you compile all packages before you install it, to resolve any issues beforehand.

-i <directory>

Tells LFScript to install to the defined directory. The directory must be a mountpoint.

-I <overhead_directory>

Tells LFScript to keep the /sources and /tools directories out of the installation directory, but in stead temporarily stores them in the directory specified.

This allows you to install a system to a partition with only just enough room for your OS.

Switches causing LFScript to NOT build anything

-S

Only download source code for the selected base system and extra packages.

./lfscript -BSx x-window-system    # Downloads source code for a system with X11 and then quits

-L

Print a list of the order in which packages will be built or installed.

./lfscript -BLx fsos-nox-32    # Prints every package included in the non-graphical version of the fsOS Live CD

Miscellaneous switches

-M

Makes LFScript ignore the minimal system requirement of 1GB of memory.

-A

Automatically abort on any error. Without this option, LFScript will prompt you to abort manually whenever an error occurs.