Compare commits

...
This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.

493 commits

Author SHA1 Message Date
Euiseo Cha
41e5e3f5d8
Merge remote-tracking branch 'upstream/trunk' into mihari-dev 2023-11-26 14:31:01 +09:00
Pierre Labastie
35094eda67 Major refactoring of README
Describe each item in the menu, fix layout, and try to follow
the order of tasks to do to run jhalfs.
2023-11-23 10:07:45 +01:00
Pierre Labastie
cd87e527fe Fix configuration about saving temporary work
It is no more at the end of chapter five now... Also the tar file is
not compressed
2023-11-23 10:05:27 +01:00
Pierre Labastie
6ffc37b902 Confg.in: fix help for ALL_CORES
The settings don't depend on book version, and you can answer y even
with old books.
2023-11-21 11:51:29 +01:00
Pierre Labastie
10756d05d7 Move the parallelism menu to "Build Settings"
Now that parallelism has been included into the book, this is no
more an advanced configuration...
2023-11-21 10:40:52 +01:00
Pierre Labastie
9440e4ac61 Merge branch 'trunk' into xry111/parallelism 2023-11-21 10:37:56 +01:00
Pierre Labastie
bc64795e63 Remove a spurious menu in Config.in 2023-11-21 10:36:30 +01:00
Pierre Labastie
824efcac1c Merge branch 'trunk' into xry111/parallelism 2023-11-21 10:23:18 +01:00
Pierre Labastie
c1f02f262e LFS: remove alternate server code
It's been broken for years, and nobody has complained, so I'd say
it is not useful. If a user wants to use a mirror instead of upstream,
better use a wget-list directly on this server...
2023-11-21 10:19:20 +01:00
Pierre Labastie
05b955b62c BLFS: remove support for ftp and alternate server
ftp urls have been removed from book, and in case you have to use
an alternate server, better download directly to /sources/yourself.
2023-11-21 10:12:28 +01:00
Pierre Labastie
23b0161d6c BLFS tools: update qt?-prefix for recent books 2023-11-18 10:36:47 +01:00
Pierre Labastie
c5f4ef3d5e BLFS tools: update qt?-prefix for recent books 2023-11-18 07:47:29 +01:00
Pierre Labastie
67ca47e5f8 Stupid typo 2023-11-17 16:31:22 +01:00
Pierre Labastie
924076f0b5 blfs tools: fix JOBS
If all cores are used, it should be set to 0, which will use nproc
after the cpuset has been defined, and not nproc (which is the number
of cores/threads on the machine).
2023-11-17 16:10:01 +01:00
Pierre Labastie
04a608ba8e Pass NINJAJOBS if N_PARALLEL is defined
Now that MAKEFLAGS is defined at the beginning of the scriptlet,
there is no need to pass MAKEFLAGS as an envar to the scriptlet.
But still NINJAJOBS is not defined. In most cases, when we want
to use all cores, this is not a problem. But if N_PARALLEL is
defined, it needs to be passed. Note that we also pass
MAKEFLAGS in this case, because we use the old "wrt_xxx" function,
but it is not used.
2023-11-17 15:57:55 +01:00
Pierre Labastie
a9360e10a7 Fix MAKEFLAGS for binutils-pass1
We need a special case for binutils-pass1 in case REALSBU is set
to y. Use variables JOBSBP1 in shell and jobs-bp1 in .xsl.
2023-11-17 15:55:36 +01:00
Pierre Labastie
da4bce358d Fix blfs tools Makefile now that MAKEFLAGS is set
Previously, the "update" target was just added to the end of
the "all" target prerequisites, so that it was run at the end.
But now, we enter make with some -j value in MAKEFLAGS, so that
the "update" target may well be run before the other targets, which
is wrong: for example if it is run before the "xxx-z-libxslt" target,
xsltproc is not found and the update target fails.
To fix, define "update" as the default target, and have it depend
on "all".
2023-11-17 13:59:06 +01:00
Pierre Labastie
d18fc24d5b blfs tools: update JOBS for the new config
Now, we have ALL_CORES set to y or n, and depending on this,
we want either JOBS to be set to $(nproc) or to the value
of N_PARALLEL.
2023-11-17 13:57:15 +01:00
Pierre Labastie
078ef3cf12 Pass sanitized MAKEFLAGS to scriptlets
Now that we have MAKEFLAGS in the environment, "make" in chroot
is run with MAKEFLAGS set. This cause it to pass the -j value
into MAKEFLAGS to inferiors (scriptlets), but it is passed with
a --jobserver-auth value added. If we do not precede the command
running the scriptlet with a +, it passes --jobserver-auth=-2,-2
meaning that the jobserver is disabled, and "make" in the scriptlet
understands that it should only run one job at a time (defeating
the value of the -j flag). But even if we do precede the command
running the scriptlet with a +, it passes --jobserver-auth=3,4,
which shows it is running, but this jobserver will authorize only
one job at a time since the parent make contains the target
.NOTPARALLEL!
To work around this problem, tje only solution is to change the
MAKEFLAGS at the beginning of the scriptlet. Fortunately, lfs.xsl
knows what we want as job number (either $(nproc) or a fixed number),
so use it to set MAKEFLAGS.
2023-11-17 13:18:12 +01:00
Pierre Labastie
249d4ade20 Fix (again) the run-in-cgroup.sh script
When using "sh  << EOF", what is between this line and EOF runs
with no attached terminal. But we need a terminal for running the
build. So we have to use "sh -c ". But then nesting of double
quotes, $, etc is too complicated. So run as root, and become back
user only when exec'ing. For some reason $@ does not work, so use
a variable set to $@.
2023-11-16 16:10:46 +01:00
Pierre Labastie
09ac7fc548 Typo
The name of the script is run-in-cgroup.sh, not run-in-cgroup ...
2023-11-16 16:10:07 +01:00
Pierre Labastie
cff36a77ba Fix session management in run-in-cgroup.sh
Still WIP but some progress...
When moving a shell to a cgroup not associated with a session,
then subsequent calls to pam_systemd or pam_elogind create
a new session, and a new cgroup for that session, so that the
cgroup of the calling process is not used (this is a problem
with both systemd and elogind). For systemd, the problem can be
solved by passing --slice <user slice> to systemd-run. For elogind,
we need to first move the shell to a non session cgroup, then run
sudo so that a new session is created, then pass the cpuset to that
session's cgroup. Hopefully, if neither systemd nor elgind is used,
then the former solution should work (to be tested!!!).
2023-11-16 14:37:58 +01:00
Pierre Labastie
8e9343b632 Add forgotten run-with-cgroup.sh script 2023-11-15 19:37:58 +01:00
Pierre Labastie
640cd5746b Fix a typo 2023-11-15 18:24:22 +01:00
Pierre Labastie
cacc6c5433 Allow users to pass a cpuset
If using a new book, MAKEFLAGS is set to -j$(nproc), so that if
we want to easure timings with 4 processors and our computer has
more than that, we need to restrict the number of processors.
Jhalfs allows to do that using th cpuset cgroup controller, so that
it only restrits the make job and not the whole machine. For that
use a small scripts written by Xi Ruoyao that restarts make this
the cpuset set.
2023-11-15 18:24:22 +01:00
Pierre Labastie
63190e6547 Only pass MAKEFLAGS and NINJAJOBS to old books
Also pass them to binutils-pass1 if calculating the SBU
2023-11-15 18:24:22 +01:00
Pierre Labastie
3c43655ec6 Only replace $(nproc) in scriptlets
There is no more $(nproc || echo 1). Note that we may replace
it with $(nproc) if using all cores, so don't replace it in
the comment-test template (otherwise we have infinite recursion).
2023-11-15 18:24:22 +01:00
Pierre Labastie
645ec4780e Reorganize advanced options in Config.in
- Put parallelization menu first
- Fix the logic for variable definitions in this menu
- change jhalfs to reflect the separation of optimization and
  parallelization
- validate new variables
- remove MAKEFLAGS from the validation of optimize variables
- also remove the black list, which has not been used in years.
2023-11-15 18:24:22 +01:00
Pierre Labastie
1352172467 Merge branch 'trunk' into xry111/parallelism 2023-11-13 13:44:32 +01:00
Pierre Labastie
5ed69f823f Dependency on xorg7-* only on last package
Our gen-special.sh transforms a dependency on compound packages
(xorg7-*) on a dependency on the list of packages. This generates
a lot of trials when removing circular dependencies, because if the
dependency on xorg7-* is optional, all packages in the list are tried
in turn, while it is sure that anyway the dependecy must be eliminated.
If the dependency is only on the last package, the circular dep
is eliminated at first try.
2023-10-21 13:37:50 +02:00
Pierre Labastie
6d9bd8e8e8 Add help about kernel config
Now, there is a timeout if the config file is not up to date. Say
so in the help.
2023-09-17 09:41:42 +02:00
Pierre Labastie
1c22535b2e Process two more <replaceable> tags
- one for libreoffice (use the xreflabel to set LO_PREFIX)
- one for abiword (installation of normal.awt-ll_CC files)
2023-09-16 13:39:39 +02:00
Pierre Labastie
9a89ba79de ablfs: new pattern for config recognition
chgrp -v mail ... is found in mutt and shouldn't considered
an install command.
2023-09-16 09:39:53 +02:00
Pierre Labastie
c552eabe63 Always run "teardown" after chroot
If the shell exits with an error, teardown is not run in target
chroot, which may lead to unwanted effects, such as preventing
unmounting the $BUILD_DIR. Tell make to ignore the error.
2023-09-14 16:03:37 +02:00
Pierre Labastie
200cc0151e All the targets after mk_SUDO depend on "devices"
Now that devices.sh can be run even if the fs are already mounted
all the targets after mounting the virtual kernel fs can depend
on "devices". This way, if for some reason a partial build is
restarted after a reboot, the virtual kernel fs are automatically
re-mounted.

Fixes #1737
2023-09-12 22:58:55 +02:00
Pierre Labastie
aceacf2f85 Modify kernfs scripts to be able to run them twice
Those scripts could only be run once, because mount errors out
if it tries to mount an already mounted fs (or unmount a non
mounted fs). This changes generation of the scripts so that
any mount is preceded with "mountpoint -q || ", and any umount
is preceded with "mountpoint -q && ".
2023-09-12 22:54:51 +02:00
Pierre Labastie
74601a7f06 Separate parallelization from optimization
Also, add cpu set choice and the possibility to use nproc
2023-09-11 19:22:13 +02:00
Xi Ruoyao
1b02a9acff
Replace $(nproc || echo 1) and $(nproc) 2023-09-11 16:04:44 +08:00
Pierre Labastie
3b27f93764 Apply a timeout to kernel config in LFS
If the kernel-config file is not up to date (missing options or
whatever), the kernel "make" will hang, waiting for input. So
run "make oldconfig" explicitly, with a timeout.

Fixes: #1736
2023-09-08 17:01:52 +02:00
Pierre Labastie
06b731490f Allow two names for scriptlet containing "userdel"
It used to be named "revised_chroot", it is now named "cleanup"
Allow both names by testing whether revised something is present.
2023-09-05 13:14:26 +02:00
Pierre Labastie
45f82b1326 Use /usr for XORG_PREFIX unconditionally:
This is possible now that instruction for non /usr XORG_PREFIX
have been made role="nodump".
2023-09-03 23:35:33 +02:00
Pierre Labastie
08614168ec Hide DEL_LA_FILES in internal settings
This prevent normal users to change the default while preserving
the possibility to set it to "n" for tests or whatever.
Fixes ticket #1734
2023-08-30 20:20:59 +02:00
Pierre Labastie
9eb3dbe1c4 Don't build Xorg components that are commented out
gen-special.sh uses the list of files and md5 from the
cat instructions to generate an xml page for each of
the individual components. Until now, there were no commented
out component, so gen-special.sh was not prepared to handle
comments. Now, it removes lines containing comments.
2023-08-30 20:04:38 +02:00
Pierre Labastie
4ba94ad556 Update copyright year 2023-05-24 10:46:14 +02:00
Pierre Labastie
78d04f3f79 Fix "ambiguous redirect" in func_dependencies
We use grep -l ^"${otherlink[*]"\$ to find parentNode, since the
parentNode is the only file with a link line that matches. Problem
is that sometimes the priority line may match too. This makes a
parentNode variable containing several lines, and when redirecting
to $parentNode, creates those "ambiguous redirect" messages.
Fix: use a loop, and only grep on the first line of each file.
2023-04-21 10:49:40 +02:00
Euiseo Cha
c18186f031
fix: bugs 2023-03-30 17:38:31 +09:00
Euiseo Cha
c463f10a88
fix: bugs 2023-03-30 17:33:40 +09:00
Euiseo Cha
4978d4d7f6
feat: md5sum update 2023-03-30 15:39:25 +09:00
Euiseo Cha
a2598ef89f
fix: bugs 2023-03-30 15:34:40 +09:00
Euiseo Cha
a23b5e3116
feat: fix config 2023-03-30 12:32:48 +09:00
Euiseo Cha
23be80624c
feat: fix config 2023-03-30 12:16:28 +09:00
Euiseo Cha
cd1fa118f5
feat: fix config 2023-03-30 12:09:51 +09:00
Euiseo Cha
22eb3171ad
feat: package manager -> dpkg 2023-03-30 12:02:54 +09:00
Euiseo Cha
f6e9ef2fac
feat: hardend 2023-03-25 16:29:45 +09:00
Euiseo Cha
adf818b9b3
feat: hardend 2023-03-25 15:08:14 +09:00
Pierre Labastie
72711ab1cd list_lfs.xsl: fixes for dependency checking
Add several packages that shouldn't be removed when doing dependency
checking, two of which are actually not in lfs, but needed for
script: porg tzdata sudo wget
2023-03-23 22:24:06 +01:00
Pierre Labastie
4dfe8f99c4 gen_pkg_book: fixes for dependency checkings
Fix a typo in function definition
use sudo for porg -r and porgball -e
2023-03-23 22:21:26 +01:00
Pierre Labastie
1bf09c15a7 Implementation of dependency checking 4
Implement generation of a modified script if dependency checking is
requested.
2023-03-23 18:38:51 +01:00
Pierre Labastie
42dfc6ef21 Implementation of dependency checking 3
Add an XSL stylesheet for listing packages in LFS. Those are
not listed anywhere else, but they are considered dependencies of
everything, so should never be erased.
2023-03-23 18:37:20 +01:00
Pierre Labastie
dedd502636 Implementation of dependency checking 2
Check the configuration variable in gen_pkg_book
2023-03-23 18:34:50 +01:00
Pierre Labastie
0a1943912e Implementation of dependency checking 1
Generate a switch for configuration
2023-03-23 18:32:24 +01:00
Pierre Labastie
3fa4147515 outputpkgdest: don't mix make and qmake
For outputting DESTDIR=, we need to test whether the text contains
"make". But when it contains "qmake" (or any different word containing
"make" but not exactly "make), we don't want to output anything more
than the text. So strengthen the test.
2023-03-19 10:15:18 +01:00
Pierre Labastie
6ac0d96300 outputpkgdest: fix the case of several <literal>
We output text()[1], literal (literally), text(2). This does
not work if there are several <literal> tags. Change it to
outputing preceding-sibling::text()[1], literal for each
literal tag, then output text()[last()] (which works also
when there are no literal tag, so it removes a choose.
2023-03-19 10:10:24 +01:00
Pierre Labastie
24ad4fd4f4 Fix outputting too many sh <<ROOT_EOF
When installing a bootscript or a unit, this sometimes happen
(e.g. samba).
2023-03-18 22:44:03 +01:00
Euiseo Cha
e98162dfb2
feat: add kerne config 2023-03-09 11:31:29 +09:00
Euiseo Cha
4fdf9f301e
feat: main config update 2023-03-08 12:17:27 +09:00
Euiseo Cha
93b6920dbf
feat: main config update 2023-03-08 12:06:58 +09:00
Pierre Labastie
5126ee3663 porg: fix wrapInstall command 2023-03-07 22:23:37 +01:00
Pierre Labastie
3940a45db3 Have the subshell exit on error for porg install 2023-02-26 22:44:19 +01:00
Pierre Labastie
b39eb29be5 Revert changes to BLFS/Makefile
Changes to book's Makefile have been reverted too...
2023-01-25 13:17:12 +01:00
Pierre Labastie
5c8df43896 Adapt BLFS/Makefile to the new book layout
With the change to python modules and the pythonhosted.xml file
becoming untracked, those changes allow creating/updating this
file.
2023-01-20 10:05:38 +01:00
Pierre Labastie
951d334793 Upadte packInstall for libslirp
Version has a -v, which should be removed in "extract-version"
2023-01-01 14:01:45 +01:00
Pierre Labastie
33ee66c69e Typo in a comment 2022-12-06 15:20:00 +01:00
Pierre Labastie
0f4df7ccfd BLFS tools: don't generate duplicate download code
For additional downloads, the normal book layout is a <bridgehead>
containing "Additional Downloads" followed by one or more
<itemizedlist>, one for each file to download. But on some pages,
there are several <bridgehead>, each followed by one or more
<itemizedlist>. So we have to check that only the <itemizedlist>
correponding to the current <bridgehead> are treated. Otherwise,
the download code may be generated more than once. This imposes
that no other bridgehead is inserted between the one containing
"Additional" (or in some case "Recommended/Optional Download") and
the <itemizedlist>.
2022-11-18 15:45:42 +01:00
Xi Ruoyao
ed335a3113
handle '+' in kernel version string
It appears if the kernel is built from Git repo where HEAD is not a tag.
2022-11-04 22:44:57 +08:00
Pierre Labastie
35f6261ab5 Run the master Makefile with -j1
Also remove some instructions that are only useful for debugging.
2022-11-04 13:19:18 +01:00
Pierre Labastie
fd90f80466 Prevent parallelism in the master Makefile 2022-11-04 13:18:11 +01:00
Pierre Labastie
262e174aa1 systemd: copy /etc/resolv.conf from the host
when entering chroot. This allows using the network in chroot.
2022-10-06 10:39:09 +02:00
Pierre Labastie
3722d3164c Call kernel filesystem scripts from Makefile
Instead of having them inside the Makefile, which implies editing
them (automatically), which is not robust if anything changes:
it got broken when a test for a mountpoint was added...
2022-10-06 10:26:29 +02:00
Pierre Labastie
87eb9e9a94 Make the kernel filesystem scriptlets executable
This is so that they can be run from the main Makefile, instead
of having to edit them to put them inside the Makefile.
2022-10-06 10:20:34 +02:00
Pierre Labastie
8bcaf0d58b Typo 2022-10-02 17:18:11 +02:00
Pierre Labastie
e181f757ba The Optimization menu is also for parallelization 2022-09-29 21:13:03 +02:00
Pierre Labastie
5156f51859 BLFS: remove only "a" lines for runtime deps
Presently, when the <node>groupxx file is created, we copy "a"
lines from <node> to <node>groupxx (changing "a" to "b") and
we remove all the lines containing the runtime dependency from
<node>. This may not always be what we want: for example, a
dependency can be both "required at runtime" and "optional for
tests". We should keep this information when cleaning the nodes.
Only when removing circular paths should the optional tie be broken
if necessary.
2022-09-07 15:51:45 +02:00
Pierre Labastie
875366f635 move git://git.linuxfromscratch.org to https:// 2022-08-19 12:38:59 +02:00
Pierre Labastie
594ff3d878 Remove the "Abort on testsuite failure" config (4)
Remove the bomb-testsuite param in lfs.xsl, with the associated
code.
This implies not passing this param in func_book_parser.
2022-06-15 15:10:52 +02:00
Pierre Labastie
29615d9e3a Remove the "Abort on testsuite failure" config (3)
Remove the display of BOMB_TEST when validating the config.
2022-06-15 15:09:49 +02:00
Pierre Labastie
316d06039f Remove the "Abort on testsuite failure" config (2)
Remove the BOMB_TEST variable in jhalfs
2022-06-15 15:08:57 +02:00
Pierre Labastie
d54e3c9856 Remove the "Abort on testsuite failure" config (1)
Remove the choice in Config.in.
Remove the BOMB_TEST variable from configuration.
2022-06-15 15:05:49 +02:00
Pierre Labastie
ff30640702 Fix an error when not downloading packages
When not downloading packages, the function "get_sources" returns
early because it begins with:
[ "$GETPKG" = y ] || return
The problem is that in this case it returns with an exit code
inherited from the last executed instruction, which is the
test (and therefore "false"). The solution is to change to
return 0.
2022-06-14 18:55:36 +02:00
Pierre Labastie
55e82d2ae0 Various updates for pacman PM
- update versions and instructions in packageManager.xml.pacman.
  Also remove the pages for old books.
- Fix packInstall.sh.pacman, so that restarting after a failure
  is possible
- Change LFS/lfs.xsl so that destdir install use symlinks for
  /lib, /sbin, and /bin. Remove also absolete commands for old
  books
- fix gcc script in book parser
2022-06-12 22:54:14 +02:00
Pierre Labastie
84d0d39a97 Do not run "stripping" if STRIP=n during ICA
LFS/lfs.xsl does not generate correct commands for stripping if
STRIP=n. LFS/master.sh had already been corrected to not run
stripping if STRIP=n, but only for the first pass. Do this for
all passes.
2022-05-21 19:07:38 +02:00
Pierre Labastie
93814d176b Typo in LFS/master.sh (in a comment) 2022-05-21 19:07:16 +02:00
Pierre Labastie
82ddba94a3 Add gnome-control-center to the list of install overrides 2022-05-13 11:17:19 +02:00
Pierre Labastie
f32cd505a8 Load the optimize functions even if optimize=0
wrt_makeflags is needed to pass NINJAJOBS=1 in this case.
2022-05-07 20:47:52 +02:00
Pierre Labastie
d3dbebe625 master.sh: use the new wrt_makeflags function
It now take three arguments:
- name of the package
- MAKEFLAGS
- NINJAJOBS
2022-05-07 20:47:52 +02:00
Pierre Labastie
86debb00ea optimize_functions: change wrt_makeflags parameters
In order to be able to pass NINJAJOBS=1 when optimize is 0, we
add two paramters to this function. The three parameters are
then:
- the name of the package (tested against opt_override)
- MAKEFLAGS for this package
- NINJAJOBS for this package
2022-05-07 20:47:30 +02:00
Pierre Labastie
28ef51b817 Fix spurious quotes in download code
$WGETPARM contains several switches separated by blank spaces.
If quoted in the wget command, it appears as an url with
spaces, not as switches.
2022-05-07 11:56:28 +02:00
Pierre Labastie
6df52e8417 Update TODO 2022-05-07 11:55:07 +02:00
Pierre Labastie
dc53def3ee Only use upstream URL when downloading packages
Also fix typos and shell programming. Use "cat file | while read"
instead of a complicated construct for reading only lines and then
breaking lines into their fields... Fix a TODO item
2022-05-07 11:25:43 +02:00
Pierre Labastie
88e5cbc258 Use only upstream's URL in urls.lst 2022-05-07 11:24:06 +02:00
Pierre Labastie
924a237843 Fix $(BUILDDIR)/jhalfs/Makefile
Now that we have only lfs, some lines in the Makefile have been
removed, but still some shell continuation (&& \) were left. This
leads to weird error message (@ non existing command, or so).
Remove the continuation characters.
2022-04-03 21:42:25 +02:00
Pierre Labastie
9b99adace9 Change variable names and logic for BLFS book
Only use BLFS_COMMIT instead of BLFS_BRANCH_ID, BLFS_TREE, BLFS_BOOK
Same for le LFS_BLFS variables
2022-04-01 10:26:17 +02:00
Pierre Labastie
30a444a477 Fix some bugs in func_install_blfs
- do not try to copy downloaded files to $SRC_ARCHIVE: they may
  belong to another user, and so be non writable.
- trunk/BOOK is not used anymore in BLFS/Makefile
- do not make update a second time
2022-04-01 10:25:48 +02:00
Pierre Labastie
8c2b505caf Fix small bugs in func_download_pkgs
- If MISSING_FILES.DMP is left from a preceding attempt, it may
generate a false warning a bout missing files even if they could
all be downloaded.
- do not try to copy a modified file to SRC_ARCHIVE if it already
exists: it may belong to another user...
2022-04-01 10:18:15 +02:00
Pierre Labastie
a2917edfa2 Try to clarify help in Config.in
Also prevent the chroot/boot method to be prompted for the blfs
book
2022-04-01 10:16:45 +02:00
Pierre Labastie
2bf44e2724 Try to make an information clearer about $COMMIT 2022-04-01 10:13:55 +02:00
Pierre Labastie
2c1a763990 try to fix func_install_blfs to work in all cases
WIP...
2022-03-30 22:35:12 +02:00
Pierre Labastie
1242857a75 BLFS/Makefile: Don't run git checkout if {B,}LFS-BRANCH is empty
Fix also the order of checkout trunk and checkout $(...-BRANCH)
2022-03-30 22:33:08 +02:00
Pierre Labastie
3e82b0bd81 Update TODO 2022-03-30 17:47:42 +02:00
Pierre Labastie
8825e69592 Get completely rid of PROGNAME
There is only one PROGNAME: lfs, so no need for a variable.
2022-03-30 17:45:35 +02:00
Pierre Labastie
2bd2fb81d0 Replace $PROGNAME-commands with $COMMANDS
This allows to remove some references to PROGNAME
2022-03-30 14:49:43 +02:00
Pierre Labastie
2fd624d8f6 Get rid of BRANCH_ID, TREE, LFSVRS variables
There is only one variable: COMMIT. Note that this commit
also changes $PROGNAME-$LFSVRS to $BOOK.
2022-03-30 14:26:41 +02:00
Pierre Labastie
9f89fae89a LFS: Simplify git repo management
Use inly one variable, REPO, containing the LFS git repo url. The
BLFS Makefile hardcodes the LFS and BLFS git repo urls, so no need
to pass them.
2022-03-30 12:27:03 +02:00
Pierre Labastie
f45af2ca4d Config.in: simplify selection of book source
Use the variable COMMIT instead of BRANCH_ID.
Also fix various typos, CLFS/HLFS reference, help strings, etc.
For the moment, the selections for the BLFS tools are unchanged.
2022-03-13 20:53:39 +01:00
Pierre Labastie
62206d62a3 Add TODO item for first thing to do 2022-03-13 20:14:52 +01:00
Pierre Labastie
48700c348f Typo in Config.in 2022-03-13 16:49:12 +01:00
Pierre Labastie
c412a07545 Fix packInstall.sh.porg for upower-vx.x 2022-03-13 13:16:59 +01:00
Pierre Labastie
327a3ee7ba Change mail address for sending reports 2022-03-02 11:46:09 +01:00
Pierre Labastie
9a86aa588e Miscellaneous tweaks found while removing clfs 2022-03-01 21:11:02 +01:00
Pierre Labastie
0fa52f2403 Remove legacy: Remove almost all occurrences of CLFS/clfs 2022-03-01 21:09:30 +01:00
Pierre Labastie
4c36783ec4 oRemove legacy: do not run tests in temporary tools (2) 2022-02-28 14:11:30 +01:00
Pierre Labastie
7f25c704ed reinstate sudo as a dependency of blfs tools
Was removed at a preceding commit for no good reason
(pebkac?)
2022-02-28 14:01:08 +01:00
Pierre Labastie
9d665db456 Remove legacy: remove tests in temporary tools
There is no way to run them now since we are in a cross build
configuration
2022-02-28 13:45:00 +01:00
Pierre Labastie
e3f41e33d5 Remove legacy: remove CLFS books from Config.in
There are still some occurrence of CLFS (and HLFS), that will go away
at next commit, when removing temporary tools tests.
2022-02-28 13:41:56 +01:00
Pierre Labastie
16cef03acf Remove legacy: First run of CLFS removal 2022-02-28 13:38:06 +01:00
Pierre Labastie
978286a4b9 Remove legacy: remove everything about HLFS 2022-02-28 13:30:53 +01:00
Pierre Labastie
3faf067c44 Fix packInstall.sh.porg for non versioned x26[45] 2022-02-21 12:24:36 +01:00
Pierre Labastie
03b24b2a45 Various fixes for create-sbu_du-report.sh
- Check that there is enough material to calculate a SBU (!)
- Prevent an error if REALSBU does not occur in jhalfs.config
- Remove double square bracket: they change semantics and
  I cannot memorize what the change is (but e.g. file* is not
  expanded even if there is some filexxx in the dir).
2022-02-19 15:08:37 +01:00
Pierre Labastie
0f3b1c317c create-sbu_du-report.sh: check that J_VALUE is never empty 2022-02-17 23:53:51 +01:00
Pierre Labastie
2e35653630 makefile-functions: make sudo/chroot messages less confusing 2022-02-05 20:08:56 +01:00
Pierre Labastie
20051e00f7 Use only CHROOT1 in LFS/master.sh
There is only one chroot command in newer LFS, and using the first one
with previous versions does not hurt.
2022-02-05 18:48:32 +01:00
Pierre Labastie
abadee36de Improve and augment the "func_dependency" doc 2021-12-30 14:20:43 +01:00
Pierre Labastie
f81d8bdb6f func_install_blfs: gen_pkg_book needs the tracking file
The tracking file is needed for gen_pkg_book.sh as a first argument.
Since it is called to generate the initial scriptlets, it needs
to be passed the full path of the tracking file, including
$BUILD_DIR. The $TOPDIR is now the second argument (and still
needs to be passed too).
2021-12-20 10:30:18 +01:00
Pierre Labastie
141d072bf6 BLFS Dependencies: Fix pass2 not run
With the way we manage "first" deps, it may happen that no node
unreference the pass2 node. In that case, we add it to root.
Add some documentation for what we do for those deps, too.
2021-12-19 17:30:10 +01:00
Pierre Labastie
a78cfc961e Better document the loop on "after" deps
Add also a description of that loop in the general header
2021-12-19 17:30:10 +01:00
Pierre Labastie
e0bbc6e6ac Document some variables in func_dependencies
Better document the $seen global variable used in path_to,
also at places where "path_to" is called.
Document p and b flags in the loop over "after" deps.
Document lr variable in the loop over "first" deps.
2021-12-19 17:30:10 +01:00
Pierre Labastie
bbabe74e15 install_blfs_tools: do not call check_blfs_tools
It does not exist anymore, and it has been integrated in
check_alfs_tools.
2021-12-19 17:30:10 +01:00
Pierre Labastie
b734bfb4c6 install_blfs: update trackdir also in gen_pkg_book.sh
Now gen_pkf_book.sh depends on trackfile. This can be passed
as an argument, but to ease calling it standalone, we need to
set the default to the actual file used.
2021-12-19 17:30:10 +01:00
Pierre Labastie
ff5c301860 Treat the case of boost in packInstall.sh.porg
The default VERSION returned is always "0". Create
a special case to prevent that.
2021-12-19 17:30:10 +01:00
Pierre Labastie
dd9ca56bd2 BLFS dependencies: better document the functions
First the function used in pass1. Also some nit in the function itself
2021-12-18 15:28:47 +01:00
Pierre Labastie
7ae97740a8 Fix the logic for -pass1 packages in gen_pkg_book 2021-12-16 13:57:01 +01:00
Pierre Labastie
b8e5cad4c0 Pass tracking file to gen_pkg_book
This is needed for managing -pass1 packages, since their version
can only be found in the tracking file (thanks to previous commit).
2021-12-16 13:50:33 +01:00
Pierre Labastie
a6fbc65357 Allow to store version of -pass1 packages
With the new way of treating dependencies, we need to properly
manage -pass1 packages: For that we need the installed version of
-pass1 packages. But it is recorded nowhere. packages.xml shouldn't
be used for that, because it is directly built from the book
dependencies: adding -pass1 packages would just duplicate the
dependency information. So the version has to be recorded in
the tracking file. This involves changing bump.xsl (this commit),
and passing the tracking file to gen_pkg_book (next commit).
2021-12-16 10:26:43 +01:00
Pierre Labastie
f9a7f8ec34 Update README
Change http to https for the new linuxfromscratch site.
Explicitly cite dependencies for the tools.
Cosmetic change to the kernel config instructions.
2021-12-13 17:23:08 +01:00
Pierre Labastie
0870a7cfdb Do not call check_blfs_tools that doesn't exist anymore 2021-12-13 16:10:37 +01:00
Pierre Labastie
837362b50f Ticket #1732: add Docbook XSL and XML to check_alfs_tools
This is an oversight of when we moved to profiling and when we
removed the docbook xsl stylesheets from the LFS directory.
Docbook XML DTD and XSL stylesheets are needed, so test them
at start. This has the effect of removing the need for check_blfs_tools.
2021-12-13 16:05:39 +01:00
Pierre Labastie
e57e0291c3 Change spacing in func_check_version output
This is needed to be able to fit "Docbook XSL stylesheets" in.
2021-12-13 16:03:46 +01:00
Pierre Labastie
5e1d9dd5d4 [BLFS] Ticket #1730: Do not forget "-pass1" packages 2021-12-12 18:49:58 +01:00
Pierre Labastie
a690d42f88 [BLFS] Ticket #1730: clean the dependency list
With the new xsl/dependencies.xsl, the full dependency list is generated.
We compare the version and installed version gotten from packages.xml
using xsl/get_version.xsl and only install if the installed version is
lower than the available version. Since the installed version returned
by get_version.xsl for a non installed package is 0, that version is
always lower than the available version and the package is installed.
Note that if a package does not exist, both versions are empty, and
they compare as equal with our method. So they are never installed...
2021-12-12 18:39:03 +01:00
Pierre Labastie
1fc36f5654 [BLFS] Ticket #1730: add a .xsl for returning versions
This .xsl, applied to packages.ent, takes the package name as
a string param, then returns:
"version"<nl>"installed version" if both versions are known
"version"<nl>0 if the package is known but not installed
nothing if the package does not exist (case of the groupxx ones)
2021-12-12 18:33:20 +01:00
Pierre Labastie
5132b9373d [BLFS] Ticket #1730: compute the full dependency chain
Comment out the version comparison in BLFS/xsl/dependencies.xsl. It is
a mess in xslt anyway...
2021-12-12 18:29:19 +01:00
Pierre Labastie
794f94f85e BLFS ordered book gen: fix for .xz Xorg packages
In Xorg pages where there are several packages, the .xsl for
separating packages assumed that the package names ended in
tar.bz2 and selected the substring before ".tar.bz2" to extract
the packagedir. This has changed recently for libX11, which is a
.tar.xz package: the fix is to just select the substring before
".tar." for the packagedir.
2021-12-11 07:50:56 +01:00
Pierre Labastie
eec87dbd1f Add dependency thoughts to BLFS/TODO 2021-12-10 18:19:06 +01:00
Pierre Labastie
1870b56894 Ensure that MAKE_TERM(OUT|ERR) are unset
Some packages use those variables to determine whether they are
talking to a terminal, and issue color codes that mess our
logs if the top level make has been launched from a terminal.
2021-11-21 19:23:11 +01:00
Pierre Labastie
0495e57e0a Update README.BLFS for envars.conf removal
And try to clarify... Also remove references to books other than
LFS.
2021-11-21 19:23:11 +01:00
Pierre Labastie
267b19da59 Adapt func_install_blfs.sh to the removal of envars
Add to the configuration file in $BUILD_DIR/blfs_root
2021-11-21 19:23:11 +01:00
Pierre Labastie
b0965faf0d BLFS tools: Source /etc/profile in scripts
Since this is not done anymore in envars.conf...
2021-11-21 19:21:45 +01:00
Pierre Labastie
5fd1a98625 Remove BLFS/envars.conf
Not needed anymore since envars are taken from configuration
2021-11-21 19:21:45 +01:00
Pierre Labastie
0a93085f84 BLFS tools: Do not source envars.conf
Now the environment variables are taken from configuration.
2021-11-21 19:21:45 +01:00
Pierre Labastie
9daa202654 BLFS tools: Take variables from config instead of envars.conf
Get them in gen_pkg_book, and pass them to sripts.xsl
use them in scripts.xsl. We set them at the beginning of
of the scriptlet, so that it is easy to modify them.
2021-11-21 19:19:16 +01:00
Pierre Labastie
60e539b9fc Remove KBLAYOUT setting
it is not needed anymore by any book.
2021-11-09 21:17:05 +01:00
Pierre Labastie
2b3edd2e77 [Remove BLFS envars.conf]: new gen_config.xsl
Now the variables previously defined into envars.conf are in Config.in
2021-11-09 21:17:04 +01:00
Pierre Labastie
f756851d45 BLFS tools: do not needlessly validate book
With the current Makefile, git-version.sh is run unconditionally,
so that the bok is validated each time, even if there is no
text change. Change this to only validate if there is a text change
(the previous behavior), and run git-version.sh just before validation.
2021-11-09 21:11:58 +01:00
Pierre Labastie
e25788e846 install-blfs-tools.sh: Minor tidy up 2021-11-09 13:33:49 +01:00
Pierre Labastie
610a5c4a0e Have install commands use the right PATH and exit if error
Hopefully the present commit fixes those problems:
- use sh -e instead of sh
- set PATH to $PATH (which will expand to the PATH before entering
  sudo) before the install commands.
2021-11-06 15:55:03 +01:00
Pierre Labastie
59c4761950 Display the size of $BUILD_DIR for stats
Displaying the size of /, but excluding other filesystems is not
good if BUILD_DIR is on another filesystem. Furthermore, when
doing stats, the DESTDIR is inside $BUILD_DIR, so the full size is
recorded. The only thing that is not recorded is if the
build system downloads files to the user's home (cargo, maven, ...).
2021-11-01 13:18:09 +01:00
Pierre Labastie
fd4a7982f2 Remove $Id$ comments, they are useless with git 2021-10-31 10:22:30 +01:00
Pierre Labastie
240d928d23 Fix packInstall.sh.porg for docbook-5.1 2021-10-21 21:24:47 +02:00
Pierre Labastie
59a1e1add9 Add gtweak to non-install commands 2021-10-21 08:42:34 +02:00
Pierre Labastie
d5413a91a1 Add tracker-miner to the list of non-install commands 2021-10-21 08:32:56 +02:00
Pierre Labastie
50cf934f51 Fix blfs tools for condxml 2021-10-17 18:50:24 +02:00
Pierre Labastie
ee96ad26f9 jhalfs: rebuild-makefile. take VERSION from prbook
When rebuilding the Makefile, we should have prbook.xml in
ĴHALFSDIR. Use it to get VERSION (from lfs-release).
2021-10-14 10:25:48 +02:00
Pierre Labastie
4c32ca80bd Adapt to condxml branch: func_book_parser
When running git-version.sh, unconditionally add a $INITSYS
argument, which is needed for the new condxml, and
is harmless if this argument is not needed.
2021-10-14 10:23:24 +02:00
Pierre Labastie
2718053f55 Custom tools: prevent a warning if no md5sum for patches 2021-10-14 08:53:29 +02:00
Pierre Labastie
2257bd71b7 Update and fix documentation of custom tools 2021-10-14 08:51:49 +02:00
Pierre Labastie
e22aa9615e Blfs tools: Fix Makefile for new git-version.sh
With the condxml change, git-version.sh needs an argument. Pass
it unconditionally, since passing an unused arg to older
versions is harmless.
2021-10-14 08:13:10 +02:00
Pierre Labastie
840b9ba06e Fix wrong VERSION variable for dev book
Using version from the ENTITY version line in gneral.ent is not
good anymore, since version is in version.ent for the dev book.
But it _is_ in general.ent for releases...
Use a different approach: take the profiled .xml, and use the
version in lsb-release.
2021-09-16 06:30:58 +02:00
DJ Lucas
b5d1c50492 Fix iproute2 install with package management. 2021-09-06 17:04:11 -05:00
Pierre Labastie
e68c306380 Add the -j value to the sbu report 2021-08-28 22:50:40 +02:00
Pierre Labastie
52cced4e53 Add the number of parallel jobs to var validation
This allows to have it also in the SBU report
2021-08-28 19:53:16 +02:00
Pierre Labastie
22abf3706e Add .old to signatures of no install root commands
This is used when removing some file that may interfere with coming
instructions, specially in glib2...
2021-08-27 09:16:01 +02:00
DJ Lucas
33a4e41462 Fix package management and put back optional stripping again for backwards compatibility. 2021-08-17 18:23:24 -05:00
Thomas Trepl (Moody)
756863be9b strippingagain.xml has been renamed 2021-08-13 08:18:05 +02:00
Thomas Trepl (Moody)
c1060c9add strippingagain.xml has been renamed 2021-08-13 07:51:13 +02:00
Thomas Trepl (Moody)
df5553b1f3 Rename ch-system-strippingagain to ch-system-stripping 2021-08-13 07:47:07 +02:00
Thomas Trepl (Moody)
bcae37dc8b Rename ch-system-strippingagain to ch-system-stripping 2021-08-13 07:46:58 +02:00
Pierre Labastie
97b270f9bd LFS: Generate version.ent before profiling the book 2021-08-03 14:33:11 +02:00
Pierre Labastie
106157fdae Do not assume there is a group named as $USER
Remove any use of chown $USER:$USER
2021-06-30 16:03:51 +02:00
Pierre Labastie
0722dde31d Do not use global $version when writing Makefile
In func_wrt_makefile, the two functions LUSER_wrt_unpack and
CHROOT_Unpack use the version variable without setting it.
This leads to the global version variable being used, which
writes garbage into the Makefile. Fix: just define version locally.

This bug does not occur often because those functions are only
used when using custom scripts for versioned packages (if building LFS).
It has been found by William Harrington.
2021-06-04 21:13:04 +02:00
Pierre Labastie
cfdb089dcf Fix generation of full locales
The recent addition of instructions for adding locales not
installed by make install-localedata has broken the generation
of the scriptlet, because there is a missing linefeed.
Use xsl:for-each to add a linefeed after each <userinput>
text.
2021-05-11 09:59:19 +02:00
Pierre Labastie
894eec328d Add a forgotten $(Q) in BLFS/Makefile 2021-05-01 17:29:31 +02:00
Pierre Labastie
203e4c2697 BLFS: do not run git-version.sh if it does not exist 2021-05-01 17:28:28 +02:00
Pierre Labastie
380c2c619a jhalfs: manage version.ent vs general.ent
Old commits do not have git-version.sh, so version.ent cannot be generated
and general.ent has to be used
2021-05-01 17:26:37 +02:00
Pierre Labastie
34c47bef04 BLFS: Fix Makefile so that it builds version.ent 2021-05-01 13:51:19 +02:00
Pierre Labastie
605ea3628b Fix forgotten "git_root" in func_book_parser 2021-05-01 13:50:43 +02:00
Pierre Labastie
1318902ce8 Add a .gitignore file 2021-05-01 13:46:59 +02:00
Pierre Labastie
7a10c525bc Adapt "install_blfs_tools" to git
Also use the *-BRANCH variables for Makefile
2021-05-01 09:24:56 +02:00
Pierre Labastie
2ac2fc50b9 BLFS: call make with proper arguments
Uses *-BRANCH variables when running make
2021-05-01 09:23:14 +02:00
Pierre Labastie
4ed4a3244d Allow using any branch/tag in BLFS Makefile
Still WIP because of the *_TREE names
2021-05-01 09:22:06 +02:00
Pierre Labastie
b3825c3eb8 Adapt jhalfs to git
Note that the *_TREE var names should be changed to something related to
branch
2021-05-01 09:21:06 +02:00
Pierre Labastie
dfab075401 Change variable name to DEP_GIT in validate_configs 2021-04-30 21:39:34 +02:00
Pierre Labastie
de67016950 Adapt func_book_parser to git
The variable name "TREE" makes no sense now. It is rather a branch or a tag.
So more work is needed here.
2021-04-30 14:21:44 +02:00
Pierre Labastie
dd5d63d102 Adapt to git in func_install_blfs 2021-04-29 11:40:46 +02:00
Pierre Labastie
f538085157 Update instructions in README.BLFS 2021-04-29 11:17:57 +02:00
Pierre Labastie
fbbe081243 Move to git: Change url and var names in BLFS/Makefile
Note that only trunk is accessible in the Makefile. Other branches
wil be made accessible later.
2021-04-28 17:08:30 +02:00
Pierre Labastie
1e686d17a4 Moving to git:
Change names and help in Config.in
2021-04-27 22:45:19 +02:00
Pierre Labastie
38dd3c3d74 BLFS: have "process-replaceable" process gtk4
Do the same as for gtk3
2021-04-27 21:40:38 +02:00
Pierre Labastie
82eacf52a5 Fix packInstall.sh for recent packages 2021-03-09 22:02:19 +01:00
Pierre Labastie
47dfc81bdc Account for the change in umount command in LFS
The command for unmounting the kernel vfs is now
  umount -Rv $LFS
So we have first to use that command in teardown (change in
kernfs.xsl). Second, since the command tries to umount
$LFS, but the Makefile is on $LFS, it fails. Ignore the
error in the Makefile (change in master.sh)
2021-03-09 21:58:44 +01:00
Pierre Labastie
c2af9cd73f Fix gen-special when an entity is commented out:
In the xorg application, mkfontdir is commented out, but we did not
check that because it was complicated with the shell. This was
leading to mkfontfir appearing in the packages to install, which
is not wanted. We use the information in the "cat" command to
eliminate the commented out package.
2021-03-09 21:53:29 +01:00
Pierre Labastie
e5518fd03e jhalfs: update copyright years and adapt to git
- use git log to retrieve the most recent version to display with
  -v
2021-01-17 11:13:43 +01:00
Pierre Labastie
f9babd04b5 packInstall.sh.porg: fixes for inih and libhandy 2021-01-15 11:00:05 +01:00
Pierre Labastie
782a77b2c4 Fix an inaccurate comment in packInstall.sh.porg 2020-12-04 09:30:37 +00:00
Pierre Labastie
ea0be93e9e Now that tcl, expect, and dejagnu are only in lfs, update instpkg.xml
with those packages after installing lfs, or when updating lfs
2020-10-15 13:15:33 +00:00
Pierre Labastie
018ab000f3 Fix downloading blfs books tag versions greater than 9 2020-10-15 12:39:52 +00:00
Pierre Labastie
5562bf14e0 Fix make exiting with an error if $(MOUNT_PT)/var/lib does not exist 2020-09-30 05:43:59 +00:00
Pierre Labastie
088130f04a Fix changing the ownership of $BUILDDIR/var/lib to LUSER when it has been
created by func_install_blfs. Fixes ticket #1729
2020-09-17 15:30:29 +00:00
Pierre Labastie
426e40be67 add the desktop-file-utils case for non install instructions in blfs tools 2020-09-15 12:39:59 +00:00
Pierre Labastie
7ce5a6195f packInstall.sh.porg: remove special case for x264: it is now packaged
"normally"...
2020-09-15 12:14:50 +00:00
Pierre Labastie
bfc99d1f9f Typo 2020-09-15 09:09:18 +00:00
Pierre Labastie
2873df61d7 New bridgehead layout for llvm 2020-09-15 07:36:23 +00:00
Pierre Labastie
56c1fff69a Create os-release also for SysV
This has been in the book for a few months, but jhalfs was not updated.
It is now...
2020-08-22 11:49:09 +00:00
Pierre Labastie
a8b8d192eb Use a custom date format in the filename of the chapter 5 tarball
The format of "date -Iseconds" generates character that are not accepted by
"cp". Use only letters, digits, and dash "-".
2020-08-22 11:47:10 +00:00
Pierre Labastie
f7c6c3c108 Allow versions up to 19 for lfs 2020-08-22 11:44:07 +00:00
Pierre Labastie
7e9e66faa4 Fix name of book repo for tag version greater than 9 2020-08-16 08:05:57 +00:00
Pierre Labastie
6f74ca146f LFS/master.sh: only count chapter* dirs in lfs-commands
We count the number of files in lfs-commands to know whether
we have an old or a new book. But this shouldn't include the
custom-tools dir, so only count chapter*.
2020-07-10 13:29:15 +00:00
Pierre Labastie
8b85dae454 Prevent users to tick "Rebuild Makefile" if Makefile does not exist
For some reason, beginners tend to tick this at the first pass. Since
it is hard to prevent that in Config.in, use a sanity check in jhalfs.
2020-07-10 13:26:23 +00:00
Pierre Labastie
e3ccc2786a Config.in: Reinstate the whole menus if "Rebuild Makefile" is ticked
Building the Makefile needs quite a few variables set, which
are scattered in all the menus of Config.in. So all the menus
are needed.
2020-07-10 13:24:00 +00:00
Pierre Labastie
88a8275eb8 lfs.xsl: mode=pkgmngt: use $pos and not position() when calling
start-script
2020-07-09 17:04:30 +00:00
Pierre Labastie
46c6113b28 Prevent overwriting /var/run and lock symlinks with PM
/var/run and /var/lock are created as symlinks in creatingdirs. But
if a package install something into those dirs (with DESTDIR install),
they get overwritten with true directories if using a package
manager. Note that without PM, anything installed into those dirs
is lost at next reboot. So remove those dirs before packaging.
2020-07-09 17:02:10 +00:00
Pierre Labastie
ee842e234b Now that packageManager.xml createfiles is also included
for new book, test that /tools/etc/porgrc exists before moving it
2020-07-09 16:59:36 +00:00
Pierre Labastie
3484658167 Various fixes for recent pacman with new book
- add createfiles instructions of packageManager.xml for new book too
- remove unneeded chown when installing pacman (not needed thanks to
  the above)
- Use a dedicated user "builder" for running makepkg: user "tester" is 
  removed at the end of chapter 8, but is needed in following chapters.
2020-07-07 15:27:54 +00:00
Pierre Labastie
b6e981a9a3 Typo in Config.in 2020-07-06 09:38:47 +00:00
Pierre Labastie
f017b22731 LFS/lfs.xsl: fix cases when using DESTDIR
We cannot use only the fact that it is not in chapter-temporary-tools
since now we have several chapter for the temporary system.
so use a list of chapters (non negated).
2020-07-06 05:51:22 +00:00
Pierre Labastie
2f8d952deb Forgot one instance of minor scriptlet number removal 2020-07-06 05:46:07 +00:00
Pierre Labastie
89bcb1be0e Allow scriptlet numbering to be on 4 digits in packInstall.sh* 2020-07-06 05:44:22 +00:00
Pierre Labastie
3ac3ae199f Change numberings of scriptlets:
- major number can be on 4 digits, so use it in packInstall
- minor number (for package manager) can be greater than 10
  - code on 2 digits
  - change various files accordingly
2020-07-06 05:38:54 +00:00
Pierre Labastie
5dd7bff0ee Use latest version of pacman
Changes to packageManager.xml.pacman:
- Add needed deps in chapter 5/7 and 6/8
- Add user tester if it does not exist
- Change permissions for some dirs so that user tester can write to them
2020-07-06 05:31:55 +00:00
Pierre Labastie
5a965adf4f When copying packageManager.xml, use a sed to replace BOOK with $BOOK
This allows loading entities from the lfs book
2020-07-06 05:23:47 +00:00
Pierre Labastie
959319749e Remove special cases for vim and tidy in packInstall.sh.pacman 2020-07-06 05:20:06 +00:00
Pierre Labastie
d5a739aebd When cleaning BUILD_DIR, clean also 32 bit library dirs in case multilib
has been used
2020-07-06 05:17:16 +00:00
Pierre Labastie
49f8b03399 Fix package management for new book, and add a patch for porg 2020-06-24 06:26:05 +00:00
Pierre Labastie
13e52a5572 Add the multilib book: fixes ticket #1722 2020-06-20 17:16:22 +00:00
Pierre Labastie
706e5bf46a Various small fixes/improvements:
- Prefer SysV over Sys V in Config.in
- do not generate the package list for lfs, it is not needed anymore
- prevent an (ignored) error in LFS/master.sh
- log new files under the scriptlet name (allows to log files for the same
  package from different builds)
- keep the full name in log_new_file functions (fix a undetected bug in
  CLFS/HLFS)
2020-06-20 17:01:23 +00:00
Pierre Labastie
7b33f40896 Use an XPath expression to select <para> that contains packages with right
attributes in packages.xsl, rather than an <xsl:if>.
2020-06-20 16:53:31 +00:00
Pierre Labastie
9a4c530f55 Clean LFS/master.sh from unused
functions
2020-06-20 16:45:26 +00:00
Pierre Labastie
0a0753d579 Remove spaces at the end of lines 2020-06-19 14:25:52 +00:00
Pierre Labastie
e4b7aa8206 Replace "cat /proc/cpuinfo" with "lscpu" in the sub-du report: cpuinfo gets
too big with several cores
2020-06-19 06:51:10 +00:00
Pierre Labastie
cce9c165cd Change names for lfs chapters in blfs tools:
- change "6" to "final system"
- change "7" to "configuration"
- change "8" to "Bootable"
- change "9" to "The End"
- also fix a id that has changed in January in the lfs book
2020-06-14 15:54:44 +00:00
Pierre Labastie
3da8c49659 Update ICA for new LFS/master.sh 2020-06-14 07:08:19 +00:00
Pierre Labastie
b33c6ee52d Fix the case of the kernel for otimization 2020-06-11 20:43:33 +00:00
Pierre Labastie
b217a303e4 Fix sbu-du calculations for the new numbering 2020-06-11 13:59:59 +00:00
Pierre Labastie
22bb166d9d Fix the save-ch5 target 2020-06-11 08:22:20 +00:00
Pierre Labastie
6447575192 Fix detection of the cross2 branch 2020-06-10 20:58:33 +00:00
Pierre Labastie
ebe1ba613c Adapt for the cross 2 branch. Note that ICA is broken now. Keeping some old
code to use for fixing ICA, but committing now so that testing can begin!
2020-06-10 20:01:17 +00:00
Pierre Labastie
36f5dce727 Fix lfs.xsl for cross2, and change scriptlet numbering for trunk and cross2 2020-06-09 07:28:05 +00:00
Pierre Labastie
9ef12f76bb Use a private name for MAKEFLAGS in jhalfs, so that it does not propagate
to top make, when ticking "Run the makefile"
2020-06-05 10:18:27 +00:00
Pierre Labastie
7e0a1b8018 Fix an issue in ck_terminal, which was working only by chance (compensating
bugs) on some setup (but not all)
2020-05-31 08:58:41 +00:00
Pierre Labastie
6caa5b8816 Allows having << EOF in tests, and not generating >> $TEST_LOG... until the
matching EOF is found.
2020-05-31 07:31:32 +00:00
Pierre Labastie
9728b235e6 Check terminal size before starting build 2020-05-25 06:47:48 +00:00
Pierre Labastie
a26389abd0 Fix update-lfs.sh (missing continuation character in a case statement 2020-05-22 05:03:40 +00:00
Pierre Labastie
323ae3e633 Add -j1 to "make install" in the
lfs book (done long ago in blfs)
2020-05-18 08:31:43 +00:00
Pierre Labastie
ae1d8a5b59 Prevent a permission problem when using blfs tools with the cros-chap5 branch:
/var/lib needs to be owned by LUSER during chap 5, but it is owned
by root after installing the blfs tools. SO chown it.
2020-05-08 08:22:55 +00:00
Pierre Labastie
38016d5ca7 Add a missing file for saving chapter 5 work 2020-05-01 19:36:10 +00:00
Pierre Labastie
f5ecc2838a Add code to save work at the end of chapter 5
(and finish the rebuild-makefile change)
2020-05-01 14:24:32 +00:00
Pierre Labastie
06eddf40f2 Make "Rebuild Makefile" disable all the other options:
This prevents users from using it without setting a build first
2020-05-01 14:20:45 +00:00
Pierre Labastie
31a9b1440c remove the __pycache__ dirs from comparison analysis 2020-04-10 10:16:41 +00:00
Pierre Labastie
bdb0761120 Run "Cleaning up" page in ICA iterations too: it allows to remove .la and some .a
files
2020-04-08 08:37:54 +00:00
Pierre Labastie
709eb7470d Remove the /usr/share/doc/openssl-<version> dir before renaming
/usr/share/doc/openssl, otherwise it moves it as a subdirectory
2020-04-07 17:08:30 +00:00
Pierre Labastie
49e2745200 Further fix user creation (or no) 2020-04-02 11:54:50 +00:00
Pierre Labastie
dd7e0f6793 Fix LUSER creation (or no creation). 2020-04-02 11:46:36 +00:00
Pierre Labastie
7b7b5e9624 Various fixes for ICA 2020-04-02 09:56:51 +00:00
Pierre Labastie
0a577f5575 typo forgotten \ 2020-04-01 09:14:14 +00:00
Pierre Labastie
0835a1065f Two fixes:"
- use /etc/passwd to check whether LUSER exists
- use sudo -H -u $(LUSER) to be sure that HOME is set (depends on distro)
2020-04-01 09:11:32 +00:00
Pierre Labastie
a73ed74337 Fix the SHELL for CHROOT target for LFS
We use the filter builtin function of make to retrieve the right
shell to use during the CHROOT phase, which is the same as the
one in CHROOT1.
Also do not assume envars exist when removing it at the beginning
of the SUDO phase.
2020-03-31 08:47:52 +00:00
Pierre Labastie
a2b56892e4 Fix a forgotten new IDREF 2020-03-29 20:35:52 +00:00
Pierre Labastie
04de9bc4db Allow to find kernfs and chroot in any chapter
We use those files to generate code snippets to use in Makefile.
They used to be in chapter 6, but the new book will have some
of them in chapter 5.
2020-03-29 17:19:25 +00:00
Pierre Labastie
3261fe76c8 Adapt master.sh to new book, staying compatible
This involves changing the way make targets are built. Specially
the make target is changed when encountering a specific file
(for example the make target becomes sudo when rencountering kernfs)
This allows more flexibility.
2020-03-29 17:16:09 +00:00
Pierre Labastie
4762fb9900 Set the correct #! executable in creat* scriptlets
Those scriptlets need to use a temporary bash, which is in /tools/bin
for current LFS. But if we use a new method (cross-compiling + sysroot)
it ends into /bin. So we have to set the correct `#!' header
in both cases.
We rely on the pesence of a "creatingtoolsdir" sect1 to know that
bash is in /tools
2020-03-29 15:13:15 +00:00
Pierre Labastie
903eefd093 Adapt LFS/master.sh to use chap4 scriptlets
- take targets from scriptlet names
    - neutralize some commands or bash builtins so that they are not
      used even if they are in the scriptlets, if not needed
    - do not set PREV in chapter 5 anymore
    - Improve save and restore user, so that if the LUSER exists,
      its home is saved while building temporary tools, and restored
      afterwards
2020-03-29 14:06:41 +00:00
Pierre Labastie
939731aa52 No need to prin DU from Makefile in LFS
We now print the disk usage from the scriptlet, so printing
again from the Makefile results in a duplicated line. Remove
the printing if book=lfs
2020-03-29 13:46:19 +00:00
Pierre Labastie
123105f683 Do not rely on /tools for setting ROOT (again)
Using the chapter ancestor is not enough. It's better to use the sect1 id
and test that it starts with ch-tools: package-manager does not have this
ancestor. Also the virtual kernel filesystems are done before chroot,
so directly test this one.

This works for the current lfs book. We'll need something new if we
change the order of pages.
2020-03-29 13:42:43 +00:00
Pierre Labastie
1dce18968f Don't use /tools for setting the ROOT variable
In the generated scriptlets, we need to know if we are on host
or chrooted. Presently, we
rely on /tools being a symlink or not. But we may want to remove this
ugly symlink in future versions of LFS, so anticipate and use the
chapter ancestor.
2020-03-29 13:24:48 +00:00
Pierre Labastie
a131250b6f Generate chapter 4 scriptlets
This is a major change for LFS. We won't be using the makefile for
the final preparations, but we'll extract the book instructions and
use them (the "use part not in this commit).
Since getting figures for those scriptlets is not important, and we
cannot use start and end scripts, which need already set up user and
dirs, do not use them
2020-03-29 13:17:38 +00:00
Pierre Labastie
5e4a124e3d Remove /tools and /cross-tools when cleaning
If we stop a build before the "do-housekeeping" target is executed, there
may be symlinks of the type /tools->/mnt/lfs/tools. If we want to restart,
for example after fixing something else, and we run the "creatingtoolsdir"
target (or similar one in CLFS) again, it will fail. It's better to clean
those symlinks when cleaning the build directory.
2020-03-29 13:05:48 +00:00
Pierre Labastie
20e3fcdec2 Do not use a login shell for LUSER
Most books have something like "exec /bin/bash" in .bash_profile for the
building user. This results in stopping and waiting for commands when
running a a login shell. The current jhalfs way of removing .bash_profile is
suboptimal, since a user may want to login as $(LUSER) and expect that the
environment is set (without having to source .bashrc). So remove the
"-i" flag in "sudo -u $(LUSER) ..."
2020-03-29 12:58:06 +00:00
Pierre Labastie
2a9b0c3181 Remove envars before the SUDO phase
This is to allow root to execute ": > envars". On a non empty envars
owned by lfs, in a directory world writable with sticky bit and not owned
by lfs, this may be forbiden by the fs/protected_regular sysctl.
See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
2020-03-15 17:15:28 +00:00
Pierre Labastie
94fc75e616 Remain compatible with older versions of lfs 2020-02-11 13:55:28 +00:00
Pierre Labastie
c035132e2a Fix jhalfs for new idrefs in lfs svn 2020-02-11 13:25:03 +00:00
Pierre Labastie
9a61eadbbf attr does not install man pages in man2 and man5 anymore, so no need
for removing them. This fixes a stupid bug, that removed all man-pages
    man2 pages when porg was used!
2019-12-22 09:53:30 +00:00
Pierre Labastie
fcb78f4822 Unset the BLACKLIST variable in opt_config: all packages seem to be
able to cope with parallelization now
2019-12-21 22:10:04 +00:00
Pierre Labastie
2d99aa4bb3 Fix libhandy VERSION computation in packInstall.sh.porg 2019-12-06 21:46:21 +00:00
Pierre Labastie
a30c80e273 Remove the lfs- prefix when writing to the instpkg file, for lfs bootscripts 2019-09-27 09:59:32 +00:00
Pierre Labastie
4ad6e44878 Put {DISTRIB,VERSION}_CODENAME="jhalfs" in /etc/*-release, and fix a typo 2019-09-25 15:36:20 +00:00
Pierre Labastie
654f592149 Add the possibility to update lfs bootscripts with blfs tools.
Ticket #1724
2019-09-25 15:29:17 +00:00
Pierre Labastie
a1795f0351 TRACKFILE should not contain LFS packages that are also in BLFS, ticket #1723 2019-09-25 07:50:45 +00:00
Pierre Labastie
0974c32271 BLFS/xsl/Process-install: detect config instruction in QtWebEngine page 2019-09-16 03:50:29 +00:00
Pierre Labastie
39304601fe BLFS/xsl/process-install: make an entity for config instruction conditions
and add a condition for /opt/rustc creation
2019-09-14 19:30:15 +00:00
Pierre Labastie
0336215926 BLFS/xsl/gen_pkg_list.xsl: allow listing the After LFS config chapter.
Normally only chapters containing versioned pacakges are in the package list.
But with the removal of lsb-release there are no versioned package anymore
in the "After LFS config..." chapter. But we need this chapter. So add
a test explicitly for it.
2019-09-06 21:20:03 +00:00
Pierre Labastie
085435e66f Remove the obsolete vim-lang instructions and variable, and add non-wide-
charater ncurses library
2019-09-05 17:22:04 +00:00
Pierre Labastie
91b5249f05 Fix retrieval of BLFS 9.0 tag. Note that older tags cannot be processed by
present jhalfs, and the case statement should be simplified...
2019-09-01 21:00:48 +00:00
Pierre Labastie
974fe35ae0 The new vim tarball has a standard directory name, not need for a tweak in
packInstall
2019-08-31 12:52:05 +00:00
Pierre Labastie
30732c6a16 Process layout replaceable 2019-08-31 12:47:22 +00:00
Pierre Labastie
0a0b60984c Several things:
- refactor again process-install. Allows for better generation of test
  instructions
- only output the instructions of the first sect2 with role="installation".
  this will miss the vaapi intel driver, the installation of help files in
  GIMP, and the second method for which
- always run porg logging in "append" mode
- allows pass1 in sect2 (libva again)
2019-08-17 08:30:36 +00:00
Pierre Labastie
96d7e44922 BLFS/xsl: move the template for replaceable tags out of the main stylesheet,
and allow replacing some hostname/domainname replaceable tags
2019-08-14 10:32:59 +00:00
Pierre Labastie
c9928765ae add property svn:keywords to process-install.xsl 2019-08-13 15:30:00 +00:00
Pierre Labastie
8fc6a47249 BLFS/xsl: refactor the generation of installation instructions, owing to
the new remap="test/doc" attributes
2019-08-13 15:28:49 +00:00
Pierre Labastie
7933ed76c6 Refactoring the output of installation instructions:
Create a template which processes the instruction tree fragment (only header
for now, the content is bogus), and call it from main sheet.
2019-08-13 15:03:39 +00:00
Pierre Labastie
5451eaeb9e Fix generation of the SBU-DU stats:
The "create-sbu_du.sh" script expects all the logs containing
"Totalseconds" also contains two lines starting with "KB:" with disk usage
stats. Generates those lines for all the logs. Hopefully, the stats are
fairly accurate now...
2019-07-15 20:06:35 +00:00
Pierre Labastie
3b14992061 Fix "installed files size" for the last package:
In create-sbu_du.sh, we use "du -s" for getting the size of the installed
files at the end of the build, and we compare to the "KB" from the previous
package to get the Installed size of the last package. But the du command
excludes an absolute dir, while it should be relative. This lead to bogus
stats.
2019-07-15 20:00:32 +00:00
Pierre Labastie
30a89617c4 Fix the TEST variable when CONFIG_TESTS is not set:
This is another bug exposed by the new menu system. The TEST variable was set
inside the menu "test settings". But this menu depends on CONFIG_TESTS, and
is not executed if CONFIG_TESTS is not set. So that, the TEST variable was
not set if CONFIG_TESTS was not set (while with the former menu suystem,
it was set to 0). Due to the logic in lfs.xsl, this resulted in all the
tests being run, instead of none...
Move the setting of the TEST variable outside the "test settings" menu.
2019-07-15 14:13:48 +00:00
Pierre Labastie
6622409404 Don't output role="nodump" in "not-pack" mode 2019-06-19 07:56:39 +00:00
Pierre Labastie
a4af6811bd Various fixes for Kconfiglib:
- remove the old setting of LANG in BLFS/Makefile
- explicitly use python3, because now menuconfig.py has #!/usr/bin/python,
  we may have only python3 available
- add quotes in Config.in for BLFS
2019-06-15 20:16:35 +00:00
Pierre Labastie
cf2f109b89 Update to Kconfiglib version 12.4.0. This removes the need to use
".configuration.old"
2019-06-15 17:25:10 +00:00
Pierre Labastie
619b313adb Various fixes and improvements coming from github:
- the case for "pax" in packInstall.sh.prog
- an error in packageManager.xml.porg (comment before <?xml?> tag)
- a non-working $Id in Makefile
- some fixes for using the sect1info in lfs (in BLFS tools)
- a big rewrite for generating scripts with more consistent line spacing,
  opening the way to manage remap="test" and remap="doc" attributes
2019-06-15 15:26:23 +00:00
Pierre Labastie
77a8042414 Add the case of pnmixer to packInstall.sh.porg 2019-04-25 09:17:56 +00:00
Pierre Labastie
2c603d8caf Fix a few missing bits of the transition to the new menu subsystem 2019-04-25 08:44:43 +00:00
Pierre Labastie
f596dde66c Get rid of the GPLv2 license:
- Replace the menu system with the Kconfiglib, which has an ISC license
- Remove farce and any reference to it
- Rewrite the copyright notice, add the LICENSE files
- Adapt Config.in and a few other programs to the new menu system
2019-04-24 16:16:20 +00:00
Pierre Labastie
7fa93699d4 Fix a long standing bug in func_compare.sh:
The files in test-logs have the package version in their names
2019-04-24 15:07:04 +00:00
Pierre Labastie
183cc33453 Fix a missing newline in one message 2019-04-24 15:03:58 +00:00
Pierre Labastie
72e9e684e7 Fix a long standing bug in func_check_version.sh:
Using the non existent dotSTR variable caused a ragged output.
Use the spaceSTR variable rather
2019-04-24 15:01:26 +00:00
Pierre Labastie
aeb8539125 Fix generation of install instructions, and remove those pesky && as much as
possible
2019-04-22 09:38:44 +00:00
Pierre Labastie
dfc023a13c typo 2019-04-18 08:55:19 +00:00
Pierre Labastie
a22bfe1ab5 Author: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
Date:   Tue Apr 16 13:31:09 2019 -0700

    Improve testing of configuration file timestamp
    
      * Provide a default value for each so that the comparisons of the time
        of each file doesn't fail.
      * Two commands in the Makefile could acceptably fail, but would
        produce some ugly warnings.
    
    Signed-off-by: Pierre Labastie <pierre.labastie@neuf.fr>
2019-04-17 07:06:13 +00:00
Pierre Labastie
8589e90f5c Remove spurious spaces at the end of lines 2019-04-16 13:02:12 +00:00
Pierre Labastie
8fb8ff2612 Remove a spurious blank line in gen-install.xsl 2019-04-16 12:15:21 +00:00
Pierre Labastie
aa283c0dee Fix again properties 2019-04-16 08:29:14 +00:00
Pierre Labastie
2e2ac742c7 Add missing $Id:$ comments 2019-04-16 08:06:03 +00:00
Pierre Labastie
c048987a2c BLFS: fix generation of install and test instructions (ticket #1721):
- add a gen-install.xsl stylesheet for grouping all cases
- add a mode="installation" attribute for templates
- rewrite sect2 template so that the right templates are applied
- adapt other templates so that they are compatible
- rewording of some comments (no direct relation with the ticket)
2019-04-16 07:30:02 +00:00
Pierre Labastie
bc2f5913e6 Improve common/progress_bar.sh based on shellcheck:
- remove useless array declarations
  - remove unused variables
  - remove $ prefix for variable names in arithmetic expressions
  - normalize indentation (2 spaces)
2019-04-13 16:33:38 +00:00
Pierre Labastie
0e4ddfa0c1 Improve top-level jhalfs based on shellcheck
* Various improvements from shellcheck around quoting, the use of
   read, `` vs $() and other logical comparisons
 * Provide a function for sourcing/loading files so we can remove a lot
   of duplication. Move loading of some functions from
   common/common-functions to ./jhalfs for consistency
 * Provide some functions for standardized messaging
 * Remove other duplication in the code, especially checking VERBOSITY
 * Standardize indentation. Two spaces seemed the most prevalent so I
   went with that.

Patch by Jeremy Huntwork, with slight modifications.
2019-04-13 16:31:24 +00:00
Pierre Labastie
2758d9421e Use sect1info for getting informations on LFS packages:
- add sect1info sections to packagemanager.xml.xxx + various fixes
- add templates in LFS/lfs.xsl for script start and script end:
  - script start: define variables containing package information
                  print disk usage
                  unpack and change dir
  - script end: print disk usage
                remove build dir
- remove the corresponding operations from master.sh
2019-04-11 07:40:50 +00:00
Pierre Labastie
adbd09b06c LFS/lfs.xsl: Update directory layout of PKG_DEST
- Do not symlink /{usr/,}lib64->lib
    - Do not symlink /usr/{man,info}->share
    - Create /lib64 on x86_64
    - Create /usr/lib/pkgconfig
    - do not create /usr/lib/rpcsvc
    - check that a directory exists before testing its emptyness
      (for example, attr removes empty manx dirs)
2019-04-08 10:03:26 +00:00
Pierre Labastie
eabfc593e5 Unset MAKELEVEL in BLFS scriptlets. Fixes #1720. 2019-03-26 07:53:17 +00:00
Pierre Labastie
05f3977323 Add initramfs to non-versioned packages 2019-03-25 21:47:04 +00:00
Pierre Labastie
3142368d67 I cannot read: variable in /etc/sysconfig/console is LOGLEVEL, not LOG_LEVEL! 2019-03-15 16:18:48 +00:00
Pierre Labastie
c6506aea23 Remove sudo from commands run as root (and some DEBUG lines) 2019-03-15 08:55:01 +00:00
Pierre Labastie
a659e46082 Hopefully get the devices: target Ok now 2019-03-14 21:02:58 +00:00
Pierre Labastie
13c475babc Get virtual kernel filesystem commands from the book, and really add
/run/systemd/resolve/resolv.conf after creating the kernel FS in chapter 6
2019-03-13 06:31:55 +00:00
Pierre Labastie
49ba78d711 Always display gcc's full version 2019-03-11 14:25:09 +00:00
Pierre Labastie
f5e658dc6c Fix filename extension in /etc/sysconfig/ifconfig.xxx so that it matches
the IFACE value. Works only with revision 11556 or later of LFS book.
2019-03-10 09:15:10 +00:00
Pierre Labastie
426c618053 Stupid typo 2019-03-09 20:27:44 +00:00
Pierre Labastie
3b43e17bda Generate console files:
- add variables LOCAL (y is hw clock set to local time) and LOG_LEVEL (sysv)
- generate /etc/sysconfig/console (sysv) or /etc/vconsole.conf (systemd)
- generate /etc/adjtime (only systemd)
- remove UNICODE and FONTMAP variables (jhalfs makes unicode default)
2019-03-09 08:11:37 +00:00
Pierre Labastie
90f5b6de2e Remove obsolete blfs_tools dependencies 2019-03-09 08:02:10 +00:00
Pierre Labastie
5af9ab4b8c In the systemd book, the network card is designed as
"<network-device-name>", not "eth0".
2019-03-09 07:18:52 +00:00
Pierre Labastie
d39252b7ca LFS: Copy /etc/resolv.conf to where it should be during chroot, for
systemd: this allows using the network in chroot.
Also add a chroot1 target, and update the teardown target to what is
in the book.
2019-03-09 07:15:41 +00:00
Pierre Labastie
399058f718 Python in func_check_version should be uppercase 2019-02-15 16:06:46 +00:00
Pierre Labastie
7a821947ad Add version check for Python 2019-02-15 14:11:36 +00:00
Pierre Labastie
cd02aa5ad9 Remove obsolete udev detection in BLFS/gen-special.sh 2019-02-10 13:05:14 +00:00
Pierre Labastie
b71e3adb60 Move porg_bash_completion to where it belongs 2019-01-16 10:09:37 +00:00
Pierre Labastie
d505128fbc Do not exit on SIGCHLD:
With bash 5.0, a SIGCHLD signal is sent whenever a subshell exits. The signal
numbers passed to the trap instruction in jhalfs contain SIGCHLD, and this
new behavior causes jhalfs to exit. Fix this by using names instead of numbers
for the trap, and (of course) not trapping SIGCHLD.
2019-01-13 08:32:24 +00:00
Pierre Labastie
f168be19d5 Remove "-i" flags in kernel scriptlet 2019-01-02 20:57:01 +00:00
Pierre Labastie
04fcea11b7 Add the case of Test-MockModule (perl module) to packInstall.sh 2018-12-08 10:12:46 +00:00
Pierre Labastie
c8d5f11878 update-lfs.sh: remove tools package from instpkg.xml 2018-12-08 10:04:25 +00:00
Pierre Labastie
94a78ddfa2 When installing BLFS tools, the database of installed packages is populated
with LFS pacakges. But packages installed only in tools should not be in
this database. As a side note, it would be cleaner to use an xsl stylesheet
for that.
2018-12-08 09:04:01 +00:00
Pierre Labastie
1646303d91 A module can be a special case, too (perl-test-mockmodule) 2018-11-23 14:30:06 +00:00
Pierre Labastie
6e28f3c4de Translate parentheses to "_" in the module page names. Otherwise there are errors when displaying the
menu
2018-09-28 14:39:18 +00:00
Pierre Labastie
625cb147bd Add possibility to automate bash shell startup files, vimrc, and rng.
This adds a new variable to the configuration (LANGUAGE).
Also automate the generation of various <replaceable> instructions
2018-09-28 14:35:46 +00:00
Pierre Labastie
3b4399c962 Add a case for lynx in packInstall.sh.porg 2018-09-04 10:06:09 +00:00
Pierre Labastie
b86dfaf1c0 Fix generation of chroot instructions 2018-05-12 11:27:10 +00:00
Pierre Labastie
6747d510ed Fix packInstall.sh.porg for junit 2018-03-19 21:01:06 +00:00
Pierre Labastie
2b67b9ba4d Finally, openldap does not need .la files 2018-03-11 05:55:16 +00:00
Pierre Labastie
2969cdfb6b Prevent openldap module .la files to be removed
They are needed for loading modules...
2018-03-10 14:30:21 +00:00
Pierre Labastie
0d1c9f0ce1 Now libuv has a version string starting with"v" 2018-03-10 11:04:42 +00:00
Pierre Labastie
eb5a32de85 Fix syntax error in preceding commit 2018-03-10 10:08:38 +00:00
Pierre Labastie
b25dbcf791 packInstall.sh.porg: account for the possibility of
having a source directory named x265_vx.y or just x265_x.y
(where x and y are digits)
2018-03-10 10:02:26 +00:00
Pierre Labastie
5c69841844 Special case for unrar in packInstall.sh.porg 2018-02-25 08:30:01 +00:00
Pierre Labastie
8fb1daade2 Special case for psutils in packInstall.sh.porg 2018-02-25 08:05:56 +00:00
Pierre Labastie
e030049a44 BLFS/func_dependencies: when building the graph, and DEP_LEVEL=3 (build opt
deps only for requested packages), it may happen that a requested packages
    is seen at depth > 2 before it is seen at depth=2. In this case, optional
    deps are not processed the first time, and then the package is not processed
    at depth 2 because it has already been seen. Add a case statement against
    that.
2018-02-19 16:01:00 +00:00
Pierre Labastie
df1f318915 Have the STATS variable displayed in jhalfs-blfs 2018-02-11 07:31:23 +00:00
Pierre Labastie
9e0c4b6a3a Wrong variable name when naming info.log file if stats are requested 2018-02-10 21:46:46 +00:00
Pierre Labastie
28546ae95d Output some information during the cleaning phase in BLFS dependency engine
for the impatient
2018-02-09 09:24:55 +00:00
Pierre Labastie
7bc70cd968 Allow DESTDIR to work for libelf, now that it is in LFS 2018-02-05 21:46:36 +00:00
Pierre Labastie
67c3df4aef Add stats to jhalfs-blfs. NB: due to book layout, far from perfect... 2018-02-05 18:12:17 +00:00
Pierre Labastie
ad747edfb0 Move the linefeed. Sometimes, several attempts are needed to make things
rignt, sorry
2018-02-05 14:56:54 +00:00
Pierre Labastie
6613034d13 Move a misplaced linefeed in LFS/lfs.xsl:outputpkgdest 2018-02-05 10:45:29 +00:00
Pierre Labastie
1cb4c7662c Only output DESTDIR when the command is "ninja install" 2018-02-05 10:30:01 +00:00
Pierre Labastie
4696ddd406 Add DESTDIR instructions when the command is "ninja install" (in LFS/lfs.xsl) 2018-02-05 09:54:15 +00:00
Pierre Labastie
bcbecc53f9 Don't generate porg and del .la instructions when doing userad or groupadd 2018-02-04 15:19:14 +00:00
Pierre Labastie
b7583ec500 Removing the need to have write access to BUILDDIR:
- remove an entry in Config.in (useless, since we impose sudo anyway)
- Update README and CHEATSHEET
2018-02-04 08:50:16 +00:00
Pierre Labastie
c7b535b488 Remove the need to have write access to BUILDDIR, using sudi, which is
required anyway. ticket #1715
2018-02-03 16:37:32 +00:00
Pierre Labastie
f1edc8e377 Because we do not want to depend on <pack>groupxx if it creates a circular
dependency, it may happen that nothing depends on <pack>groupxx. Detect and
    fix this by appending <pack>groupsxx to root.dep
2018-02-02 21:12:30 +00:00
Pierre Labastie
d80302bf94 Impose -pass1 to be built before its dependant package (bug #1718) 2018-02-02 21:10:16 +00:00
Pierre Labastie
59afe7323a BLFS/libs: Another stupid bug in path_to 2018-02-02 21:06:49 +00:00
Pierre Labastie
5afaf7cc48 BLFS/libs/func_dependencies: fix 2 stupid bug in function path_to 2018-02-02 17:55:29 +00:00
Pierre Labastie
1fa0dee15b Prepend JH_ to exported variables in jhalfs-blfs, so that collision with
build system variables is unlikely
2018-01-30 13:53:34 +00:00
Pierre Labastie
2140f22a88 New management of dependencies:
- Even if only required or recommended deps only are requested and built,
  account for optional deps to build the pacakge order
- build "runtime" deps after the pacakge dependening on them, but before
  any other package
- using the "first" role in the book, implement pass1 pacakges when there
  are circular dependencies
- Documentation has still to be written
- There must be bugs, thank you for testing...
2018-01-28 17:56:55 +00:00
Pierre Labastie
764a5d712c Do not add >> $TESTLOG to lines ending with "\" 2018-01-14 20:19:14 +00:00
Pierre Labastie
84a3fda1c3 Do not optimize binutils-pass1 in order to measure the SBU:
- introduce REALSBU variable if Config.in and jhalfs, and display it
- Adpat LFS/master.sh
2018-01-14 10:26:43 +00:00
Pierre Labastie
d2a7ec8984 Missing quote in Config.in 2018-01-13 09:34:57 +00:00
Pierre Labastie
2e1c1c3c16 Remove spaces at the end of lines 2018-01-13 09:08:56 +00:00
Pierre Labastie
dc7fd7b7ba Add .la file removal to LFS and BLFS scripts 2018-01-12 19:04:19 +00:00
Pierre Labastie
5637b53ba7 override libelf->elfutils for getting the tarball name 2018-01-12 16:10:54 +00:00
Pierre Labastie
c672fa87d7 Always create the test-log directory to allow user to "uncomment" test
instructions
2018-01-12 10:42:36 +00:00
Pierre Labastie
5a8939e7f9 Really comment out test instructions+always define TESTLOG since the user
may "uncomment" some tests
2018-01-12 09:40:59 +00:00
Pierre Labastie
489bdc21d1 Always generate test instructions, and comment unwanted ones out.
Fixes ticket #1695, also for CLFS...
2018-01-07 21:22:46 +00:00
Pierre Labastie
1d5f3e309f Always generate test instructions, and comment unwanted ones out.
Fixes ticket #1695
2018-01-07 20:20:12 +00:00
Pierre Labastie
4b2a5fd304 Typos and removing useless instruction 2018-01-07 18:23:51 +00:00
Pierre Labastie
0d93997796 The case of x265 in packInstall.sh.porg 2017-12-02 20:34:57 +00:00
Pierre Labastie
ce99eb609b Do not set LC_ALL in BLFS/envars.conf,
and rely on the user setting an UTF-8 locale
2017-11-19 16:59:34 +00:00
Pierre Labastie
e6ed1a1de7 Warn before cleaning BUILDDIR; see #1711 2017-11-01 14:40:53 +00:00
Pierre Labastie
9556f88088 Missing word in a comment 2017-11-01 14:40:09 +00:00
Pierre Labastie
fb63ddff14 No need for $() in if command 2017-11-01 14:39:34 +00:00
Pierre Labastie
7a0c3d2128 Add code to account to the new role attribute in dependencies 2017-10-07 18:48:02 +00:00
Pierre Labastie
87405299a9 Add ninja and python to the list of LFS packages which should not appear,
since they are also in BLFS
2017-10-07 08:17:57 +00:00
Pierre Labastie
b2fa9e83de Merge jhalfs 2.4 branch r4008: Remove characters that are illegal in filenames from external deps 2017-09-14 17:10:47 +00:00
Pierre Labastie
d0d4181726 Vim is in BLFS and should not be in LFS package list 2017-09-14 17:04:16 +00:00
Pierre Labastie
711b98e84e Special case for exiv2 version 2017-09-05 08:46:06 +00:00
Pierre Labastie
e674994435 One more special version case (xvid) 2017-08-23 08:45:02 +00:00
Pierre Labastie
6c8095a04f Avoid infinite recursion in "tree-erase" if there is a circular dependency 2017-08-22 09:00:49 +00:00
Pierre Labastie
ca37fee8d7 Avoid parsing a bridgehead which is not a perl-module 2017-08-22 08:59:04 +00:00
Pierre Labastie
ee68aee4b1 Make BLFS/update-lfs.sh executable 2017-08-21 16:19:26 +00:00
Pierre Labastie
91e8eaa0b0 Fix stupid copy-paste bug 2017-08-21 16:05:14 +00:00
Pierre Labastie
e3f4b9a4c1 Fix grepping for VERSION (func_install_blfs)
Add LFS-Release (update-lfs.sh and func_install_blfs)
2017-08-17 11:27:07 +00:00
Pierre Labastie
ce244f6517 Add a script to update the tracking file for LFS packages at a given revision
either by date or tag
2017-08-12 13:07:05 +00:00
Pierre Labastie
b15261a649 Update documentation for LFS inclusion in BLFS tools. 2017-08-12 13:03:06 +00:00
Pierre Labastie
6d1d77c1e8 Improve the list of installed LFS packages:
Take package names and versions from <sect1info> tags in lfs-full.xml
2017-08-10 15:25:12 +00:00
Pierre Labastie
f73377282f Fix two bugs:
- LFS_XML variable was forgotten in Config.in
- All customization to $JHALFSDIR have to be done before getting the
  {H,C,}LFS book, so that custom/config/* has to be copied before getting
  the book.
2017-08-10 08:10:43 +00:00
Pierre Labastie
2cef19fddd Fix "Id" property in lfs_make_book.xsl 2017-08-09 14:20:25 +00:00
Pierre Labastie
607ef21bf6 Add missing bits to generate scripts for LFS in BLFS tools 2017-08-09 14:18:03 +00:00
Pierre Labastie
91b7b5fd88 Output a linear book for LFS, with BLFS format 2017-08-09 14:15:27 +00:00
Pierre Labastie
b8aa7ed93b common/libs/func_install_blfs: Add LFS to BLFS tools 2017-08-09 14:10:46 +00:00
Pierre Labastie
dd08e14af0 Fix whether BLFS_TREE contains BOOK according to branch or tag 2017-08-09 14:00:58 +00:00
Pierre Labastie
506120eeec install-blfs-tools.sh:
- Add instructions to retrieve and parse LFS book into packages.xml
2017-08-09 13:55:55 +00:00
Pierre Labastie
200fbdee76 jhalfs: reorder actions: install lfs before custom tools
and blfs
2017-08-09 13:51:40 +00:00
Pierre Labastie
340c27e8ae common/libs/func_install_blfs:
Honour-variables-set-in-jhalfs
2017-08-09 13:47:45 +00:00
Pierre Labastie
51dba866a0 BLFS/xsl/gen_pkg_list.xsl: misalignned closing tag 2017-08-09 13:32:22 +00:00
Pierre Labastie
e415656b9f BLFS/Makefile:
-  Do not call make after inititalizing the tracking file
-  Remove the <package-version> file from tracking dir after using it
-  Fix a typo
2017-08-09 13:25:26 +00:00
Pierre Labastie
203a64ca76 Allow a non numeric version in glibc 2017-07-11 16:21:26 +00:00
Pierre Labastie
a1fcdea110 Node.js is a special case for VERSION 2017-07-11 07:43:07 +00:00
Pierre Labastie
d0e13dd268 Two new version special cases in BLFS 2017-07-07 07:40:42 +00:00
Pierre Labastie
9bbb9c83f3 Package management: compute times and sizes without packing times and sizes 2017-07-04 12:19:46 +00:00
Pierre Labastie
322226dbf8 Do not export the wrapInstall function when porg style is not in use 2017-07-04 12:17:11 +00:00
Pierre Labastie
45f8a9c86d Forgotten quotes 2017-06-29 16:54:28 +00:00
Pierre Labastie
c57747dba5 Make the date of the SBU_DU file the same as the one reported at the end of
the jhalfs run. Note that date is the one when the run is started
2017-06-29 16:45:31 +00:00
Pierre Labastie
a4acb1236b Quote bash variables in arguments to --stringparam for xsltproc 2017-06-29 14:10:30 +00:00
Pierre Labastie
6990d80390 Rmove reference to lfs.org,
and try to document the different options for
network settings
2017-06-29 09:59:05 +00:00
Pierre Labastie
973c767b90 Use BUILD_DIR and SRC_DIR in bootscripts/systemd-units download instructions
(cherry picked from r3967 in 2.4 branch)
2017-06-29 08:25:01 +00:00
Pierre Labastie
59bb076988 Update CLFS/master.sh do-housekeeping target, thanks to W Harrington for the
patch
2017-06-11 10:49:40 +00:00
Pierre Labastie
46ac3305f3 Fix the path to the book used when "Rebuild the Makefile" has been selected 2017-04-30 21:50:25 +00:00
Pierre Labastie
cee84ade49 Copy the right files to SRC_ARCHIVE when "Retrieve source files" is on
and "Add blfs-tool support" is on: only $PACKAGE{,1} files were copied.
2017-04-10 08:34:27 +00:00
Pierre Labastie
945ccaa75e Merge the new_features branch (manully, thanks to svn) 2017-04-09 10:29:32 +00:00
Pierre Labastie
909ee37e1a When asked its version, jhalfs should not return an error code 2017-04-02 09:00:42 +00:00
Pierre Labastie
8d56c87e53 Change version wording 2017-04-02 08:38:45 +00:00
Pierre Labastie
de57ef4f16 Fix issue with clfs, when using
a tag in git, and not checking "Rebuild files": git pull fails because
the local repo is in "detached head" state.
- fix an issue with iputils patch in clfs-3.0.0
2017-04-01 11:05:15 +00:00
Pierre Labastie
6bba83ffeb Add a CHEATSHEET file 2017-03-28 20:10:55 +00:00
Pierre Labastie
cc8dba9d35 Refactor two README files 2017-03-27 19:49:04 +00:00
Pierre Labastie
5e59386c6d Logging of the scriptlets generation had disappeared in the preceding
commit...
2017-03-27 19:10:38 +00:00
Pierre Labastie
1814367e83 Fix the case of the "symlinks.xml" file, which has revision attributes in sect2, which defeats a filter
based solely on screen and sect1 attributes.
2017-03-27 16:14:49 +00:00
Pierre Labastie
0ad3a337f1 When choosing the LFS book, we should not depend on docbook-xml. This is achieved by directly treating the revision attribute in lfs.xsl, instead of using profiling from docbook-xsl. 2017-03-27 09:40:41 +00:00
Pierre Labastie
c67990fd77 Existence of package management files is tested even if PKGMNGT=n. Fix that. Thanks to Michael D.L. for reporting. 2017-03-25 21:00:16 +00:00
Pierre Labastie
b6f19e750c Typo 2017-03-20 15:38:05 +00:00
Pierre Labastie
c6c2d8966a Small adjustements to READMEs and BLFS/TODO 2017-03-20 15:31:30 +00:00
Pierre Labastie
c7c32a324f Update READMEs 2017-03-19 21:08:18 +00:00
Pierre Labastie
9da16d9bf1 Fix a bug in the blfs scripts, occuring when the pacakge is neither a
tarball nor a zip file: copy the package from $SRC_DIR to the xxx-build dir.
And in case they are needed, copy the additional files too.
2017-03-19 16:17:18 +00:00
Pierre Labastie
3aa1acdc0d Add checks for the files used by package management functions. Fix #1701 2017-03-19 14:54:28 +00:00
Pierre Labastie
70ea617040 Make SBU and size computations incompatible with package management, since
the figures are wrong when package management is on (see #1694)
2017-03-18 18:23:48 +00:00
Pierre Labastie
2cf28dcaf1 Merge new_features r3922:
Add instructions to copy to SRC_ARCHIVE in func_install_blfs, so that files
    are kept in host repo, and not downloaded again, should a new build be
    started.
2017-03-16 13:40:18 +00:00
Pierre Labastie
8dc464678e Merge new_features: Allows to retrieve package from SRC_ARCHIVE, in case it is not already there
and is in archive. This should not happen in normal operation, but may happen
    in func_install_blfs
2017-03-16 12:49:01 +00:00
Pierre Labastie
39dc04a73d Merge new_features rev 3918 2017-03-15 21:06:17 +00:00
Pierre Labastie
e5d44f5f1f Add the possibility to install BLFS tools to a running LFS from the jhalfs
menu:
- Add the possibility to choose BOOK_BLFS from menu. That hides all the
  irrelevant parameters
- Adapt install-blfs-tools.sh
- Change slightly mconf.c so that there is a better alignement in menus
2017-03-15 09:16:40 +00:00
Pierre Labastie
18567e96ff Hopefully last seting of Id keyword property 2017-03-12 13:36:57 +00:00
Pierre Labastie
f4a3b0ca3f Add another set of Id keywords properties 2017-03-12 13:34:15 +00:00
Pierre Labastie
56178bab73 Add a few forgotten keywords properties 2017-03-12 13:20:02 +00:00
Pierre Labastie
240b1a8635 Update pacman commands (not version, it would require too many changes to the
build system).
2017-03-11 16:47:43 +00:00
Pierre Labastie
abc276c1b4 Update to latest dpkg 2017-03-10 20:42:08 +00:00
Pierre Labastie
d601cfcc47 Fix logic for copying fstab. That stupid bug wanted to copy fstab when
FSTAB was empty!
2017-03-10 20:23:57 +00:00
Pierre Labastie
3d24e5bfdf Default to not strip binaries 2017-03-05 18:16:34 +00:00
Pierre Labastie
85506da325 Merge new_features branch at r3901; Fixes:
when the user fstab and/or kernel config are the same as the ones in
$BUILDDIR/sources: avoid to cp on itself
- set SRC_ARCHIVE=/dev/null in BLFS tools download script if SRC_ARCHIVE is
empty
2017-03-05 08:38:09 +00:00
Pierre Labastie
df97e687b5 Merge "new_features" branch r3898:
output /etc/os-release when the init system is systemd
2017-03-03 21:16:40 +00:00
Pierre Labastie
84440e673d Unless explicitely set on the command line, the REV parameter
in BLFS tools make is the same as the preceding used one. Formerly, it
was set to sysv unless defined on the command line
2017-03-02 16:38:25 +00:00
Pierre Labastie
70d73d1e82 Install units when revision is systemd, rather than bootscripts 2017-03-01 15:54:16 +00:00
Pierre Labastie
fbdd1a8401 Merge r3892 from branch "new_features" 2017-03-01 11:01:27 +00:00
Pierre Labastie
6eaae5e34c Fix Ed tarball unpacking 2017-02-28 12:46:52 +00:00
Pierre Labastie
67723e1682 merge new_features revision 3888 2017-02-27 17:33:46 +00:00
Pierre Labastie
342c862481 Merge new_feature branch r3884 to3886:
- Adapt BLFS/envars.conf to modern BLFS books
- Fix try order for downloading BLFS packages
- Fixes to use the XORG Legacy page in BLFS
2017-02-27 14:09:03 +00:00
Pierre Labastie
9575278319 Fix dependencies when there is
a <phrase> tag above the <xref>
2016-12-03 18:22:50 +00:00
Pierre Labastie
f1fcb6b7a6 Merge r3879 from new_features branch 2016-11-24 16:52:03 +00:00
Pierre Labastie
26e6739b12 Add a forgotten switch REV=$INITSYS to the make command in BLFS tools,
so that the systemd revision be used when the LFS revision is systemd
2016-10-16 14:02:34 +00:00
Pierre Labastie
ebb631aad8 With the double book, it may happen that <phrase> is used
inside <title>, and that generates an unwanted linefeed. So, use
normalize-space for titles when generating the package list
2016-08-24 15:21:49 +00:00
Pierre Labastie
78d47793a9 Tidy is not needed anymore for BLFS tools. 2016-06-25 10:27:48 +00:00
Pierre Labastie
4f3c433f7b Fix for using the BLFS "double" book. Note that it does not work if one of the
revisions has been rendered, and you want to switch to the other one
2016-06-13 16:51:45 +00:00
Pierre Labastie
878a5a08dc Forgot to change a variable name in the validation code at
last commit
2016-05-28 10:34:51 +00:00
Pierre Labastie
c9598f2108 Adaptation for merged LFS books. A few typos with no consequence are corrected too. 2016-05-28 10:00:30 +00:00
Pierre Labastie
061d54fbd5 change the way the hostreqs.xml file is found, to account for recent move from prologue to chapter 2 in
LFS
2016-05-20 11:46:49 +00:00
Pierre Labastie
8ebac92b36 Preceding commit fix 2016-03-19 20:25:09 +00:00
Pierre Labastie
e253015c69 When running BLFS/gen-makefile.sh, the current working directory is emptied.
If this is not the directory you intended to work in, you may erase precious
data. So only erase data in directories whose name begin with "work".
2016-03-19 20:07:33 +00:00
Pierre Labastie
4888f0cdd4 typos 2016-02-29 15:30:06 +00:00
Pierre Labastie
f37d08b3aa Fix a bug in "tree_erase",
which occurs rarely
2016-02-28 18:07:52 +00:00
Pierre Labastie
9543675e7d Update custom/examples. Thanks to Tom Armistead for the patch. 2016-02-20 22:13:22 +00:00
Pierre Labastie
e6967a11b1 Add possibility for lzma extension when untarring in BLFS tools 2016-01-30 08:33:14 +00:00
Pierre Labastie
5f154f1a1f Add instructions to unset PKG_CONFIG_PATH in CLFS? masters, because some
distros set this variable and it causes some trouble. Thanks to W. Harrington
for the patch.
2015-12-28 17:49:20 +00:00
Pierre Labastie
316f845e03 Add forgotten svn:keyword "Id" to common/hostreqs.xsl 2015-12-21 07:59:26 +00:00
142 changed files with 31536 additions and 25275 deletions

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
# configuration*
custom/config/
menu/__pycache__/
# pkgmngt/packInstall.sh
# pkgmngt/packageManager.xml

View file

@ -1,35 +1,50 @@
# From the Build Scripts Written By: Jim Gifford <lfs@jg555.com> # From the Build Scripts Written By: Jim Gifford <lfs@jg555.com>
# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org # Modified By: Joe Ciccone <jciccone@linuxfromscratch.org>
# Additional changes: George Boudreau <georgeb@linuxfromscratch.org> # Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
# Pierre Labastie <pierre.labastie at neuf.fr> # Pierre Labastie <pierre.labastie at neuf.fr>
# $Id$
ifdef V ifdef V
Q = Q =
else else
Q = @ Q = @
endif endif
# Known behavior # Makefile should reside in a directory where there are two subdirectories
LANG=C # initially:
LC_ALL=C TOPDIR = $(shell pwd)
# the stylesheets
XSLDIR = $(TOPDIR)/xsl
# the menu program sources
MENU = $(TOPDIR)/menu
# The right-hand side is updated by jhalfs # Those directories and files will be created and populated by make:
TRACKING_DIR = tracking-dir # directory of the book sources:
TOPDIR=$(shell pwd) LFS_XML = $(TOPDIR)/lfs-xml
BLFS_XML = $(TOPDIR)/blfs-xml BLFS_XML = $(TOPDIR)/blfs-xml
XSLDIR = $(TOPDIR)/xsl # contains the REV used in the preceding call:
REVFILE = $(TOPDIR)/revision
RENDERTMP = $(BLFS_XML)/tmp # the list of packages:
BLFS_FULL = $(RENDERTMP)/blfs-full.xml PACK_LIST = $(TOPDIR)/packages.xml
PACK_LIST = $(TOPDIR)/packages.xml # the generated menu input:
MENU = $(TOPDIR)/menu
CONFIG_CONFIG_IN = $(TOPDIR)/Config.in CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
CONFIG_OUT = $(TOPDIR)/configuration # menu output:
BOOK_XML = $(TOPDIR)/book.xml CONFIG_OUT = $(TOPDIR)/configuration
TRACKFILE = $(TRACKING_DIR)/instpkg.xml # the linear book:
BOOK_XML = $(TOPDIR)/book.xml
LFSTMP = $(LFS_XML)/tmp
RENDERTMP = $(BLFS_XML)/tmp
LFS_FULL = $(LFSTMP)/lfs-full.xml
BLFS_FULL = $(RENDERTMP)/blfs-full.xml
# The right-hand side is updated by jhalfs:
# Where the tracking file resides:
TRACKING_DIR = tracking-dir
# Will be created by make, if not existent
TRACKFILE = $(TRACKING_DIR)/instpkg.xml
# Initial content of the tracking file
define INITIAL_TRACK define INITIAL_TRACK
<?xml version="1.0" encoding="ISO-8859-1"?>\n\ <?xml version="1.0" encoding="ISO-8859-1"?>\n\
\n\ \n\
@ -39,27 +54,59 @@ define INITIAL_TRACK
</sublist> </sublist>
endef endef
SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK # Git locations and branches
LFS-GIT = https://git.linuxfromscratch.org/lfs.git
LFS-BRANCH = trunk
GIT = https://git.linuxfromscratch.org/blfs.git
BLFS-BRANCH = trunk
ALLXML := $(filter-out $(RENDERTMP)/%, \ ALLXML := $(filter-out $(RENDERTMP)/%, \
$(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml)) $(shell if [ -d $(BLFS_XML) ]; then \
find $(BLFS_XML) -name \*.xml; \
fi))
ALLXMLLFS:= $(filter-out $(LFSTMP)/%, \
$(shell if [ -d $(LFS_XML) ]; then \
find $(LFS_XML) -name \*.xml; \
fi))
ALLXSL := $(filter-out $(RENDERTMP)/%, \ ALLXSL := $(filter-out $(RENDERTMP)/%, \
$(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl)) $(shell if [ -d $(BLFS_XML) ]; then \
find $(BLFS_XML) -name \*.xsl; \
fi))
ALLXSLLFS := $(filter-out $(LFSTMP)/%, \
$(shell if [ -d $(LFS_XML) ]; then \
find $(LFS_XML) -name \*.xsl; \
fi))
# Try to set the REV variable according to previous runs, except when
# set on the command line:
REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi)
ifneq ($(origin REV),command line)
ifdef REV1
REV = $(REV1)
else
REV = not defined
endif
endif
ifneq ($(REV),sysv)
ifneq ($(REV),systemd)
$(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
endif
endif
$(BOOK_XML): $(CONFIG_OUT) $(BOOK_XML): $(CONFIG_OUT)
$(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL) $(Q)$(TOPDIR)/gen_pkg_book.sh $(TRACKFILE) $(TOPDIR) $(BLFS_FULL) $(LFS_FULL)
$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf $(CONFIG_OUT): $(CONFIG_CONFIG_IN)
$(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN) $(Q)CONFIG_="" KCONFIG_CONFIG=configuration \
python3 $(MENU)/menuconfig.py $(CONFIG_CONFIG_IN)
$(MENU)/mconf:
$(Q)$(MAKE) -C $(MENU) ncurses conf mconf
$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl $(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
$(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST) $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(LFS_FULL)
$(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \ $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
--stringparam lfs-full $(LFS_FULL) \
-o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL) -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
$(Q)xmllint --postvalid --format -o $@ $@.tmp $(Q)xmllint --postvalid --format -o $@ $@.tmp
$(Q)rm $@.tmp $(Q)rm $@.tmp
@ -72,11 +119,10 @@ $(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE)
$(TRACKFILE): $(TRACKING_DIR) $(TRACKFILE): $(TRACKING_DIR)
$(Q)if ! [ -f $@ ]; then \ $(Q)if ! [ -f $@ ]; then \
echo Initializing $(TRACKFILE) && \ echo Initializing $(TRACKFILE) && \
/bin/echo -e '$(INITIAL_TRACK)' > $@ && \ /bin/echo -e '$(INITIAL_TRACK)' > $@; \
$(MAKE) $(PACK_LIST); \
fi fi
$(Q)for track in $(TRACKING_DIR)/*-*; do \ $(Q)for track in $(TRACKING_DIR)/*-*; do \
if [ -f $$track ]; then \ if [ -f $$track ]; then \
pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \ pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \ version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
xsltproc --stringparam packages $(PACK_LIST) \ xsltproc --stringparam packages $(PACK_LIST) \
@ -85,7 +131,8 @@ $(TRACKFILE): $(TRACKING_DIR)
-o track.tmp $(XSLDIR)/bump.xsl $@ && \ -o track.tmp $(XSLDIR)/bump.xsl $@ && \
sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \ sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
xmllint --format --postvalid track.tmp > $@; \ xmllint --format --postvalid track.tmp > $@; \
fi; \ fi; \
rm -f $$track; \
done; \ done; \
rm -f track.tmp rm -f track.tmp
@ -96,27 +143,91 @@ $(TRACKING_DIR):
$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL) $(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
$(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@ $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
ifneq ($(REV),$(REV1))
$(BLFS_FULL): FORCE
$(LFS_FULL): FORCE
endif
$(LFS_FULL): $(LFS_XML) $(LFS_XML)/general.ent $(ALLXMLLFS) $(ALLXSLLFS)
$(Q)cd $(LFS_XML) && if [ -x git-version.sh ] ; then \
echo "Processing LFS version..."; \
./git-version.sh $(REV); \
fi
@echo "Processing LFS bootscripts..."
$(Q)cd $(LFS_XML) && bash process-scripts.sh
$(Q)[ -d $(LFSTMP) ] || mkdir -p $(LFSTMP)
@echo "Adjusting LFS for revision $(REV)..."
$(Q)xsltproc --nonet --xinclude \
--stringparam profile.revision $(REV) \
--output $(LFSTMP)/lfs-prof.xml \
$(LFS_XML)/stylesheets/lfs-xsl/profile.xsl \
$(LFS_XML)/index.xml
@echo "Validating the LFS book..."
$(Q)xmllint --nonet --noent --postvalid \
-o $@ $(LFSTMP)/lfs-prof.xml
$(Q)rm -f $(LFS_XML)/appendices/*.script
$(Q)cd $(LFS_XML) && ./aux-file-data.sh $@
$(Q)echo $(REV) > $(REVFILE)
$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL) $(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
@echo "Validating the book..." $(Q)cd $(BLFS_XML) && if [ -x git-version.sh ] ; then \
echo "Processing BLFS version..."; \
./git-version.sh $(REV); \
fi
$(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP) $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
$(Q)xmllint --nonet --noent --xinclude --postvalid \ @echo "Adjusting BLFS for revision $(REV)..."
-o $@ $(BLFS_XML)/index.xml $(Q)xsltproc --nonet --xinclude \
--stringparam profile.revision $(REV) \
--output $(RENDERTMP)/blfs-prof.xml \
$(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
$(BLFS_XML)/index.xml
@echo "Validating the BLFS book..."
$(Q)xmllint --nonet --noent --postvalid \
-o $@ $(RENDERTMP)/blfs-prof.xml
$(Q)echo $(REV) > $(REVFILE)
all: update $(BOOK_XML) all: update $(BOOK_XML)
update: $(BLFS_XML) # If in detached head state, "git pull" returns an error, so switch back to
# trunk before updating, and switch back to the branch/tag afterwards
update: $(BLFS_XML) $(LFS_XML)
@echo Updating the book sources @echo Updating the book sources
$(Q)cd $(BLFS_XML) && svn up ifneq (,$(LFS-BRANCH))
$(Q)cd $(LFS_XML) && \
git checkout trunk && \
git pull && \
if [ $(LFS-BRANCH) != trunk ]; then git checkout $(LFS-BRANCH); fi
endif
ifneq (,$(BLFS-BRANCH))
$(Q)cd $(BLFS_XML) && \
git checkout trunk && \
git pull && \
if [ $(BLFS-BRANCH) != trunk ]; then git checkout $(BLFS-BRANCH); fi
endif
$(LFS_XML):
@echo Getting the LFS book sources...
$(Q)git clone $(LFS-GIT) $@
ifneq (,$(LFS-BRANCH))
if [ $(LFS-BRANCH) != trunk ]; then \
cd $@ && \
git checkout $(LFS-BRANCH); \
fi
endif
$(BLFS_XML): $(BLFS_XML):
@echo Getting the book sources... @echo Getting the BLFS book sources...
$(Q)svn co $(SVN) $@ $(Q)git clone $(GIT) $@
ifneq (,$(BLFS-BRANCH))
$(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
cd $@ && \
git checkout $(BLFS-BRANCH); \
fi
endif
# Clean up # Clean up
clean: clean:
rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
- $(MAKE) -C $(MENU) clean
.PHONY: clean all update $(CONFIG_OUT) FORCE:
.PHONY: clean all update $(CONFIG_OUT) version FORCE

View file

@ -2,7 +2,6 @@
# #
# Project TODO list # Project TODO list
# #
# $Id$
##### #####
@ -17,4 +16,25 @@
-- Bugs hunting. -- Bugs hunting.
-- Find a better way to define circular dependencies. -- About dependencies
A. A DEPENDENCY MAY NOT BE INSTALLED EVEN IF NEEDED
Currently (December 10th, 2021), the dependencies are only installed
if either:
- (i) they are not already installed
- (ii) their version is higher than the installed version
If a dependency is not installed, its dependencies are not considered.
But it may happen that a dependency (depB) of a dependency (depA) is in
case (i) or (ii) (most likely), but not depA. In this case, depB is
not considered, although it might happen that it is needed for the
requested package.
So the dependency system should be changed to always compute the full
dependency chain, and another function should be created to remove
packages not in case (i) or (ii) from the list of generated dependencies.
B. CHECKING DEPENDENCIES
There are several kinds of checks we might want to implement, for
example:
- (i) check that a package can be built with only the listed
dependencies, and their dependencies (missing dependency)
- (ii) check that the dependencies do not include dependencies
that are already in the dependency chain (redundant dependency)
- (iii) check that a dependency is really needed (false dependency)

View file

@ -1,152 +0,0 @@
#####
#
# Configuration file for the BLFS module
#
# $Id$
#
# Set default envars used in the build scripts
#
#####
#======== Common envars ==========
#--- Set a well-known working locale when building software
export LC_ALL=C
#--- The local repository for packages/file
# Any missing file will be downloaded and archived here,
# if the user has the right priviledges.
export SRC_ARCHIVE=/sources
#--- Server used if the file isn't found in SRC_ARCHIVE.
# As a last resort, the file will dowloaded from upstream, if possible.
#
# The server path MUST be set as listed in
# http://www.linuxfromscratch.org/blfs/download.html
export FTP_SERVER=ftp://anduin.linuxfromscratch.org/BLFS/
# Use a server close to you for Xorg (see http://wiki.x.org/wiki/Mirrors)
export FTP_X_SERVER=ftp://mirror.cict.fr/x.org/
#--- The sources directory.
# Full path to the top level directory where packages will be stored,
# unpacked, and compiled.
export SRC_DIR=/sources
#======== Xorg7 envars ===========
#--- Installation prefix
export XORG_PREFIX=/usr
#--- Configure switches
export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc \
--localstatedir=/var --disable-static"
#======== ABOUT GNOME envars =====
# Refer to `Chapter 30. Right now, the book hard codes --prefix=/usr
# and does not make use of the variables below. If you need another prefix,
# You'll have to modifiy the prefix in the book source and use the variables
# below. But this is not supported in this tool.
#======== LEGACY GNOME envars ====
# We use envars.conf instead of /etc/profile.d. But if you
# install into a different prefix, you'll need to update ld.so.conf and
# man-db.conf, too.
#--- Installation prefix
# export GNOME_PREFIX=/usr
# export GNOME_SYSCONFDIR=/etc/gnome/3.2.2
# export XDG_CONFIG_DIRS=$GNOME_SYSCONFDIR/xdg
# export XDG_DATA_DIRS=/usr/share:/usr/local/share
#--- If you want to install GNOME on a non standard prefix, uncomment
# the next export lines and edit it if needed.
# See also the GNOME Pre-installation Configuration HTML page for
# aditional required commands.
#export PATH=$PATH:$GNOME_PREFIX/bin
#export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$GNOME_PREFIX/lib/pkgconfig
#export GNOME_LIBCONFIG_PATH=/usr/lib:$GNOME_PREFIX/lib
#======== KDE envars =============
# Refer to `Chapter 27. Introduction->KDE Pre-installation Configuration'
# for rationale. We use envars.conf instead of /etc/profile.d. But if you
# install into a different prefix, you'll need to update ld.so.conf and
# man-db.conf, and to create and populate the directories $KDE_PREFIX/share
# and /etc/dbus-1, as instructed.
#--- Installation prefix
export KDE_PREFIX=/usr
#--- If you want to install KDE on a non standard prefix, uncomment
# the next lines and edit them as needed.
#export KDE_PREFIX=/opt/kde
#export KDEDIR=$KDE_PREFIX
#PATH=$PATH:$KDE_PREFIX/bin
#if [ -z PKG_CONFIG_PATH ]; then
#export PKG_CONFIG_PATH=$KDE_PREFIX/lib/pkgconfig:$KDE_PREFIX/share/pkgconfig
#else
# PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$KDE_PREFIX/lib/pkgconfig:$KDE_PREFIX/share/pkgconfig
#fi
# Note: there is a report that setting XDG_... vars for kde may break LXDE
#if [ -z XDG_DATA_DIRS ]; then
#export XDG_DATA_DIRS=$KDE_PREFIX/share
#else
# XDG_DATA_DIRS=$XDG_DATA_DIRS:$KDE_PREFIX/share
#fi
#if [ -z XDG_CONFIG_DIRS ]; then
#export XDG_CONFIG_DIRS=/etc/kde/xdg
#else
# XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS:/etc/kde/xdg
#fi
#======== LXQt envars =============
# Refer to `Chapter 40. LXQt Desktop Pre-Install Instructions'
# We use envars.conf for LXQT_PREFIX, instead of /etc/profile.d. But if you
# install into a different prefix, you'll need to create the relevant
# directory, to create /etc/profiles.d/lxqt.sh, update /etc/ld.so.conf, and
# to create and populate the directories $LXQT_PREFIX/share/icons, as
# instructed.
#--- Installation prefix
export LXQT_PREFIX=/usr
#--- If you want to install LXQT on a non standard prefix, uncomment
# the next line and edit it as needed, or just use the book's
# /etc/profile.d/lxqt.sh.
# export LXQT_PREFIX=/opt/lxqt
#======== Optimizations =============
# Global optimization settings can be placed here. This settings can be
# overrided by settings in the packages build scripts.
# WARNING: The use of build optimizations may be dangerous.
# You should know what you are doing and be sure that the
# optimization settings placed below are what you want.
# It there are build issues or the system doesn't work as
# expected, please rebuild without optimizations before
# asking for support.
export MAKEFLAGS="-j5"
#export CFLAGS="-O3 -pipe"
#export CXXFLAGS=$CFLAGS
#export LDFLAGS="-s"
#export OTHER_CFLAGS=$CFLAGS
#export OTHER_CXXFLAGS=$CXXFLAGS
#export OTHER_LDFLAGS=$LDFLAGS
#======== Environment settings ========
# Since the startup files may be changed in the course
# of a build, ensure that environment variables are
# up to date
if [ -r /etc/profile ]; then source /etc/profile; fi

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# #
# $Id$
#
set -e set -e
declare TOPDIR='..' declare TOPDIR='..'
@ -42,7 +40,7 @@ __write_build_cmd() { #
#----------------------------------# #----------------------------------#
( (
cat << EOF cat << EOF
@source ${TOPDIR}/envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1 @${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -50,12 +48,15 @@ EOF
#----------------------------------# #----------------------------------#
__wrt_touch() { # __wrt_touch() { #
#----------------------------------# #----------------------------------#
local pkg_name=$1 local pkg_name="${1#*-?-}"
# For having a unique id, we have added lfs- to bootscripts package.
# We need to remove it now.
case "$pkg_name" in lfs-bootscripts) pkg_name=bootscripts ;; esac
( (
cat << EOF cat << EOF
@xsltproc --stringparam packages ${PACK_FILE} \\ @xsltproc --stringparam packages ${PACK_FILE} \\
--stringparam package ${pkg_name#*-?-} \\ --stringparam package "${pkg_name}" \\
-o track.tmp \\ -o track.tmp \\
${BUMP} \$(TRACKING_FILE) && \\ ${BUMP} \$(TRACKING_FILE) && \\
sed -i 's@PACKDESC@${ATOPDIR}/packdesc.dtd@' track.tmp && \\ sed -i 's@PACKDESC@${ATOPDIR}/packdesc.dtd@' track.tmp && \\
@ -156,11 +157,19 @@ EOF
} }
if [[ ! -d ${BUILD_SCRIPTS} ]] ; then if [[ ! -d ${BUILD_SCRIPTS} ]] ; then
echo -e "\n\tThe \'${BUILD_SCRIPTS}\' directory has not been found.\n" echo -e "\n\tThe '${BUILD_SCRIPTS}' directory has not been found.\n"
exit 1
fi
# Let us make a clean base, but first ensure that we are
# not emptying a useful directory.
MYDIR=$(pwd)
MYDIR=$(basename $MYDIR)
if [ "${MYDIR#work}" = "${MYDIR}" ] ; then
echo -e \\n\\tDirectory ${BOLD}$MYDIR${OFF} does not begin with \"work\"\\n
exit 1 exit 1
fi fi
# Let us make a clean base:
rm -rf * rm -rf *
generate_Makefile generate_Makefile

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# $Id: gen-special.sh 21 2012-02-16 15:06:19Z labastie $
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# generates an xsl stylesheet containing a template for special # generates an xsl stylesheet containing a template for special
# cases in the book: # cases in the book:
@ -34,17 +32,13 @@ BLFS_DIR=$3
if test -z "${BLFS_DIR}"; then BLFS_DIR=$(cd $(dirname ${BLFS_XML})/.. ; pwd);fi if test -z "${BLFS_DIR}"; then BLFS_DIR=$(cd $(dirname ${BLFS_XML})/.. ; pwd);fi
# Packages whose version does not begin with a number # Packages whose version does not begin with a number
EXCEPTIONS=$(grep 'ENTITY.*version[ ]*"[^0-9"&.].*[0-9]' $BLFS_XML | EXCEPTIONS=$(grep 'ENTITY.*version[ ]*"[^0-9"&.].*[0-9]' ${BLFS_DIR}/packages.ent |
sed 's@^[^"]*"\([^"]*\)".*@\1@') sed 's@^[^"]*"\([^"]*\)".*@\1@')
# Non-versioned packages: # Non-versioned packages:
NV_LIST="cacerts xorg-env kde-pre-install-config kf5-intro lxqt-pre-install \ NV_LIST="postlfs-config-profile postlfs-config-random postlfs-config-vimrc \
ojdk-conf tex-path" initramfs xorg-env kde-pre-install-config kf5-intro \
lxqt-pre-install lxqt-post-install ojdk-conf tex-path"
# Set PATH to be sure to find udevadm
SAVPATH=$PATH
PATH=/bin:/sbin:/usr/bin:/usr/sbin
UDEVVERSION=$(udevadm --version)
cat >$SPECIAL_FILE << EOF cat >$SPECIAL_FILE << EOF
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
@ -54,30 +48,6 @@ cat >$SPECIAL_FILE << EOF
<xsl:template match='*' mode="special"> <xsl:template match='*' mode="special">
<xsl:choose> <xsl:choose>
<xsl:when test="contains(@id,'udev')">
<xsl:text> </xsl:text>
<package><xsl:text>&#xA; </xsl:text>
<xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
<xsl:text>&#xA; </xsl:text>
<xsl:element name="version">$UDEVVERSION</xsl:element>
<xsl:if
test="document(\$installed-packages)//package[name=current()/@id]">
<xsl:text>&#xA; </xsl:text>
<xsl:element name="inst-version">
<xsl:value-of
select="document(\$installed-packages
)//package[name=current()/@id]/version"/>
</xsl:element>
</xsl:if>
<!-- Dependencies -->
<xsl:apply-templates select=".//para[@role='required' or
@role='recommended' or
@role='optional']"
mode="dependency"/>
<!-- End dependencies -->
<xsl:text>&#xA; </xsl:text>
</package><xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Although versioned, this page is not a package. But <!-- Although versioned, this page is not a package. But
the sect2 with id "xorg-env" is referred to at several the sect2 with id "xorg-env" is referred to at several
places in the book. We have added it to the list of non places in the book. We have added it to the list of non
@ -125,6 +95,7 @@ cat >tmpfile << EOF
<xsl:template name="expand-deps"> <xsl:template name="expand-deps">
<xsl:param name="section"/> <xsl:param name="section"/>
<xsl:param name="status"/> <xsl:param name="status"/>
<xsl:param name="build"/>
<xsl:choose> <xsl:choose>
EOF EOF
for file in $(ls ${BLFS_DIR}/x/installing/x7* | grep -v x7driver); do for file in $(ls ${BLFS_DIR}/x/installing/x7* | grep -v x7driver); do
@ -145,8 +116,8 @@ EOF
# So we have to read that command too, since it may be assumed # So we have to read that command too, since it may be assumed
# that the preceding package is a dependency of the following, # that the preceding package is a dependency of the following,
# except the first. # except the first.
list_cat="$(sed -n '/>cat/,/EOF</p' $file | grep -v 'cat\|EOF' | list_cat="$(sed -n '/>cat/,/EOF</p' $file | grep -v 'cat\|EOF\|#' |
sed 's/^[^ ]*\ *\([^&]*\).*/\1/' | sed 's/-$//')" awk '{ print $NF }' | sed 's/-&.*//')"
# Rationale for the sed below: the following for breaks words at spaces (unless # Rationale for the sed below: the following for breaks words at spaces (unless
# we tweak IFS). So replace spaces with commas in lines so that only newlines # we tweak IFS). So replace spaces with commas in lines so that only newlines
@ -160,7 +131,11 @@ EOF
if [ "$i" = "$packname" ]; then break; fi if [ "$i" = "$packname" ]; then break; fi
precpack=$i precpack=$i
done done
# It may happen that packname is not in list_cat, because its entity
# is commented out in the xml, but we do not check that (too complicated).
# In that case, the whole list is scanned, and $precpack=$i at the end.
# when packname is found in the list $precpack!=$i.
if [ "$precpack" = "$i" ]; then continue; fi
cat >>$SPECIAL_FILE << EOF cat >>$SPECIAL_FILE << EOF
<module><xsl:text>&#xA; </xsl:text> <module><xsl:text>&#xA; </xsl:text>
<xsl:element name="name">$packname</xsl:element> <xsl:element name="name">$packname</xsl:element>
@ -178,6 +153,7 @@ EOF
cat >>$SPECIAL_FILE << EOF cat >>$SPECIAL_FILE << EOF
<xsl:element name="dependency"> <xsl:element name="dependency">
<xsl:attribute name="status">required</xsl:attribute> <xsl:attribute name="status">required</xsl:attribute>
<xsl:attribute name="build">before</xsl:attribute>
<xsl:attribute name="name">$precpack</xsl:attribute> <xsl:attribute name="name">$precpack</xsl:attribute>
<xsl:attribute name="type">ref</xsl:attribute> <xsl:attribute name="type">ref</xsl:attribute>
</xsl:element> </xsl:element>
@ -194,21 +170,35 @@ EOF
<!-- End dependencies --> <!-- End dependencies -->
</module> </module>
EOF EOF
cat >> tmpfile << EOF # cat >> tmpfile << EOF
<xsl:element name="dependency"> # <xsl:element name="dependency">
<xsl:attribute name="status"> # <xsl:attribute name="status">
<xsl:value-of select="\$status"/> # <xsl:value-of select="\$status"/>
</xsl:attribute> # </xsl:attribute>
<xsl:attribute name="name">$packname</xsl:attribute> # <xsl:attribute name="build">
<xsl:attribute name="type">ref</xsl:attribute> # <xsl:value-of select="\$build"/>
</xsl:element> # </xsl:attribute>
EOF # <xsl:attribute name="name">$packname</xsl:attribute>
# <xsl:attribute name="type">ref</xsl:attribute>
# </xsl:element>
#EOF
precpack=$packname
done done
cat >>$SPECIAL_FILE << EOF cat >>$SPECIAL_FILE << EOF
</package> </package>
</xsl:when> </xsl:when>
EOF EOF
cat >> tmpfile << EOF cat >> tmpfile << EOF
<xsl:element name="dependency">
<xsl:attribute name="status">
<xsl:value-of select="\$status"/>
</xsl:attribute>
<xsl:attribute name="build">
<xsl:value-of select="\$build"/>
</xsl:attribute>
<xsl:attribute name="name">$packname</xsl:attribute>
<xsl:attribute name="type">ref</xsl:attribute>
</xsl:element>
</xsl:when> </xsl:when>
EOF EOF
done done
@ -218,28 +208,57 @@ for ver_ent in $EXCEPTIONS; do
[[ -z $id ]] && continue [[ -z $id ]] && continue
cat >>$SPECIAL_FILE << EOF cat >>$SPECIAL_FILE << EOF
<xsl:when test="@id='$id'"> <xsl:when test="@id='$id'">
<xsl:text> </xsl:text> <!-- if there is a sect1 ancestor, we have a module -->
<package><xsl:text>&#xA; </xsl:text> <xsl:choose>
<xsl:element name="name">$id</xsl:element> <xsl:when test="ancestor::sect1">
<xsl:text>&#xA; </xsl:text> <xsl:text> </xsl:text>
<xsl:element name="version">$ver_ent</xsl:element> <module><xsl:text>&#xA; </xsl:text>
<xsl:if <xsl:element name="name">$id</xsl:element>
test="document(\$installed-packages)//package[name=current()/@id]"> <xsl:text>&#xA; </xsl:text>
<xsl:text>&#xA; </xsl:text> <xsl:element name="version">$ver_ent</xsl:element>
<xsl:element name="inst-version"> <xsl:if
<xsl:value-of test="document(\$installed-packages)//package[name=current()/@id]">
select="document(\$installed-packages <xsl:text>&#xA; </xsl:text>
)//package[name=current()/@id]/version"/> <xsl:element name="inst-version">
</xsl:element> <xsl:value-of
</xsl:if> select="document(\$installed-packages
)//package[name=current()/@id]/version"/>
</xsl:element>
</xsl:if>
<!-- Dependencies --> <!-- Dependencies -->
<xsl:apply-templates select=".//para[@role='required' or <xsl:apply-templates select=".//para[@role='required' or
@role='recommended' or @role='recommended' or
@role='optional']" @role='optional']"
mode="dependency"/> mode="dependency"/>
<!-- End dependencies --> <!-- End dependencies -->
<xsl:text>&#xA; </xsl:text> <xsl:text>&#xA; </xsl:text>
</package><xsl:text>&#xA;</xsl:text> </module><xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
<package><xsl:text>&#xA; </xsl:text>
<xsl:element name="name">$id</xsl:element>
<xsl:text>&#xA; </xsl:text>
<xsl:element name="version">$ver_ent</xsl:element>
<xsl:if
test="document(\$installed-packages)//package[name=current()/@id]">
<xsl:text>&#xA; </xsl:text>
<xsl:element name="inst-version">
<xsl:value-of
select="document(\$installed-packages
)//package[name=current()/@id]/version"/>
</xsl:element>
</xsl:if>
<!-- Dependencies -->
<xsl:apply-templates select=".//para[@role='required' or
@role='recommended' or
@role='optional']"
mode="dependency"/>
<!-- End dependencies -->
<xsl:text>&#xA; </xsl:text>
</package><xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when> </xsl:when>
EOF EOF
done done

View file

@ -1,31 +1,54 @@
#!/bin/bash #!/bin/bash
# #
# $Id$
#
# Read and parse the configuration parameters.. # Read and parse the configuration parameters..
# #
set -e set -e
TOPDIR=$1 TRACKFILE=$1
if test -z "$TRACKFILE"; then
TRACKFILE=tracking-dir/instpkg.xml
fi
TOPDIR=$2
if test -z "$TOPDIR"; then if test -z "$TOPDIR"; then
TOPDIR=$(pwd) TOPDIR=$(pwd)
fi fi
BLFS_FULL=$2 BLFS_FULL=$3
if test -z "$BLFS_FULL"; then if test -z "$BLFS_FULL"; then
BLFS_FULL=${TOPDIR}/blfs-xml/tmp/blfs-full.xml BLFS_FULL=${TOPDIR}/blfs-xml/tmp/blfs-full.xml
fi fi
LFS_FULL=$4
if test -z "$LFS_FULL"; then
LFS_FULL=${TOPDIR}/lfs-xml/tmp/lfs-full.xml
fi
declare -r ConfigFile="${TOPDIR}/configuration" declare -r ConfigFile="${TOPDIR}/configuration"
declare DepDir="${TOPDIR}/dependencies" declare DepDir="${TOPDIR}/dependencies"
declare LibDir="${TOPDIR}/libs" declare LibDir="${TOPDIR}/libs"
declare PackFile="${TOPDIR}/packages.xml" declare PackFile="${TOPDIR}/packages.xml"
declare BookXml="${TOPDIR}/book.xml" declare BookXml="${TOPDIR}/book.xml"
declare MakeBook="${TOPDIR}/xsl/make_book.xsl" declare MakeBook="${TOPDIR}/xsl/make_book.xsl"
declare GetVersion="${TOPDIR}/xsl/get_version.xsl"
declare MakeScripts="${TOPDIR}/xsl/scripts.xsl" declare MakeScripts="${TOPDIR}/xsl/scripts.xsl"
declare ListLFS="${TOPDIR}/xsl/list_lfs.xsl"
declare BookHtml="${TOPDIR}/book-html" declare BookHtml="${TOPDIR}/book-html"
declare BLFS_XML="${TOPDIR}/blfs-xml" declare BLFS_XML="${TOPDIR}/blfs-xml"
declare -a TARGET declare -a TARGET
declare DEP_LEVEL declare DEP_LEVEL
declare SUDO declare SUDO
declare LANGUAGE
declare WRAP_INSTALL
declare PACK_INSTALL
declare DEL_LA_FILES
declare STATS
declare DEP_CHECK
declare SRC_ARCHIVE
declare SRC_SUBDIRS
declare BUILD_ROOT
declare BUILD_SUBDIRS
declare KEEP_FILES
declare -i JOBS
declare CFG_CFLAGS
declare CFG_CXXFLAGS
declare CFG_LDFLAGS
#--------------------------# #--------------------------#
parse_configuration() { # parse_configuration() { #
@ -44,7 +67,22 @@ parse_configuration() { #
# Create global variables for these parameters. # Create global variables for these parameters.
optDependency=* | \ optDependency=* | \
MAIL_SERVER=* | \ MAIL_SERVER=* | \
SUDO=* ) eval ${REPLY} # Define/set a global variable.. WRAP_INSTALL=* | \
PACK_INSTALL=* | \
DEL_LA_FILES=* | \
STATS=* | \
DEP_CHECK=* | \
LANGUAGE=* | \
SUDO=* | \
SRC_ARCHIVE=* | \
SRC_SUBDIRS=* | \
BUILD_ROOT=* | \
BUILD_SUBDIRS=* | \
KEEP_FILES=* | \
JOBS=* | \
CFG_CFLAGS=* | \
CFG_CXXFLAGS=* | \
CFG_LDFLAGS=* ) eval ${REPLY} # Define/set a global variable..
continue ;; continue ;;
esac esac
@ -62,13 +100,18 @@ parse_configuration() { #
TARGET=(${optTARGET[*]}) TARGET=(${optTARGET[*]})
DEP_LEVEL=$optDependency DEP_LEVEL=$optDependency
SUDO=${SUDO:-n} SUDO=${SUDO:-n}
WRAP_INSTALL=${WRAP_INSTALL:-n}
DEL_LA_FILES=${DEL_LA_FILES:-n}
STATS=${STATS:-n}
# Other boolean variables are supposed to be either set or unset. Their values
# are not relevant
} }
#--------------------------# #--------------------------#
validate_configuration() { # validate_configuration() { #
#--------------------------# #--------------------------#
local -r dotSTR=".................." local -r dotSTR=".................."
local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER" local -r PARAM_LIST="DEP_LEVEL SUDO LANGUAGE MAIL_SERVER WRAP_INSTALL PACK_INSTALL DEL_LA_FILES STATS DEP_CHECK SRC_ARCHIVE SRC_SUBDIRS BUILD_ROOT BUILD_SUBDIRS KEEP_FILES JOBS CFG_CFLAGS CFG_CXXFLAGS CFG_LDFLAGS"
local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}' local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
local config_param local config_param
local -i index local -i index
@ -85,18 +128,15 @@ validate_configuration() { #
# Generates the root of the dependency tree # Generates the root of the dependency tree
# #
#--------------------------# #--------------------------#
generate_deps() { # generate_deps() { #
#--------------------------# #--------------------------#
local -i index local -i index
local DepDir=$1 local DepDir=$1
rm -f $DepDir/*.{o,}dep rm -f $DepDir/*.{tree,dep}
for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
echo 1 ${TARGET[${index}]} >> $DepDir/root.odep echo 1 b ${TARGET[${index}]} >> $DepDir/root.dep
done done
echo 1 > $DepDir/root.dep
echo 1 >> $DepDir/root.dep
cat $DepDir/root.odep >> $DepDir/root.dep
} }
# #
@ -147,14 +187,65 @@ mkdir $DepDir
generate_deps $DepDir generate_deps $DepDir
pushd $DepDir > /dev/null pushd $DepDir > /dev/null
set +e set +e
generate_dependency_tree root.dep 1 generate_subgraph root.dep 1 1 b
echo echo -e "\n${SD_BORDER}"
LIST="$(tree_browse root.dep)" echo Graph contains $(ls |wc -l) nodes
echo -e "${SD_BORDER}"
echo Cleaning subgraph...
clean_subgraph
echo done
echo Generating the tree
echo 1 > root.tree
echo 1 >> root.tree
cat root.dep >> root.tree
generate_dependency_tree root.tree 1
echo -e "\n${SD_BORDER}"
echo Generating the ordered full dependency list
FULL_LIST="$(tree_browse root.tree)"
set -e set -e
popd > /dev/null popd > /dev/null
#echo "$FULL_LIST"
#echo -e \\n provisional end...
#exit
echo Generating the ordered package list
LIST=
while read p; do
if [ "$p" != "${p%-pass1}" ]; then
# If the pass2 is installed, no need for pass1. We get its
# installed version from TRACKFILE; We could use PackFile, but
# the test would be slightly more complicated.
echo Treating $p
pass2_v=$(xsltproc --stringparam package "${p%-pass1}" \
$GetVersion $TRACKFILE | head -n1)
echo Found pass2_v=$pass2_v
if [ -n "$pass2_v" ]; then continue; fi
# We need to get the installed version from TRACKFILE
inst_v=$(xsltproc --stringparam package "$p" $GetVersion $TRACKFILE | \
head -n1)
if [ -z "$inst_v" ]; then inst_v=0; fi
echo Found inst_v=$inst_v
# The available version is taken from PackFile
avail_v=$(xsltproc --stringparam package "${p%-pass1}" \
$GetVersion $PackFile | head -n1)
echo Found avail_v=$avail_v
versions="$avail_v
$inst_v"
echo which gives versions=$versions
else
versions=$(xsltproc --stringparam package "$p" $GetVersion $PackFile)
fi
if [ "$versions" != "$(sort -V <<<$versions)" ]; then
LIST="$LIST $p"
fi
done <<<$FULL_LIST
#echo \""$LIST"\"
#echo -e \\n provisional end...
#exit
rm -f ${BookXml} rm -f ${BookXml}
echo Making XML book echo Making XML book
xsltproc --stringparam list "$LIST" \ xsltproc --stringparam list "$LIST" \
--stringparam MTA "$MAIL_SERVER" \
--stringparam lfsbook "$LFS_FULL" \
-o ${BookXml} \ -o ${BookXml} \
${MakeBook} \ ${MakeBook} \
$BLFS_FULL $BLFS_FULL
@ -177,12 +268,79 @@ for ht in ${BookHtml}/*.html
done done
echo -en "\n\tGenerating the build scripts ...\n" echo -en "\n\tGenerating the build scripts ...\n"
rm -rf scripts rm -rf scripts
xsltproc --xinclude --nonet \ if test $STATS = y; then
--stringparam sudo $SUDO \ LIST_STAT="${TARGET[*]}"
-o ./scripts/ ${MakeScripts} \ else
LIST_STAT=""
fi
xsltproc --xinclude --nonet \
--stringparam language "$LANGUAGE" \
--stringparam sudo "$SUDO" \
--stringparam wrap-install "$WRAP_INSTALL" \
--stringparam pack-install "$PACK_INSTALL" \
--stringparam del-la-files "$DEL_LA_FILES" \
--stringparam list-stat "$LIST_STAT" \
--stringparam src-archive "$SRC_ARCHIVE" \
--stringparam src-subdirs "$SRC_SUBDIRS" \
--stringparam build-root "$BUILD_ROOT" \
--stringparam build-subdirs "$BUILD_SUBDIRS" \
--stringparam keep-files "$KEEP_FILES" \
--param jobs "$JOBS" \
--stringparam cfg-cflags "$CFG_CFLAGS" \
--stringparam cfg-cxxflags "$CFG_CXXFLAGS" \
--stringparam cfg-ldflags "$CFG_LDFLAGS" \
--stringparam fqdn "$(hostname -f)" \
--output ./scripts/ \
${MakeScripts} \
${BookXml} ${BookXml}
# Make the scripts executable. # Make the scripts executable.
chmod -R +x scripts chmod -R +x scripts
echo -e "done\n" echo -e "done\n"
if [ -n "$DEP_CHECK" ]; then
if (( ${#TARGET[*]} != 1 )); then
printf "\nWARNING: If dependencies are checked, only one package\n"
printf " shoud be selected. Not generating check code.\n"
exit
fi
LIST_LFS="$(xsltproc $ListLFS $LFS_FULL)"
LIST_NEEDED="$(echo $FULL_LIST)"
LIST_INSTALLED="$(porg -a | sed 's/-[[:digit:]].*//')"
LIST_UNNEEDED=
for p in $LIST_INSTALLED; do
case " $LIST_LFS " in *" $p "*) continue ;; esac
case " $LIST_NEEDED " in *" $p "*) continue ;; esac
LIST_UNNEEDED="$LIST_UNNEEDED $p"
done
cat >head.tmp <<EOF
#!/bin/bash
set -e
# Remove all unneeded packages
VERSIONED_LIST=
for p in $LIST_UNNEEDED; do
VERSIONED_LIST="\$VERSIONED_LIST \$(porg \$p)"
sudo porg -rb \$p
done
# Function to restore packages
restore_pack () {
for p in \$VERSIONED_LIST; do
sudo porgball -e -l /var/lib/packages/\${p}.porg.tar.gz
done
}
trap restore_pack ERR
EOF
cat >tail.tmp <<EOF
restore_pack
exit
EOF
sed -e "1,2d" -e '$d' scripts/*${TARGET} >script.tmp
cat head.tmp script.tmp tail.tmp >scripts/*${TARGET}
rm *.tmp
fi
#clean_configuration #clean_configuration

View file

@ -2,7 +2,6 @@
# #
# common constants # common constants
# #
# $Id$
##### #####

View file

@ -1,38 +1,145 @@
#!/bin/bash #!/bin/bash
# #
# $Id$
#
#---------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# This is a set of (recursive) functions for manipulating a dependency # # This is a set of (recursive) functions for manipulating a dependency graph. #
# tree. Everything would be "simple" without circular dependencies. We # # We use algorithms and definitions from chapter 4 (mainly section 4.2) of #
# would just have to build the tree using the packages.xml file, and to # # https://algs4.cs.princeton.edu/. The graph we manipulate is the directed #
# provide a function for browsing it. But we need to be able to detect # # graph of the dependencies: nodes are packages in the BLFS book. A node A is #
# circular dependencies and to possibly change the tree depending on # # connected to a node B if package A depends on B. A topological order (rev- #
# priorities. This is why we keep with each node a record of the path # # erted) is exactly what we want for a build order. But a topological order #
# from the root to the node, which we call *link* and a record of the # # only exists if the graph is acyclic. We'll therefore have to remove cycles. #
# successive priorities which we call *priolink*. # # There are a number of other features we want to consider: #
# # # - edges are weighted according to the dependency requirement: #
# Layout of the tree: # # 1 for required #
# # # 2 for recommended #
# A node of the tree is represented by a file <nodeName>.dep. We keep all # # 3 for optional #
# those files in the same directory. The root node file is "root.dep". # # 4 for external #
# Files <nodeName>.dep have the following layout: # # We should consider only edges with weight lower or equal to that #
# - the first line is the link: the link is an array of numbers # # specified by the user, but see below. #
# (n1 n2 ... nN), describing the path from the root to <nodeName>: n1 # # - we do not want to build the whole book. The user requests a set of #
# is the position of the first node of the path in root.dep, n2 is the # # packages, and we'd like to consider only nodes reachable from this set #
# position of the second node of the path in <node1>.dep and so on. The # # using edges of weight not exceeding the specified weight. #
# link is not needed for normal tree operations (building a subtree or # # - we do not want to rebuild packages already built. But we still have to #
# browsing the tree), but it allows to check whether a dependency is # # generate the full dependency graph, because if A depends on B, which is #
# circular, and to find its parent. # # already built, and B depends on C, which is not built, or needs to be #
# - the second line is an array of priorities (p1 p2 ... pN), giving the # # updated, then A may depends on C. We therefore have to remove already #
# priority (1=required, 2=recommended, 3=optional) of each dependency # # built (and up to date) packages from the graph, but need to keep the #
# in the link. # # dependency chain. #
# - each subsequent line is of the form "p <depname>", where p is the # # - when doing the topological sort, we want to consider all the edges and #
# priority as above, and <depname> is the name of the dependency. The # # not only those not exceeding the specified weight: If a package A in the #
# position which is recorded in the link is the number of the line # # reachable subgraph depends optionally on another package B in the same #
# minus 2. # # subgraph, we want to build B before A if possible. But this means we'll #
# # # have to remove cycles for all weights. #
# - dependencies have another qualifier: before, after, or first. We use #
# it as follows: for "after", we can build the dependency after the #
# package, but if a package A depends on B with an "after" qualifier, and #
# a package C depends on A with a "before" qualifier, C may need B to be #
# able to use A. So the only safe way to consider "after" qualifiers is to #
# consider that they are "before" deps for any parent of the packages #
# considered. There is an exception to that rule: if B depends on C #
# (possibly through a chain of several dependencies), then C should still #
# be built before B. For "after", the dependency has to be built both #
# before and after the package. So we duplicate the dependency as a #
# "-pass1" package, and change the graph accordingly. #
# We'll therefore have a 3 pass procedure. First build the set of nodes #
# reachable from the root set. Second, remove dangling edges (those pointing #
# to packages outside the node set), and move "after" edges to "before" edges #
# originating from the parents as well as creating the "-pass1" nodes. Third #
# remove cycles and generate a topological sort. #
# #
# Pass 1: graph generation #
# ======================== #
# Data layout for pass 1 #
# ---------------------- #
# A node of the graph is represented by a text file <nodeName>.dep. Each edge #
# starting from this node is represented by a line in this file. We keep #
# those files in the same directory. We introduce a special node named root, #
# whose edges point to the list of nodes requested by the user. Each line #
# contains three fields: #
# - the weight of the edge #
# - the qualifier: "before" (b), "after" (a), or "first" (f) #
# - the name of the destination of the edge (without the ".dep" extension) #
# #
# Recursive function "generate_subgraph" #
# -------------------------------------- #
# This function treats a node of the graph that is not a leaf and that is #
# seen for the first time in the DFS. The dependencies of this node are #
# known, and stored in a .dep file. For each dependency in that file, there #
# are three cases: #
# - the weight of the edge leading to that dependency is higher than #
# requested. This dependency is discarded (some information printed) #
# - the weight of the edge is lower or equal to requested, but the node #
# has already been visited (the .dep file exists). Discard too (some #
# information printed) #
# - the weight of the edge is lower or equal to requested, and the node #
# has not been seen: then the dependencies of that node are generated, #
# and there are two cases: #
# - the node has no dependencies: just create an empty .dep file, so #
# that we know the node has been visited #
# - the node has dependencies: call generate_subgraph for that node #
# #
# This function takes four parameters: #
# - The node filename: this is the only one useful for the algorithm #
# - The depth: number of steps starting from root (for pretty print only) #
# - The weight of the edge leading to that node (for printing) #
# - The qualifier (for printing) #
# #
# Pass 2: graph transformation #
# ============================ #
# We now have three loops over nodes of the graph #
# Loop 1: Remove dead edges #
# ------------------------- #
# Since some nodes have not been created because the edges leading to them #
# had too high a weight, those edges have to be suppressed. #
# For each existing node file, we make a list of lines to remove by #
# testing whether the destination exists. We then remove the lines. #
# Another approach would be to make a temporary file and output only #
# lines that should stay, then rename the file. This would save a loop. #
# All in all it is an N*e process, where N is the number of nodes and e #
# the average number of edges originating from a node. #
# Loop 2: Treat "after" edges #
# --------------------------- #
# If a node is the origin of edges qualified as "after", we want the #
# nodes which are the destination of those edges to be built after #
# the origin node, but before any node that depend on the origin #
# node. For that, the general rule is to change: #
# P---b--->A---a--->D #
# to: #
# P---b--->Agroupxx---b--->A #
# | #
# ---b--->D #
# But there is a problem if D depends on P, possibly through a chain, #
# because we create a cycle which shouldn't exist. If this is the case, #
# we leave A as a dependency of P: #
# P---b--->A #
# #
# Agroupxx---b--->A #
# | #
# ---b--->D #
# Doing so, it may happen that Agroupxx has no parent. We then add #
# Agroupxx as a dependency of root. The problem with this algorithm is #
# the search for paths from D to A, which may be exponential in the #
# number of nodes in the graph. #
# #
# Loop 3: Add -pass1 nodes #
# ------------------------ #
# Sometimes there is no way to escape a cycle. A package A needs B, and B #
# needs A. In that case, it is often possible to build a degraded version #
# of package A, then B, then rebuild A. The book indicates this with the #
# following dependency chain, using a qualifier of "first": #
# B---f--->A---b--->X...Y---b--->B #
# where the X...Y notation represents a chain of dependencies from A to B. #
# So the third loop is over nodes containing "f" qualifiers, and does the #
# following: it creates a new node A-pass1, which is a copy of A, and #
# remove from A-pass1 all the dependencies leading to B through a chain, #
# to obtain: #
# A---b--->X...Y---b--->B---b--->A-pass1 #
# It may then happen that nothing depends on A. So this is tested, and A #
# is added to the root node if it is orphaned. #
# TODO: document the third pass #
# TODO: needs also to document the .tree files #
# TODO: The following is obsolete #
# Circular dependencies: # # Circular dependencies: #
# # # #
# In case we find a cirdular dependency, it has the form : # # In case we find a cirdular dependency, it has the form : #
@ -51,9 +158,283 @@
# Global variables: # Global variables:
# A string of spaces for indenting: # A string of spaces for indenting:
declare -a spaceSTR=" " declare -a spaceSTR=" "
# When we are backing up from a circular dependency, `exchange_triplet' # When we are backing up from a circular dependency, `parentNode'
# shall contain (parent dependency_0 dependency_n): # contains the node which has an edge entering the cycle
declare -a exchange_triplet declare parentNode
#---------------------#
generate_subgraph() { #
#---------------------#
: <<inline_doc
function: Create a subgraph of all the nodes reachable from the node
represented by the file whose name is $1. The edges considered
are those with maximal weight DEP_LEVEL (recursive function).
input vars: $1 : file name corresponding to the node whose edges will be
followed for the DFS
$2 : weight of the edge leading to this node
$3 : depth (root is 1)
$4 : qualifier (a for after, b for before, f for first)
externals: vars: DEP_LEVEL contains 1 if we want to build the
tree only for required dependencies,
2 if we want also recommended ones,
3 if we want also optional ones, but only
for the requested packages,
4 if we want all the dependencies
(excluding external of course)
MAIL_SERVER contains the name of the MTA we want to use.
files: ../xsl/dependencies.xsl: stylesheet for creating the
.dep files
../packages.xml: File containing packages id
and dependencies
returns: 0 if the tree has been successfully created
output: files: for each node reachable from $1, a file <node>.dep.
on error: nothing
on success: nothing
inline_doc
local depFile=$1
local -i weight=$2
local -i depth=$3
local qualifier=$4
local -i spacing=0
local priostring
local buildstring
local id_of_dep
local prio_of_dep
local build_of_dep
local dep_level
if (( depth < 10 )); then spacing=1; fi
case $weight in
1) priostring=required ;;
2) priostring=recommended ;;
3) priostring=optional ;;
esac
case $qualifier in
a) buildstring=runtime ;;
b|f) buildstring= ;;
esac
dep_level=$DEP_LEVEL
if [ "$dep_level" = 3 ] && [ "$depth" -gt 2 ]; then dep_level=2; fi
if [ "$dep_level" -gt 3 ]; then dep_level=3; fi
echo -en "\nNode: $depth${spaceSTR:0:$(( depth + spacing ))}${RED}${depFile%.dep}${OFF} $priostring $buildstring"
depth=$(( depth + 1 ))
if (( depth < 10 )); then spacing=1; else spacing=0; fi
# Start of loop
{
while read prio_of_dep build_of_dep id_of_dep; do
case $prio_of_dep in
1) priostring=required ;;
2) priostring=recommended ;;
3) priostring=optional ;;
4) priostring=external ;;
esac
case $build_of_dep in
a ) buildstring=runtime ;;
b|f) buildstring= ;;
esac
# Has this entry already been seen?
# TODO: no there is no special case!
# We have a special case here: if the entry has been seen at depth > 2
# and now depth=2 and DEP_LEVEL=3, optional deps have not been processed.
# If this is the case, just consider it has not been seen.
if [ -f ${id_of_dep}.dep ] ; then
case $depth$DEP_LEVEL in
23) ;;
*)
# Just display it and proceed.
echo -en "\nEdge: $depth${spaceSTR:0:$((depth + spacing))}${MAGENTA}${id_of_dep}${OFF} $priostring $buildstring"
continue
;;
esac
fi
# Is the weight higher than requested?
if [ "$prio_of_dep" -gt $dep_level ]; then
# Just display it and proceed.
echo -en "\n Out: $depth${spaceSTR:0:$((depth + spacing))}${YELLOW}${id_of_dep}${OFF} $priostring $buildstring"
continue
fi
# Otherwise, let's build the corresponding subgraph.
xsltproc --stringparam idofdep "$id_of_dep" \
--stringparam MTA "$MAIL_SERVER" \
-o ${id_of_dep}.dep \
../xsl/dependencies.xsl ../packages.xml
if [[ -s ${id_of_dep}.dep ]]; then # this dependency has dependencies
generate_subgraph ${id_of_dep}.dep $prio_of_dep $depth $build_of_dep
else # id_of_dep has no dependencies, just touch the file and display
touch ${id_of_dep}.dep
echo -en "\nLeaf: $depth${spaceSTR:0:$((depth + spacing))}${CYAN}${id_of_dep}${OFF} $priostring $buildstring"
fi
done
} <$depFile
depth=$(( depth - 1 ))
if (( depth < 10 )); then spacing=1; else spacing=0; fi
echo -en "\n End: $depth${spaceSTR:0:$((depth + spacing))}${GREEN}${depFile%.dep}${OFF}"
return 0
}
#-----------#
path_to() { #
#-----------#
: <<inline_doc
function: check whether there is a path from $1 to $2 on the graph
input vars: $1 contains the filename of the starting node.
$2 contains the name of the node to reach
$3 contains the weight above which we do not want to
follow an edge
$seen (global) contains the list of already seen nodes.
It must ve set to " " prior to calling the function
returns: 0 if the node has been found
1 if not
on error: nothing
on success: nothing
inline_doc
local start=$1
local seek=$2
local prio=$3
local prio_of_dep
local build_of_dep
local id_of_dep
local r
if test "${start%.dep}" = "$seek"; then return 0; fi
seen="$seen${start%.dep} "
if test -s $start; then
{
while read prio_of_dep build_of_dep id_of_dep; do
if test "$prio" -lt "$prio_of_dep"; then continue; fi
if ! test "${seen% $id_of_dep *}" = "$seen"; then continue; fi
if path_to ${id_of_dep}.dep $seek $prio; then return 0; fi
done
} < $start
fi
return 1
}
#------------------#
clean_subgraph() { #
#------------------#
: <<inline_doc
function: Remove dangling edges and create groups of deps for "after"
deps: A-before->B-after->C becomes:
A -before-> Bgroupxx -before-> B
\
-before-> C
the name of the group is chosen so that it is unlikely as
a package name (so that it is removed when building the
xml book).
Also change the "first" qualifier so that a cycle:
A -first-> B ---chain---> A becomes:
B ---chain---> A -before-> B-pass1
and we remove all the dependencies which have a chain to
A in B-pass1.
Since we do not change anything else, it may happen that
nothing depends on B. In that case, B is appended to root.
input vars: None
files: <node>.dep files containing dangling edges and
"after" qualifiers
returns: 0
output: files: <node>.dep files containing no dangling edges and
no "after" qualifiers
on error: nothing
on success: nothing
inline_doc
local node
local id_of_dep
local prio_of_dep
local build_of_dep
local lines_to_remove
local lines_to_change
local parent
local p
local b
local start
local seen
for node in $(ls *.dep); do
if test $node = root.dep; then continue; fi
echo Cleaning $node
lines_to_remove=
{
while read prio_of_dep build_of_dep id_of_dep; do
if ! test -f ${id_of_dep}.dep; then
lines_to_remove="$lines_to_remove $id_of_dep"
continue
fi
done
} <$node
for id_of_dep in $lines_to_remove; do
sed "/\ $id_of_dep\$/d" -i $node
done
done
for node in $(grep -l ' a ' *.dep); do
lines_to_remove=
echo Process "runtime" deps in $node
if ! [ -e ${node%.dep}groupxx.dep ]; then
b=0 # Nothing depends on <node>groupxx
for parent in $(grep -l ${node%.dep}\$ *); do
p=0 # No "after" dependency depends on this parent
for start in $(grep ' a ' $node | cut -d' ' -f3); do
seen=" " # global variable used in "path_to"
if path_to ${start}.dep ${parent%.dep} 3; then p=1; break; fi
done
if test $p = 0; then
b=1
sed -i "s/\ ${node%.dep}\$/&groupxx/" $parent
fi
done
echo "1 b ${node%.dep}" > ${node%.dep}groupxx.dep
if test $b = 0; then echo "1 b ${node%.dep}groupxx" >> root.dep; fi
fi
{
while read prio_of_dep build_of_dep id_of_dep; do
if test $build_of_dep = a; then
if ! grep -q ${id_of_dep} ${node%.dep}groupxx.dep; then
echo "$prio_of_dep b ${id_of_dep}" >> ${node%.dep}groupxx.dep
fi
lines_to_remove="$lines_to_remove $id_of_dep"
fi
done
} <$node
for id_of_dep in $lines_to_remove; do
sed "/a\ $id_of_dep\$/d" -i $node
done
done
for node in $(grep -l ' f ' *); do
echo Process "first" deps in $node
lines_to_change=
{
while read prio_of_dep build_of_dep id_of_dep; do
if test $build_of_dep = f; then
if ! test -f ${id_of_dep}-pass1.dep; then
cp ${id_of_dep}{,-pass1}.dep;
fi
lines_to_change="$lines_to_change $id_of_dep"
unset lr # lines to remove in -pass1
{
while read p b start; do
seen=" " # global variable used in "path_to"
if path_to ${start}.dep ${node%.dep} $p; then
lr="$lr $start"
fi
done
} < ${id_of_dep}-pass1.dep
for p in $lr; do
sed "/\ $p\$/d" -i ${id_of_dep}-pass1.dep
done
fi
done
} <$node
for id_of_dep in $lines_to_change; do
sed "/\ $id_of_dep\$/"'{s/[[:digit:]] f /1 b /;s/$/-pass1/}' -i $node
if ! grep -q " $id_of_dep\$" *.dep; then
echo 1 b $id_of_dep >>root.dep
fi
done
done
} # End clean_subgraph
#----------------------------# #----------------------------#
generate_dependency_tree() { # generate_dependency_tree() { #
@ -62,27 +443,24 @@ generate_dependency_tree() { #
function: Create a subtree of the dependency tree function: Create a subtree of the dependency tree
(recursive function) (recursive function)
input vars: $1 : file with a list of targets (child nodes) input vars: $1 : file with a list of targets (child nodes)
the first line of the file is the link the first line of the file is the link
$2 : priority (1=req, 2=rec, 3=opt) $2 : priority (1=req, 2=rec, 3=opt)
externals: vars: DEP_LEVEL contains 1 if we want to build the
tree only for required dependencies,
2 if we want also recommended ones,
and 3 if we want optional ones too.
MAIL_SERVER contains the name of the MTA we want to use.
files: ../xsl/dependencies.xsl: stylesheet for creating the
.dep files
../packages.xml: File containing packages id
and dependencies
returns: 0 if the tree has been successfully created returns: 0 if the tree has been successfully created
1 if we are backing up to the parent of a circular dep 1 if we are backing up to the parent of a circular dep
modifies: vars: exchange_triplet contains the triplet when return is 1 and there are only required deps in the cycle
2 if we are backing up to the parent of a circular dep
and there are recommended deps and no optional deps in the
cycle
3 if we are backing up to the parent of a circular dep
and there are optiional deps in the cycle
modifies: vars: parentNode is set when return is not 0
output: files: for each <pkg> with dependencies in $1, output: files: for each <pkg> with dependencies in $1,
a file <pkg>.dep and its dependencies a file <pkg>.tree and its dependencies
on error: nothing on error: nothing
on success: nothing on success: nothing
inline_doc inline_doc
local DepFile=$1 local depFile=$1
local priority=$2 local priority=$2
local -a rootlink local -a rootlink
local -a priolink local -a priolink
@ -90,156 +468,113 @@ local -a otherlink
local -i depth local -i depth
local -i count=0 local -i count=0
local id_of_dep local id_of_dep
local build_of_dep
local prio_of_dep
local parent local parent
local lines_to_remove= local lines_to_remove=
local srootlink local srootlink
local dep_level
local priostring local priostring
local dpriostring local dpriostring
local i local i
{ {
# We use fd number 6 for input from DepFile, because we need 0 for user input read -a rootlink
read -u6 -a rootlink
depth=${#rootlink[*]} depth=${#rootlink[*]}
read -u6 -a priolink read -a priolink
dep_level=$DEP_LEVEL
# For now, process optional deps only for the root packages.
if (( $DEP_LEVEL > 2 )) && (( $depth > 1 )); then dep_level=2; fi
srootlink="${rootlink[*]} " srootlink="${rootlink[*]} "
case $priority in case $priority in
1) priostring=required ;; 1) priostring=required ;;
2) priostring=recommended ;; 2) priostring=recommended ;;
3) priostring=optional ;; 3) priostring=optional ;;
4) priostring=external ;;
esac esac
# start of DepFile # start of depFile
echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}$DepFile${OFF} $priostring" echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}${depFile%.tree}${OFF} $priostring"
while read -u6 prio_of_dep id_of_dep; do while read prio_of_dep build_of_dep id_of_dep; do
case $prio_of_dep in case $prio_of_dep in
1) dpriostring=required ;; 1) dpriostring=required ;;
2) dpriostring=recommended ;; 2) dpriostring=recommended ;;
3) dpriostring=optional ;; 3) dpriostring=optional ;;
4) dpriostring=external ;; esac
esac
# count entries in file # count entries in file
(( count++ )) (( count++ ))
# Has this entry already been seen? # Has this entry already been seen?
if [ -f ${id_of_dep}.dep ]; then # found ${id_of_dep}.dep already in tree if [ -f ${id_of_dep}.tree ]; then # found ${id_of_dep}.tree already in tree
otherlink=($(head -n 1 ${id_of_dep}.dep)) otherlink=($(head -n 1 ${id_of_dep}.tree))
if [ -z "${otherlink[*]}" ] if [ -z "${otherlink[*]}" ]
then echo otherlink empty for $id_of_dep.dep then echo otherlink empty for $id_of_dep.tree
echo This should not happen, but happens to happen... echo This should not happen, but happens to happen...
exit 1 exit 1
fi fi
# Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11) #Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11)
# and otherlink=(1 1) # and otherlink=(1 1)
if [[ ${srootlink#"${otherlink[*]} "} != ${srootlink} ]]; then # cir. dep if [[ ${srootlink#"${otherlink[*]} "} != ${srootlink} ]]; then # cir. dep
echo -en "\nCirc: $((depth+1))${spaceSTR:0:$((depth+1))}${YELLOW}${id_of_dep}${OFF} $dpriostring" echo -en "\nCirc: $((depth+1))${spaceSTR:0:$((depth+1))}${YELLOW}${id_of_dep}${OFF} $dpriostring"
# First look for the other parent of this dependency. # Find lowest priority in branch from parent to depFile:
# The parent has the same link without the last entry.
# We do not need otherlink anymore so just destroy the last element
unset otherlink[-1]
parent=$(grep ^"${otherlink[*]}"\$ -l *)
parent=${parent%.dep}
# Find lowest priority in branch from parent to DepFile:
p2=0 p2=0
for (( i=${#otherlink[*]}; i < $depth ; i++ )) ; do for (( i=${#otherlink[*]}; i < $depth ; i++ )) ; do
if (( ${priolink[i]} > $p2 )); then p2=${priolink[i]}; fi if (( ${priolink[i]} > $p2 )); then p2=${priolink[i]}; fi
done done
if (( $prio_of_dep >= $p2 )); then # prune if (( $prio_of_dep >= $p2 )); then # prune
lines_to_remove="$lines_to_remove $id_of_dep" lines_to_remove="$lines_to_remove $id_of_dep"
sed -i "/$id_of_dep/d" ${DepFile/.dep/.odep} sed -i "/$id_of_dep/d" ${depFile/.tree/.dep}
else #backup with prio priority else # find and set parent, then return lowest priority
exchange_triplet=($parent $id_of_dep ${DepFile%.dep}) # The parent has the same link without the last entry.
return $priority # We do not need otherlink anymore so just destroy the last element
unset otherlink[-1]
# We cannot use grep -l, because we need to restrict to the first line,
# since the prio line may match
for f in *.tree; do
if head -n1 $f | grep -q ^"${otherlink[*]}"\$; then
parentNode=$f; break
fi
done
return $p2
fi fi
else # not circular: prune tree (but not .odep, since it may happen that else # not circular: prune tree (but not .dep, since it may happen that
# the tree is destroyed and rebuilt in another order) # the tree is destroyed and rebuilt in another order)
lines_to_remove="$lines_to_remove $id_of_dep" lines_to_remove="$lines_to_remove $id_of_dep"
fi # circular or not fi # circular or not
continue # this dependency has already been seen, and the associated continue # this dependency has already been seen, and the associated
# subtree computed. We are done # subtree computed. We are done
fi # Has this entry already been seen? fi # Has this entry already been seen?
# So, this entry has not already been seen. # So, this entry has not already been seen. Let's build the corresponding
# If this is an external dep, just display it and go to next dep: # subtree. First check there is a subtree...
if [ "$prio_of_dep" -eq 4 ]; then # Use -s, because it may happen that after removing lines, .dep exists
echo "${rootlink[*]} $count" > ${id_of_dep}.dep
echo -en "\nLeaf: $(($depth+1))${spaceSTR:0:$(($depth+1))}${CYAN}${id_of_dep}${OFF} $dpriostring"
continue
fi
# Otherwise, let's build the corresponding
# subtree. Since decisions about circular deps can lead us to start again
# dependencies, we restart until the flag is false.
flag=true
while [ $flag = true ]; do
flag=false
if [ ! -f "${id_of_dep}.odep" ]; then
xsltproc --stringparam dependencies ${dep_level} \
--stringparam idofdep $id_of_dep \
--stringparam MTA $MAIL_SERVER \
-o ${id_of_dep}.odep \
../xsl/dependencies.xsl ../packages.xml
fi
# Use -s, because it may happen that after removing lines, .odep exists
# but is empty. # but is empty.
if [[ -s ${id_of_dep}.odep ]]; then # this dependency has dependencies if [[ -s ${id_of_dep}.dep ]]; then # this dependency has dependencies
sed "1i${rootlink[*]} $count\\ sed "1i${rootlink[*]} $count\\
${priolink[*]} $prio_of_dep" < ${id_of_dep}.odep \ ${priolink[*]} $prio_of_dep" < ${id_of_dep}.dep \
> ${id_of_dep}.dep # add link and priolink > ${id_of_dep}.tree # add link and priolink
generate_dependency_tree ${id_of_dep}.dep $prio_of_dep generate_dependency_tree ${id_of_dep}.tree $prio_of_dep
# Test return value, in case we exchange dependencies # Test return value, in case we exchange dependencies
p2=$? p2=$?
case $p2 in case $p2 in
0) # Normal return 0) # Normal return
;; ;;
[123]) # We are backing up to parent $prio_of_dep) # we remove this dep, but since it may become unreachable,
if [[ ${exchange_triplet} == ${DepFile%.dep} ]] ; then # move it to be built later (as a dep of parent).
# We are the parent! tree_erase ${id_of_dep}.tree
# First, we have to find the parent of our new direct dep, and remove lines_to_remove="$lines_to_remove $id_of_dep"
# the new direct dep from the parent.odep: sed -i "/${id_of_dep}/d" ${depFile/.tree/.dep}
otherlink=($(head -n1 ${exchange_triplet[2]}.dep)) echo "$prio_of_dep b $id_of_dep" >> $parentNode
unset otherlink[-1] # must be added to .dep in case parentNode is destroyed when erasing
parent=$(grep -l ^"${otherlink[*]}"\$ *.dep) # the tree
sed -i /[[:digit:]]\ ${exchange_triplet[2]}\$/d ${parent/.dep/.odep} echo "$prio_of_dep b $id_of_dep" >> ${parentNode/.tree/.dep}
tree_erase ${id_of_dep}.dep continue
# We want that our direct dep be ${exchange_triplet[2]} and that id_of_dep ;;
# be pulled in as an indirect dep, so exchange. *) # We are backing up
# Just doing a sed -i "s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile return $p2
# is not good if $DepFile contains several times the same line ;;
# so first find the first line and then sed esac
lineno=$(sed -n /${id_of_dep}/= $DepFile | head -n1) else # id_of_dep has no dependencies, just record the link in a file
sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile # and print
# Do the same for the odep file: echo "${rootlink[*]} $count" > ${id_of_dep}.tree
local OdepFile=${DepFile/.dep/.odep} echo -en "\nLeaf: $(($depth+1))${spaceSTR:0:$(($depth+1))}${CYAN}${id_of_dep}${OFF} $dpriostring"
lineno=$(sed -n /${id_of_dep}/= $OdepFile | head -n1) fi
sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $OdepFile
id_of_dep=${exchange_triplet[2]}
flag=true # we have to regenerate the tree for the new dependency
else
# We are not the parent. If our priority is greater than p2
# we have to change the triplet and return priority, else return current p2.
# echo (DEBUG) backing up to ${exchange_triplet} at ${DepFile%.dep}
if (( $priority > $p2 )); then
exchange_triplet[2]=${DepFile%.dep}
return $priority
else
return $p2
fi
fi
;;
esac
else # id_of_dep has no dependencies, just record the link in a file
# and print
echo "${rootlink[*]} $count" > ${id_of_dep}.dep
echo -en "\nLeaf: $(($depth+1))${spaceSTR:0:$(($depth+1))}${CYAN}${id_of_dep}${OFF} $dpriostring"
fi
done
done done
echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}$DepFile${OFF}" echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}${depFile%.tree}${OFF}"
} 6<$DepFile } <$depFile
# It may happen that a file is created with several times # It may happen that a file is created with several times
# the same line. Normally, all those lines but one # the same line. Normally, all those lines but one
# would be flagged to be removed (or all of them if # would be flagged to be removed (or all of them if
@ -249,12 +584,13 @@ echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}$DepFile${OFF}"
# so first get the position of last line and then delete # so first get the position of last line and then delete
# that line # that line
for line in $lines_to_remove for line in $lines_to_remove
do lineno=$(sed -n /^[[:digit:]]\ $line\$/= $DepFile | tail -n1) do lineno=$(sed -n /^[[:digit:]]\ b\ $line\$/= $depFile | tail -n1)
sed -i ${lineno}d $DepFile sed -i ${lineno}d $depFile
done done
return 0 return 0
} }
#---------------# #---------------#
tree_browse() { # tree_browse() { #
#---------------# #---------------#
@ -264,8 +600,8 @@ local f
#echo file=$file #echo file=$file
for f in $(grep '[^0-9 ]' $file | sed 's/.* //'); do for f in $(grep '[^0-9 ]' $file | sed 's/.* //'); do
# echo f=$f # echo f=$f
if grep -q '[^0-9 ]' ${f}.dep ; then if grep -q '[^0-9 ]' ${f}.tree ; then
tree_browse ${f}.dep tree_browse ${f}.tree
fi fi
echo $f echo $f
done done
@ -276,17 +612,24 @@ tree_erase() { #
#--------------# #--------------#
local file=$1 local file=$1
local f local f
local -a rootlink local rootlink
local -a rootlink2 local rootlink2
#echo file=$file #echo file=$file
rootlink=($(head -n1 $file)) rootlink="$(head -n1 $file) "
for f in $(grep '[^0-9 ]' $file | sed 's/.* //'); do for f in $(grep '[^0-9 ]' $file | sed 's/.* //'); do
# echo " f"=$f if [ -f ${f}.tree ]; then
if [ -f ${f}.dep ]; then rootlink2="$(head -n1 ${f}.tree) "
rootlink2=($(head -n1 ${f}.dep)) # We want two things:
if [[ "${rootlink2[*]}" =~ "${rootlink[*]}" ]] ; then # i) do not erase the file if it is in another branch
tree_erase ${f}.dep # ii) do not erase the file if there is a circular dependency
# for case i), we test that rootlink is contained in rootlink2
# for case ii), we test that rootlink2 is not contained in
# rootlink.
# See comment above about srootlink
if [[ ${rootlink2#${rootlink}} != ${rootlink2} &&
${rootlink#${rootlink2}} == ${rootlink} ]] ; then
tree_erase ${f}.tree
fi fi
fi fi
done done

View file

@ -18,5 +18,6 @@
<!-- subdependencies of a dependency are defined for example in Perl <!-- subdependencies of a dependency are defined for example in Perl
modules --> modules -->
<!ATTLIST dependency status (required|recommended|optional) "recommended" <!ATTLIST dependency status (required|recommended|optional) "recommended"
build (before|after|first) "before"
name CDATA #REQUIRED name CDATA #REQUIRED
type (ref|link) "ref"> type (ref|link) "ref">

148
BLFS/update-lfs.sh Executable file
View file

@ -0,0 +1,148 @@
#!/bin/bash
# Fills the tracking file with versions of LFS packages taken from an
# SVN repository, at either a given date or a given tag (argument $1).
#------
# Argument $1:
# $1 contains a tag or a date, to indicate which version of the LFS book
# to use. It may be empty, meaning to use whatever version is presently in
# lfs-xml.
#
# It is recognized as a tag if it begins with x.y, where 'x' is one or more
# digit(s), the '.' (dot) is mandatory, an 'y' is one or more digits. Anything
# after y is allowed (for example 7.6-systemd or 8.1-rc1).
#
# It is recognized as a date if it is exactly 8 digits. Then it is assumed that
# the format is YYYYMMDD.
#
# Note that there is no check that the tag or the date are valid. Svn errors
# out if the tag is not valid, and if the date is impossible (that is MM>12
# or DD>31), but it happily accepts YYYY=3018 (and updates to HEAD).
#------
# The tracking file is taken from Makefile in the same directory.
MYDIR=$( cd $(dirname $0); pwd )
LFS_XML=${MYDIR}/lfs-xml
if [ -z "$1" ]; then # use lfs-xml as is
DO_COMMANDS=n
elif [ "$(echo $1 | sed 's/^[[:digit:]]\+\.[[:digit:]]\+//')" != "$1" ]
then # tag
DO_COMMANDS=y
CURR_SVN=$(cd $LFS_XML; LANG=C svn info | sed -n 's/Relative URL: //p')
CURR_REV=$(cd $LFS_XML; LANG=C svn info | sed -n 's/Revision: //p')
BEG_COMMAND="(cd $LFS_XML; svn switch ^/tags/$1)"
END_COMMAND="(cd $LFS_XML; svn switch $CURR_SVN@$CURR_REV)"
elif [ "$(echo $1 | sed 's/^[[:digit:]]\{8\}$//')" != "$1" ]; then # date
DO_COMMANDS=y
CURR_REV=$(cd $LFS_XML; LANG=C svn info | sed -n 's/Revision: //p')
BEG_COMMAND="(cd $LFS_XML; svn update -r\\{$1\\})"
END_COMMAND="(cd $LFS_XML; svn update -r$CURR_REV)"
else
echo Bad format in $1: must be a x.y[-aaa] tag or a YYYYMMDD date
exit 1
fi
if [ -f $MYDIR/Makefile ]; then
TRACKING_DIR=$(sed -n 's/TRACKING_DIR[ ]*=[ ]*//p' $MYDIR/Makefile)
TRACKFILE=${TRACKING_DIR}/instpkg.xml
else
echo The directory where $0 resides does not contain a Makefile
exit 1
fi
# We need to know the revision to generate the correct lfs-full...
if [ ! -r $MYDIR/revision ]; then
echo $MYDIR/revision is not available
exit 1
fi
REVISION=$(cat $MYDIR/revision)
#Debug
#echo BEG_COMMAND = $BEG_COMMAND
#echo Before BEG_COMMAND
#( cd $LFS_XML; LANG=C svn info )
#End debug
if [ "$DO_COMMANDS"=y ]; then
echo Running: $BEG_COMMAND
eval $BEG_COMMAND
fi
# Update code
LFS_FULL=/tmp/lfs-full.xml
echo Creating $LFS_FULL with information from $LFS_XML
echo "Processing LFS bootscripts..."
( cd $LFS_XML && bash process-scripts.sh )
echo "Adjusting LFS for revision $REVISION..."
xsltproc --nonet --xinclude \
--stringparam profile.revision $REVISION \
--output /tmp/lfs-prof.xml \
$LFS_XML/stylesheets/lfs-xsl/profile.xsl \
$LFS_XML/index.xml
echo "Validating the LFS book..."
xmllint --nonet --noent --postvalid \
-o $LFS_FULL /tmp/lfs-prof.xml
rm -f $LFS_XML/appendices/*.script
( cd $LFS_XML && ./aux-file-data.sh $LFS_FULL )
echo Updating ${TRACKFILE} with information taken from $LFS_FULL
echo -n "Is it OK? yes/no (no): "
read ANSWER
#Debug
echo You answered $ANSWER
#End debug
if [ x$ANSWER = "xyes" ] ; then
for pack in $(grep '<productname' $LFS_FULL |
sed 's/.*>\([^<]*\)<.*/\1/' |
sort | uniq); do
case "x$pack" in
xgcc* | *pass[12] | xvim | \
xshadow | xPython | xlinux-headers | xdbus | xsystemd )
continue ;;
esac
VERSION=$(grep -A1 ">$pack</product" $LFS_FULL |
head -n2 |
sed -n '2s/.*>\([^<]*\)<.*/\1/p')
#Debug
echo $pack: $VERSION
#End debug
xsltproc --stringparam packages $MYDIR/packages.xml \
--stringparam package $pack \
--stringparam version $VERSION \
-o track.tmp \
$MYDIR/xsl/bump.xsl ${TRACKFILE}
sed -i "s@PACKDESC@$MYDIR/packdesc.dtd@" track.tmp
xmllint --format --postvalid track.tmp > ${TRACKFILE}
rm track.tmp
done
VERSION=$(grep 'echo.*lfs-release' $LFS_FULL |
sed 's/.*echo[ ]*\([^ ]*\).*/\1/')
#Debug
echo LFS-Release: $VERSION
#End debug
xsltproc --stringparam packages $MYDIR/packages.xml \
--stringparam package LFS-Release \
--stringparam version $VERSION \
-o track.tmp \
$MYDIR/xsl/bump.xsl ${TRACKFILE}
sed -i "s@PACKDESC@$MYDIR/packdesc.dtd@" track.tmp
xmllint --format --postvalid track.tmp > ${TRACKFILE}
rm track.tmp
fi
#Debug
#echo After BEG_COMMAND\; before END_COMMAND
#( cd $LFS_XML; LANG=C svn info )
#End debug
if [ "$DO_COMMANDS"=y ]; then
echo Running: $END_COMMAND
eval $END_COMMAND
fi
#Debug
#echo After END_COMMAND
#( cd $LFS_XML; LANG=C svn info )
#End debug

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: bump.xsl 21 2012-02-16 15:06:19Z labastie $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
@ -9,15 +7,26 @@
<xsl:param name="package" select="''"/> <xsl:param name="package" select="''"/>
<xsl:param name="version" select="'N'"/> <xsl:param name="version" select="'N'"/>
<xsl:variable name="realpackage">
<xsl:choose>
<xsl:when test="contains($package, '-pass1')">
<xsl:copy-of select="substring-before($package, '-pass1')"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$package"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="vers"> <xsl:variable name="vers">
<xsl:choose> <xsl:choose>
<xsl:when test="$version='N'"> <xsl:when test="$version='N'">
<xsl:value-of select= <xsl:value-of select=
"document($packages)//*[self::package or self::module] "document($packages)//*[self::package or self::module]
[string(name)=$package]/version"/> [string(name)=$realpackage]/version"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$version"/> <xsl:copy-of select="$version"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
@ -33,8 +42,8 @@
<xsl:apply-templates select=".//package"/> <xsl:apply-templates select=".//package"/>
<xsl:if test="not(.//package[string(name)=$package])"> <xsl:if test="not(.//package[string(name)=$package])">
<package> <package>
<name><xsl:value-of select="$package"/></name> <name><xsl:copy-of select="$package"/></name>
<version><xsl:value-of select="$vers"/></version> <version><xsl:copy-of select="$vers"/></version>
</package> </package>
</xsl:if> </xsl:if>
</sublist> </sublist>
@ -44,8 +53,8 @@
<xsl:choose> <xsl:choose>
<xsl:when test="string(name)=$package"> <xsl:when test="string(name)=$package">
<package> <package>
<name><xsl:value-of select="name"/></name> <name><xsl:copy-of select="$package"/></name>
<version><xsl:value-of select="$vers"/></version> <version><xsl:copy-of select="$vers"/></version>
</package> </package>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>

View file

@ -1,14 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- $Id: dependencies.xsl 24 2012-02-16 15:26:15Z labastie $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
<xsl:output method="text"/> <xsl:output method="text"/>
<xsl:param name="MTA" select="'sendmail'"/> <xsl:param name="MTA" select="'sendmail'"/>
<xsl:param name="dependencies" select="2"/>
<xsl:param name="idofdep" select="'dbus'"/> <xsl:param name="idofdep" select="'dbus'"/>
<xsl:key name="depnode" <xsl:key name="depnode"
@ -20,39 +17,14 @@
</xsl:template> </xsl:template>
<xsl:template match="package"> <xsl:template match="package">
<xsl:apply-templates select="./dependency[@status='required']"> <xsl:apply-templates select="./dependency"/>
<xsl:with-param name="priority" select="1"/>
</xsl:apply-templates>
<xsl:if test="$dependencies &gt; '1'">
<xsl:apply-templates select="./dependency[@status='recommended']">
<xsl:with-param name="priority" select="2"/>
</xsl:apply-templates>
<xsl:if test="$dependencies = '3'">
<xsl:apply-templates select="./dependency[@status='optional']">
<xsl:with-param name="priority" select="3"/>
</xsl:apply-templates>
</xsl:if>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="module"> <xsl:template match="module">
<xsl:apply-templates select="./dependency[@status='required']"> <xsl:apply-templates select="./dependency"/>
<xsl:with-param name="priority" select="1"/>
</xsl:apply-templates>
<xsl:if test="$dependencies &gt; '1'">
<xsl:apply-templates select="./dependency[@status='recommended']">
<xsl:with-param name="priority" select="2"/>
</xsl:apply-templates>
<xsl:if test="$dependencies = '3'">
<xsl:apply-templates select="./dependency[@status='optional']">
<xsl:with-param name="priority" select="3"/>
</xsl:apply-templates>
</xsl:if>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="dependency"> <xsl:template match="dependency">
<xsl:param name="priority"/>
<xsl:variable name="depname"> <xsl:variable name="depname">
<xsl:choose> <xsl:choose>
<xsl:when test="@name='x-window-system'">xinit</xsl:when> <xsl:when test="@name='x-window-system'">xinit</xsl:when>
@ -65,10 +37,11 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<!--
<xsl:variable name="install_it"> <xsl:variable name="install_it">
<xsl:choose> <xsl:choose>
<xsl:when test="@type='link'"> <xsl:when test="@type='link'">
<!-- No way to track versions: install ! --> <!- - No way to track versions: install ! - ->
1 1
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
@ -79,22 +52,43 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:apply-templates select="dependency"> -->
<xsl:with-param name="priority" select="1"/> <xsl:apply-templates select="dependency"/>
</xsl:apply-templates> <!--
<xsl:if test="number($install_it)"> <xsl:if test="number($install_it)">
-->
<xsl:choose> <xsl:choose>
<xsl:when test="@type='link'"> <xsl:when test="@type='link'">
<xsl:text>4</xsl:text> <xsl:text>4</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@status='required'">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:when test="@status='recommended'">
<xsl:text>2</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$priority"/> <xsl:text>3</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="@build='first'">
<xsl:text>f</xsl:text>
</xsl:when>
<xsl:when test="@build='before'">
<xsl:text>b</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>a</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<xsl:value-of select="$depname"/> <xsl:value-of select="$depname"/>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
<!--
</xsl:if> </xsl:if>
-->
</xsl:template> </xsl:template>
<!-- lexicographic Comparison of strings. There is no way to directly <!-- lexicographic Comparison of strings. There is no way to directly

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: gen_config.xsl 21 2012-02-16 15:06:19Z labastie $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
@ -12,52 +10,189 @@
<xsl:apply-templates select="//list"/> <xsl:apply-templates select="//list"/>
<xsl:text>comment "" <xsl:text>comment ""
menu "Default package for resolving MTA dependency" menu "Build settings"
choice choice
prompt "Mail server" prompt "Mail server for resolving the MTA dependency"
config MS_sendmail config MS_sendmail
bool "sendmail" bool "sendmail"
config MS_postfix config MS_postfix
bool "postfix" bool "postfix"
config MS_exim config MS_exim
bool "exim" bool "exim"
endchoice endchoice
config MAIL_SERVER config MAIL_SERVER
string string
default sendmail if MS_sendmail default "sendmail" if MS_sendmail
default postfix if MS_postfix default "postfix" if MS_postfix
default exim if MS_exim default "exim" if MS_exim
endmenu choice
choice
prompt "Dependency level" prompt "Dependency level"
default DEPLVL_2 default DEPLVL_2
help
Packages included in the dependency graph. Note that the graph
itself contains all the dependency information relating those
packages.
config DEPLVL_1 config DEPLVL_1
bool "Required dependencies only" bool "Required dependencies only"
config DEPLVL_2 config DEPLVL_2
bool "Required and recommended dependencies" bool "Required plus recommended dependencies"
config DEPLVL_3 config DEPLVL_3
bool "Required, recommended and optional dependencies" bool "Req/rec plus optional dependencies of requested package(s)"
endchoice config DEPLVL_4
config optDependency bool "All non external dependencies"
endchoice
config optDependency
int int
default 1 if DEPLVL_1 default 1 if DEPLVL_1
default 2 if DEPLVL_2 default 2 if DEPLVL_2
default 3 if DEPLVL_3 default 3 if DEPLVL_3
default 4 if DEPLVL_4
config LANGUAGE
string "LANG variable in the form ll_CC.charmap[@modifiers]"
default "en_US.UTF-8"
help
Because of the book layout, the 3 fields, ll, CC and charmap are
mandatory. The @modifier is honoured if present.
config SUDO config SUDO
bool "Build as User" bool "Build as User"
default y default y
help help
Select if sudo will be used (you build as a normal user) Select if sudo will be used (you build as a normal user)
otherwise sudo is not needed (you build as root) otherwise sudo is not needed (you build as root)
config WRAP_INSTALL
bool "Use `porg style' package management"
default n
help
Select if you want the installation commands to be wrapped
between "wrapInstall '" and "' ; packInstall" functions,
where wrapInstall is used to set up a LD_PRELOAD library (for
example using porg), and packInstall makes the package tarball
config PACK_INSTALL
string "Location of the packInstall.sh script"
default "/blfs_root/packInstall.sh" if !SUDO
default "$HOME/blfs_root/packInstall.sh" if SUDO
depends on WRAP_INSTALL
help
This script is needed for the proper operation of the
`porg style' package management. Provide an absolute
path.
config DEL_LA_FILES
bool "Remove libtool .la files after package installation"
default y
help
This option should be active on any system mixing libtool
and meson build systems. ImageMagick .la files are preserved.
config STATS
bool "Generate statistics for the requested package(s)"
default n
help
If you want timing and memory footprint statistics to be
generated for the packages you build (not their dependencies),
set this option to y. Due to the book layout, several scripts
are not functional in this case. Please review them.
config DEP_CHECK
bool "Check dependencies of the requested package(s)"
default n
depends on WRAP_INSTALL
help
Setting this option does not work if more than one package
is selected. It will do the following:
- Build the dependency tree and generate a build ordered list
disregarding already installed packages
- Generate the scripts for the dependencies not already
installed (as usual)
- Generate a stript that:
+ removes all unneeded packages using porg
(at this point the blfs_tools cannot be used anymore,
and your system may be non functional, so use a console
for that, not a graphical environment)
+ installs the package
+ restores all the previously removed packages
Note that this script may not be the last one, if there are runtime
dependencies
endmenu
menu "Build Layout"
config SRC_ARCHIVE
string "Directory of sources"
default "/sources"
config SRC_SUBDIRS
bool "Downloads sources to subdirectories"
default n
help
If this option is set, the sources will be downloaded and archived
into a subdirectory of the source directory, one for each page
of the book. Otherwise they are downloaded and archived directly
into the source directory
config BUILD_ROOT
string "Build directory"
default "/sources"
help
Directory where the build occurs. It can be the same as the
source directory, provided the setting of subdirectories is
different
config BUILD_SUBDIRS
bool "Build into subdirectories"
default y
help
If this option is set, the sources will be extracted into
subdirectories of the build directory. Otherwise, they will be
directly extracted into the build directory
config KEEP_FILES
bool "Keep source directory"
default n
help
Set this option if you want to keep the build directories
for further examination after installing the package
endmenu
menu "Optimization"
config JOBS
int "Number of parallel jobs"
default 0
help
This number will get passed to make or ninja, unless set
to 0, in which case, it is set to the number of processors
on line. Note that some packages do not respect this setting.
Also, "-j1" is always passed to make for install (and nothing
to ninja).
config CFG_CFLAGS
string "Content of variable CFLAGS"
default "EMPTY"
help
If set to the special string "EMPTY", then CFLAGS will be
unset before starting the script. Otherwise, there is no
content check for this variable. Double check for typos!
config CFG_CXXFLAGS
string "Content of variable CXXFLAGS"
default "EMPTY"
help
If set to the special string "EMPTY", then CXXFLAGS will be
unset before starting the script. Otherwise, there is no
content check for this variable. Double check for typos!
config CFG_LDFLAGS
string "Content of variable LDFLAGS"
default "EMPTY"
help
If set to the special string "EMPTY", then LDFLAGS will be
unset before starting the script. Otherwise, there is no
content check for this variable. Double check for typos!
endmenu
</xsl:text> </xsl:text>
</xsl:template> </xsl:template>
@ -66,7 +201,7 @@ config SUDO
test=".//*[self::package or self::module] test=".//*[self::package or self::module]
[(version and not(inst-version)) or [(version and not(inst-version)) or
string(version) != string(inst-version)]"> string(version) != string(inst-version)]">
<xsl:text>config&#9;MENU_</xsl:text> <xsl:text>menuconfig&#9;MENU_</xsl:text>
<xsl:value-of select="@id"/> <xsl:value-of select="@id"/>
<xsl:text> <xsl:text>
bool&#9;"</xsl:text> bool&#9;"</xsl:text>
@ -74,16 +209,13 @@ bool&#9;"</xsl:text>
<xsl:text>" <xsl:text>"
default&#9;n default&#9;n
menu "</xsl:text> if&#9;MENU_</xsl:text>
<xsl:value-of select="name"/>
<xsl:text>"
depends MENU_</xsl:text>
<xsl:value-of select="@id"/> <xsl:value-of select="@id"/>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:apply-templates select="sublist"/> <xsl:apply-templates select="sublist"/>
<xsl:text>endmenu <xsl:text>endif
</xsl:text> </xsl:text>
</xsl:if> </xsl:if>
@ -94,7 +226,7 @@ depends MENU_</xsl:text>
test=".//*[self::package or self::module] test=".//*[self::package or self::module]
[(version and not(inst-version)) or [(version and not(inst-version)) or
string(version) != string(inst-version)]"> string(version) != string(inst-version)]">
<xsl:text>&#9;config&#9;MENU_</xsl:text> <xsl:text>&#9;menuconfig&#9;MENU_</xsl:text>
<xsl:value-of select="@id"/> <xsl:value-of select="@id"/>
<xsl:text> <xsl:text>
&#9;bool&#9;"</xsl:text> &#9;bool&#9;"</xsl:text>
@ -102,16 +234,13 @@ depends MENU_</xsl:text>
<xsl:text>" <xsl:text>"
&#9;default&#9;n &#9;default&#9;n
&#9;menu "</xsl:text> &#9;if&#9;MENU_</xsl:text>
<xsl:value-of select="name"/>
<xsl:text>"
&#9;depends MENU_</xsl:text>
<xsl:value-of select="@id"/> <xsl:value-of select="@id"/>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:apply-templates select="package"/> <xsl:apply-templates select="package"/>
<xsl:text>&#9;endmenu <xsl:text>&#9;endif
</xsl:text> </xsl:text>
</xsl:if> </xsl:if>
@ -141,24 +270,21 @@ depends MENU_</xsl:text>
<xsl:if <xsl:if
test="not(version) and ./module[not(inst-version) or test="not(version) and ./module[not(inst-version) or
string(version) != string(inst-version)]"> string(version) != string(inst-version)]">
<xsl:text>&#9;&#9;config&#9;MENU_</xsl:text> <xsl:text>&#9;&#9;menuconfig&#9;MENU_</xsl:text>
<xsl:value-of select="translate(name,' ','_')"/> <xsl:value-of select="translate(name,' ()','___')"/>
<xsl:text> <xsl:text>
&#9;&#9;bool&#9;"</xsl:text> &#9;&#9;bool&#9;"</xsl:text>
<xsl:value-of select="name"/> <xsl:value-of select="name"/>
<xsl:text>" <xsl:text>"
&#9;&#9;default&#9;n &#9;&#9;default&#9;n
&#9;&#9;menu "</xsl:text> &#9;&#9;if&#9;MENU_</xsl:text>
<xsl:value-of select="name"/> <xsl:value-of select="translate(name,' ()','___')"/>
<xsl:text>"
&#9;&#9;depends MENU_</xsl:text>
<xsl:value-of select="translate(name,' ','_')"/>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:apply-templates select="module"/> <xsl:apply-templates select="module"/>
<xsl:text>&#9;&#9;endmenu <xsl:text>&#9;&#9;endif
</xsl:text> </xsl:text>
</xsl:if> </xsl:if>

View file

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: gen_pkg_list.xsl 21 2012-02-16 15:06:19Z labastie $ -->
<!-- Takes the blfs-full.xml file and extract a list <!-- Takes the blfs-full.xml file and extract a list
of packages obeying packdesc.dtd + looks for already of packages obeying packdesc.dtd + looks for already
installed packages in the tracking file (stringparam installed packages in the tracking file (stringparam
'installed-packages') --> 'installed-packages') -->
<!-- Extract also a list of LFS packages from stringparam lfs-full -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
<xsl:param name="lfs-full" select="'./lfs-xml/lfs-full.xml'"/>
<xsl:param name="installed-packages" select="'../lib/instpkg.xml'"/> <xsl:param name="installed-packages" select="'../lib/instpkg.xml'"/>
<xsl:output method="xml" <xsl:output method="xml"
@ -22,13 +23,116 @@
<xsl:template match="/"> <xsl:template match="/">
<princList> <princList>
<xsl:text>&#xA;&#xA;</xsl:text> <xsl:text>&#xA;&#xA; </xsl:text>
<list>
<xsl:attribute name="id">lfs</xsl:attribute>
<xsl:text>&#xA; </xsl:text>
<name>LFS Packages</name>
<xsl:text>&#xA; </xsl:text>
<sublist>
<xsl:attribute name="id">lfs-system</xsl:attribute>
<xsl:text>&#xA; </xsl:text>
<name>LFS Final System</name>
<xsl:apply-templates
select='document($lfs-full)//
chapter[@id="chapter-building-system"]/
sect1/sect1info'/>
<xsl:text>&#xA; </xsl:text>
</sublist>
<sublist>
<xsl:attribute name="id">lfs-conf</xsl:attribute>
<xsl:text>&#xA; </xsl:text>
<name>LFS Configuration files</name>
<xsl:apply-templates
select='document($lfs-full)//
chapter[@id="chapter-config"]/
sect1/sect1info[./productname="bootscripts"]'/>
<xsl:text>&#xA; </xsl:text>
</sublist>
<sublist>
<xsl:attribute name="id">lfs-boot</xsl:attribute>
<xsl:text>&#xA; </xsl:text>
<name>LFS Making Bootable</name>
<xsl:apply-templates select='document($lfs-full)//chapter[@id="chapter-bootable"]/sect1/sect1info[./productname="kernel"]'/>
<xsl:text>&#xA; </xsl:text>
</sublist>
<sublist>
<xsl:attribute name="id">lfs-theend</xsl:attribute>
<xsl:text>&#xA; </xsl:text>
<name>LFS The end</name>
<xsl:apply-templates select='document($lfs-full)//sect1[@id="ch-finish-theend"]//userinput[starts-with(string(),"echo")]'/>
<xsl:text>&#xA; </xsl:text>
</sublist>
<xsl:text>&#xA;&#xA; </xsl:text>
</list>
<!-- How to have blfs-bootscripts versionned? Do not know, so <!-- How to have blfs-bootscripts versionned? Do not know, so
avoid it (TODO ?) --> avoid it (TODO ?) -->
<xsl:apply-templates select="//part[not(@id='introduction')]"/> <xsl:apply-templates select="//part[not(@id='introduction')]"/>
</princList> </princList>
</xsl:template> </xsl:template>
<xsl:template match="userinput">
<!-- Only used in lFS chapter 9, to retrieve book version -->
<package>
<name>LFS-Release</name>
<xsl:element name="version">
<xsl:copy-of select="substring-after(substring-before(string(),' &gt;'),'echo ')"/>
</xsl:element>
<xsl:if
test="document($installed-packages)//package[name='LFS-Release']">
<xsl:text>&#xA; </xsl:text>
<xsl:element name="inst-version">
<xsl:value-of
select="document(
$installed-packages
)//package[name='LFS-Release']/version"/>
</xsl:element>
</xsl:if>
</package>
</xsl:template>
<xsl:template match="sect1info">
<xsl:text> </xsl:text>
<xsl:choose>
<!-- Never update linux headers -->
<xsl:when test="./productname='linux-headers'"/>
<!-- Gcc version is taken from BLFS -->
<xsl:when test="./productname='gcc'"/>
<!-- Shadow version is taken from BLFS -->
<xsl:when test="./productname='shadow'"/>
<!-- Vim version is taken from BLFS -->
<xsl:when test="./productname='vim'"/>
<!-- Dbus version is taken from BLFS -->
<xsl:when test="./productname='dbus'"/>
<!-- Systemd version is taken from BLFS -->
<xsl:when test="./productname='systemd'"/>
<!-- Same for python3 -->
<xsl:when test="./productname='Python'"/>
<xsl:otherwise>
<package><xsl:text>&#xA; </xsl:text>
<xsl:element name="name">
<xsl:value-of select="./productname"/>
</xsl:element>
<xsl:text>&#xA; </xsl:text>
<xsl:element name="version">
<xsl:value-of select="./productnumber"/>
</xsl:element>
<xsl:if
test="document($installed-packages)//package[name=current()/productname]">
<xsl:text>&#xA; </xsl:text>
<xsl:element name="inst-version">
<xsl:value-of
select="document(
$installed-packages
)//package[name=current()/productname]/version"/>
</xsl:element>
</xsl:if>
</package>
</xsl:otherwise>
</xsl:choose>
<!-- No deps for now: a former version is always installed -->
</xsl:template>
<xsl:template match="part"> <xsl:template match="part">
<xsl:if test="count(.//*[contains(translate(@xreflabel, <xsl:if test="count(.//*[contains(translate(@xreflabel,
'123456789', '123456789',
@ -40,7 +144,7 @@
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:text>&#xA; </xsl:text> <xsl:text>&#xA; </xsl:text>
<xsl:element name="name"> <xsl:element name="name">
<xsl:value-of select="title"/> <xsl:value-of select="normalize-space(title)"/>
</xsl:element> </xsl:element>
<xsl:text>&#xA;&#xA;</xsl:text> <xsl:text>&#xA;&#xA;</xsl:text>
<xsl:apply-templates select="chapter"/> <xsl:apply-templates select="chapter"/>
@ -55,13 +159,15 @@
'123456789', '123456789',
'000000000'), '000000000'),
'-0') '-0')
]) &gt; 0"> ]) &gt; 0 or @id='postlfs-config'">
<!-- With the removal of lsb-release, there are no more versioned package
in the After LFS configuration issue chapter, so test explicitly -->
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<sublist> <sublist>
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:text>&#xA; </xsl:text> <xsl:text>&#xA; </xsl:text>
<xsl:element name="name"> <xsl:element name="name">
<xsl:value-of select="title"/> <xsl:value-of select="normalize-space(title)"/>
</xsl:element> </xsl:element>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
<xsl:apply-templates select=".//sect1"> <xsl:apply-templates select=".//sect1">
@ -89,17 +195,15 @@
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<package><xsl:text>&#xA; </xsl:text> <package><xsl:text>&#xA; </xsl:text>
<xsl:element name="name"> <xsl:element name="name">
<xsl:value-of select="title"/> <xsl:value-of select="normalize-space(title)"/>
</xsl:element> </xsl:element>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
<!-- Do not use .//*, which would include self. --> <!-- Do not use .//*, which would include self.
<xsl:apply-templates Even a module can be a special case, so
select="descendant::node()[contains(translate(@xreflabel, call the template of specialCases.xsl,
'123456789', which calls the "normal" template when the
'000000000'), case is normal. -->
'-0') <xsl:apply-templates select="descendant::*" mode="special">
]"
mode="normal">
<xsl:sort select="@id"/> <xsl:sort select="@id"/>
</xsl:apply-templates> </xsl:apply-templates>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
@ -208,6 +312,7 @@
</xsl:text> </xsl:text>
<xsl:element name="dependency"> <xsl:element name="dependency">
<xsl:attribute name="status">required</xsl:attribute> <xsl:attribute name="status">required</xsl:attribute>
<xsl:attribute name="build">before</xsl:attribute>
<xsl:attribute name="name"> <xsl:attribute name="name">
<xsl:value-of select="preceding-sibling::sect1[1]/@id"/> <xsl:value-of select="preceding-sibling::sect1[1]/@id"/>
</xsl:attribute> </xsl:attribute>
@ -247,10 +352,12 @@
<xsl:template match="para" mode="dependency"> <xsl:template match="para" mode="dependency">
<xsl:variable name="status" select="./@role"/> <xsl:variable name="status" select="./@role"/>
<!-- First internal dependencies --> <!-- First internal dependencies -->
<xsl:for-each select="./xref"> <xsl:for-each select=".//xref">
<xsl:choose> <xsl:choose>
<!-- Avoid depending of myself --> <!-- Avoid depending of myself -->
<xsl:when test="ancestor::*[@id=current()/@linkend]"/> <xsl:when test="ancestor::*[@id=current()/@linkend]"/>
<!-- do not depend on something which is not a dependency -->
<xsl:when test="@role='nodep'"/>
<!-- Call list expansion when we have an xorg7 series of packages --> <!-- Call list expansion when we have an xorg7 series of packages -->
<xsl:when test="contains(@linkend,'xorg7-')"> <xsl:when test="contains(@linkend,'xorg7-')">
<xsl:call-template name="expand-deps"> <xsl:call-template name="expand-deps">
@ -260,6 +367,13 @@
<xsl:with-param name="status"> <xsl:with-param name="status">
<xsl:value-of select="$status"/> <xsl:value-of select="$status"/>
</xsl:with-param> </xsl:with-param>
<xsl:with-param name="build">
<xsl:choose>
<xsl:when test="@role='runtime'">after</xsl:when>
<xsl:when test="@role='first'">first</xsl:when>
<xsl:otherwise>before</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template> </xsl:call-template>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
@ -269,6 +383,13 @@
<xsl:attribute name="status"> <xsl:attribute name="status">
<xsl:value-of select="$status"/> <xsl:value-of select="$status"/>
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="build">
<xsl:choose>
<xsl:when test="@role='runtime'">after</xsl:when>
<xsl:when test="@role='first'">first</xsl:when>
<xsl:otherwise>before</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="name"> <xsl:attribute name="name">
<xsl:value-of select="@linkend"/> <xsl:value-of select="@linkend"/>
</xsl:attribute> </xsl:attribute>
@ -278,18 +399,31 @@
</xsl:choose> </xsl:choose>
</xsl:for-each> </xsl:for-each>
<!-- then external dependencies --> <!-- then external dependencies -->
<xsl:for-each select="./ulink"> <xsl:for-each select=".//ulink">
<xsl:text> <xsl:choose>
<!-- do not depend on something which is not a dependency -->
<xsl:when test="@role='nodep'"/>
<xsl:otherwise>
<xsl:text>
</xsl:text> </xsl:text>
<xsl:element name="dependency"> <xsl:element name="dependency">
<xsl:attribute name="status"> <xsl:attribute name="status">
<xsl:value-of select="$status"/> <xsl:value-of select="$status"/>
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="name"> <xsl:attribute name="build">
<xsl:value-of select="translate(normalize-space(text()),' ','-')"/> <xsl:choose>
</xsl:attribute> <xsl:when test="@role='runtime'">after</xsl:when>
<xsl:attribute name="type">link</xsl:attribute> <xsl:when test="@role='first'">first</xsl:when>
</xsl:element> <xsl:otherwise>before</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="translate(normalize-space(text()),' /,()','-----')"/>
</xsl:attribute>
<xsl:attribute name="type">link</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> </xsl:for-each>
</xsl:template> </xsl:template>
@ -301,6 +435,7 @@
<!-- the dep on the preceding package used to be required for python. <!-- the dep on the preceding package used to be required for python.
It seems optional now --> It seems optional now -->
<xsl:attribute name="status">optional</xsl:attribute> <xsl:attribute name="status">optional</xsl:attribute>
<xsl:attribute name="build">before</xsl:attribute>
<xsl:attribute name="name"> <xsl:attribute name="name">
<xsl:value-of select="preceding-sibling::listitem[1]//@linkend"/> <xsl:value-of select="preceding-sibling::listitem[1]//@linkend"/>
</xsl:attribute> </xsl:attribute>
@ -312,7 +447,7 @@
<xsl:template match="listitem" mode="perlmod-dep"> <xsl:template match="listitem" mode="perlmod-dep">
<xsl:param name="glue" select="'&#xA; '"/> <xsl:param name="glue" select="'&#xA; '"/>
<xsl:choose> <xsl:choose>
<xsl:when test="para/xref|para[@id]/ulink"> <xsl:when test="para/xref[not(@role) or @role != 'nodep']|para[@id]/ulink">
<xsl:value-of select="$glue"/> <xsl:value-of select="$glue"/>
<xsl:element name="dependency"> <xsl:element name="dependency">
<xsl:attribute name="status"> <xsl:attribute name="status">
@ -325,6 +460,13 @@
<xsl:otherwise>required</xsl:otherwise> <xsl:otherwise>required</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="build">
<xsl:choose>
<xsl:when test="para/xref/@role='runtime'">after</xsl:when>
<xsl:when test="para/ulink/@role='runtime'">after</xsl:when>
<xsl:otherwise>before</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="name"> <xsl:attribute name="name">
<xsl:if test="para/xref"> <xsl:if test="para/xref">
<xsl:value-of select="para/xref/@linkend"/> <xsl:value-of select="para/xref/@linkend"/>

31
BLFS/xsl/get_version.xsl Normal file
View file

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:param name="package" select="'gcc'"/>
<xsl:key name="depnode"
match="package|module"
use="name"/>
<xsl:template match="/">
<xsl:apply-templates select="key('depnode',$package)"/>
</xsl:template>
<xsl:template match="package|module">
<xsl:value-of select="./version"/>
<xsl:text>&#xA;</xsl:text>
<xsl:choose>
<xsl:when test="./inst-version">
<xsl:value-of select="./inst-version"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

236
BLFS/xsl/lfs_make_book.xsl Normal file
View file

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="idlfs" match="sect1" use="sect1info/productname"/>
<xsl:template name="detect-lfs">
<xsl:param name="package"/>
<xsl:param name="lfsbook"/>
<xsl:choose>
<xsl:when test="$package='gcc' or
$package='dbus' or
$package='vim' or
$package='systemd' or
$package='Python' or
$package='shadow'"/>
<xsl:when test="$package='bootscripts'">true</xsl:when>
<xsl:when test="$package='kernel'">true</xsl:when>
<xsl:when test="$package='LFS-Release'">true</xsl:when>
<xsl:otherwise>
<xsl:for-each select="document($lfsbook)">
<xsl:copy-of select="boolean(key('idlfs',$package)/ancestor::chapter[@id='chapter-building-system'])"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="process-lfs">
<xsl:param name="package"/>
<xsl:param name="lfsbook"/>
<xsl:choose>
<xsl:when test="$package='gcc' or
$package='dbus' or
$package='vim' or
$package='systemd' or
$package='Python' or
$package='shadow'"/>
<xsl:when test="$package='bootscripts'">
<xsl:for-each select="document($lfsbook)">
<xsl:apply-templates select="key('idlfs',$package)[ancestor::chapter/@id='chapter-config']" mode="lfs"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="$package='kernel'">
<xsl:for-each select="document($lfsbook)">
<xsl:apply-templates select="key('idlfs',$package)[ancestor::chapter/@id='chapter-bootable']" mode="lfs"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="$package='LFS-Release'">
<sect1 id="LFS-Release">
<xsl:apply-templates select="document($lfsbook)//sect1[@id='ch-finish-theend']/*" mode="lfs-remap"/>
</sect1>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="document($lfsbook)">
<xsl:apply-templates select="key('idlfs',$package)[ancestor::chapter/@id='chapter-building-system']" mode="lfs"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="lfs">
<xsl:choose>
<!--variablelist may contain id attributes equal to the name of the package,
which generates non-unique id. They are of not much use (short descriptions)
here. So just remove them-->
<xsl:when test="self::variablelist"/>
<!--The id's in lfs are of the form ch-xxx-package. We do not want to
use that for file names and the like. So change the id-->
<xsl:when test="self::sect1">
<xsl:element name="sect1">
<xsl:attribute name="id">
<xsl:choose>
<xsl:when
test="./sect1info/productname=
'bootscripts'">lfs-bootscripts</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./sect1info/productname"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates mode="lfs"/>
</xsl:element>
</xsl:when>
<xsl:when test=".//sect2">
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="lfs"/>
</xsl:element>
</xsl:when>
<xsl:when test="self::sect2[@role='package']">
<xsl:variable name="url" select="../sect1info/address/text()"/>
<xsl:variable name="md5" select="//sect1[@id='materials-packages']//ulink[@url=$url]/../following-sibling::para/literal/text()"/>
<xsl:variable name="patch">
<xsl:call-template name="find-patch"/>
</xsl:variable>
<sect2 role="package">
<xsl:copy-of select="./*"/>
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <!--<xsl:element name="ulink">
<xsl:attribute name="url">
<xsl:value-of select="$url"/>
</xsl:attribute>
</xsl:element>--><ulink url="{$url}"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url=" "/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: <xsl:value-of select="$md5"/>
</para>
</listitem>
</itemizedlist>
<xsl:if test="string-length($patch)&gt;10">
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Required patch:
<ulink url="{$patch}"/>
</para>
</listitem>
</itemizedlist>
</xsl:if>
</sect2>
</xsl:when>
<xsl:when test="self::sect2[@role='installation']">
<sect2 role="installation">
<xsl:apply-templates mode="lfs-remap"/>
</sect2>
</xsl:when>
<xsl:when test="self::sect2[@role='configuration']">
<sect2 role="configuration">
<xsl:apply-templates mode="lfs-remap"/>
</sect2>
</xsl:when>
<xsl:when test="self::sect2">
<xsl:element name="sect2">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="lfs"/>
</xsl:element>
</xsl:when>
<xsl:otherwise><!--
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>-->
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="find-patch">
<xsl:variable name="patch-command" select="..//userinput[contains(string(),'patch -Np1')]/text()"/>
<xsl:variable name="patch" select="substring-after($patch-command,'../')"/>
<xsl:if test="string-length($patch) &gt; 10">
<xsl:value-of select="//sect1[@id='materials-patches']//ulink/@url[contains(string(),$patch)]"/>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="lfs-remap">
<xsl:choose>
<xsl:when test=".//screen">
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="lfs-remap"/>
</xsl:element>
</xsl:when>
<xsl:when test="self::screen">
<xsl:choose>
<!-- Since we are using the *-full.xml files, revisions have already been
selected, so no need to bother about revision attributes-->
<xsl:when test="@role='nodump'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:when test="contains(string(),'&lt;your name here&gt;')">
<screen role="root"><userinput>
<xsl:copy-of
select="substring-before(string(),'&lt;your name here&gt;')"/>
<xsl:text>jhalfs</xsl:text>
<xsl:copy-of
select="substring-after(string(),'&lt;your name here&gt;')"/>
</userinput></screen>
</xsl:when>
<xsl:when test="./userinput[@remap='install' or not(@remap)]">
<screen role="root">
<xsl:copy-of select="./*"/>
</screen>
</xsl:when>
<xsl:when test="./userinput[@remap='test']">
<para><command>
<xsl:copy-of select="./userinput/text()"/>
</command></para>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise><!--
<xsl:copy-of select="."/>-->
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="sect1"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

25
BLFS/xsl/list_lfs.xsl Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>bootscripts </xsl:text>
<xsl:text>lfs-bootscripts </xsl:text>
<xsl:text>kernel </xsl:text>
<xsl:text>porg </xsl:text>
<xsl:text>tzdata </xsl:text>
<!-- the next two packages are not in LFS, but jhalfs needs them -->
<xsl:text>sudo </xsl:text>
<xsl:text>wget </xsl:text>
<xsl:apply-templates select=".//chapter[@id='chapter-building-system']/sect1/sect1info/productname"/>
</xsl:template>
<xsl:template match="productname">
<xsl:copy-of select="text()"/>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,25 +1,45 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: make_book.xsl 31 2012-02-19 08:25:04Z labastie $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
<xsl:param name="list" select="''"/> <xsl:param name="list" select="''"/>
<xsl:param name="MTA" select="'sendmail'"/> <xsl:param name="MTA" select="'sendmail'"/>
<xsl:param name="lfsbook" select="'lfs-full.xml'"/>
<!-- Check whether the book is sysv or systemd -->
<xsl:variable name="rev">
<xsl:choose>
<xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
<xsl:text>systemd</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>sysv</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:output <xsl:output
method="xml" method="xml"
encoding="ISO-8859-1" encoding="ISO-8859-1"
doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/> doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
<xsl:include href="lfs_make_book.xsl"/>
<xsl:template match="/"> <xsl:template match="/">
<book> <book>
<xsl:copy-of select="/book/bookinfo"/> <xsl:copy-of select="/book/bookinfo"/>
<preface> <preface>
<?dbhtml filename="preface.html"?> <?dbhtml filename="preface.html"?>
<title>Preface</title> <title>Preface</title>
<xsl:copy-of select="id('bootscripts')"/> <xsl:choose>
<xsl:when test="$rev='sysv'">
<xsl:copy-of select="id('bootscripts')"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="id('systemd-units')"/>
</xsl:otherwise>
</xsl:choose>
</preface> </preface>
<chapter> <chapter>
<?dbhtml filename="chapter.html"?> <?dbhtml filename="chapter.html"?>
@ -60,8 +80,37 @@
select="substring-after($list,' ')"/> select="substring-after($list,' ')"/>
</xsl:call-template> </xsl:call-template>
</xsl:when> </xsl:when>
<xsl:when test="contains($list,'groupxx')"/>
<xsl:otherwise> <xsl:otherwise>
<xsl:variable name="is-lfs">
<xsl:call-template name="detect-lfs">
<xsl:with-param name="package" select="$list"/>
<xsl:with-param name="lfsbook" select="$lfsbook"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose> <xsl:choose>
<xsl:when test="$is-lfs='true'">
<xsl:message>
<xsl:value-of select="$list"/>
<xsl:text> is an lfs package</xsl:text>
</xsl:message>
<xsl:call-template name="process-lfs">
<xsl:with-param name="package" select="$list"/>
<xsl:with-param name="lfsbook" select="$lfsbook"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains(concat($list,' '),'-pass1 ')">
<!-- We need to do it only for sect1 and sect2, because of libva -->
<xsl:variable
name="real-id"
select="substring-before(concat($list,' '),'-pass1 ')"/>
<xsl:if test="id($real-id)[self::sect1]">
<xsl:apply-templates select="id($real-id)" mode="pass1"/>
</xsl:if>
<xsl:if test="id($real-id)[self::sect2]">
<xsl:apply-templates select="id($real-id)" mode="pass1-sect2"/>
</xsl:if>
</xsl:when>
<xsl:when test="not(id($list)[self::sect1 or self::sect2 or self::para or self::bridgehead])"> <xsl:when test="not(id($list)[self::sect1 or self::sect2 or self::para or self::bridgehead])">
<xsl:apply-templates <xsl:apply-templates
select="//sect1[contains(@id,'xorg7') select="//sect1[contains(@id,'xorg7')
@ -86,6 +135,158 @@
<xsl:apply-templates select="." mode="sect1"/> <xsl:apply-templates select="." mode="sect1"/>
</xsl:template> </xsl:template>
<xsl:template match="*" mode="pass1">
<xsl:choose>
<xsl:when test="self::xref">
<xsl:choose>
<xsl:when test="contains(concat(' ',normalize-space($list),' '),
concat(' ',@linkend,' '))">
<xsl:choose>
<xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
<xref linkend="xorg7-server"/>
</xsl:when>
<xsl:when test="@linkend='server-mail'">
<xref linkend="{$MTA}"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@linkend='bootscripts' or
@linkend='systemd-units'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@linkend"/> (in full book)
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@id">
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
<xsl:if test="name() = 'id'">-pass1</xsl:if>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="pass1"/>
</xsl:element>
</xsl:when>
<xsl:when test=".//xref | .//@id">
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="pass1"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="pass1-sect2">
<xsl:choose>
<xsl:when test="self::sect2">
<xsl:element name="sect1">
<xsl:attribute name="id"><xsl:value-of select="@id"/>-pass1</xsl:attribute>
<xsl:attribute name="xreflabel"><xsl:value-of select="@xreflabel"/></xsl:attribute>
<xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
select="@id"/>-pass1.html"</xsl:processing-instruction>
<xsl:apply-templates mode="pass1-sect2"/>
</xsl:element>
</xsl:when>
<xsl:when test="self::sect3">
<xsl:element name="sect2">
<xsl:attribute name="role">
<xsl:value-of select="@role"/>
</xsl:attribute>
<xsl:apply-templates mode="pass1-sect2"/>
</xsl:element>
</xsl:when>
<xsl:when test="self::bridgehead">
<xsl:element name="bridgehead">
<xsl:attribute name="renderas">
<xsl:if test="@renderas='sect4'">sect3</xsl:if>
<xsl:if test="@renderas='sect5'">sect4</xsl:if>
</xsl:attribute>
<xsl:value-of select='.'/>
</xsl:element>
</xsl:when>
<xsl:when test="self::xref">
<xsl:choose>
<xsl:when test="contains(concat(' ',normalize-space($list),' '),
concat(' ',@linkend,' '))">
<xsl:choose>
<xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
<xref linkend="xorg7-server"/>
</xsl:when>
<xsl:when test="@linkend='server-mail'">
<xref linkend="{$MTA}"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@linkend='bootscripts' or
@linkend='systemd-units'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@linkend"/> (in full book)
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@id">
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
<xsl:if test="name() = 'id'">-pass1</xsl:if>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="pass1-sect2"/>
</xsl:element>
</xsl:when>
<xsl:when test=".//xref | .//@id">
<xsl:element name="{name()}">
<xsl:for-each select="attribute::*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates mode="pass1-sect2"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="processing-instruction()" mode="pass1">
<xsl:variable name="pi-full" select="string()"/>
<xsl:variable name="pi-value"
select="substring-after($pi-full,'filename=')"/>
<xsl:variable name="filename"
select="substring-before(substring($pi-value,2),'.html')"/>
<xsl:processing-instruction name="dbhtml">filename="<xsl:copy-of
select="$filename"/>-pass1.html"</xsl:processing-instruction>
</xsl:template>
<xsl:template match="processing-instruction()" mode="sect1"> <xsl:template match="processing-instruction()" mode="sect1">
<xsl:copy-of select="."/> <xsl:copy-of select="."/>
</xsl:template> </xsl:template>
@ -112,9 +313,10 @@
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:choose> <xsl:choose>
<xsl:when test="@linkend='bootscripts'"> <xsl:when test="@linkend='bootscripts' or
@linkend='systemd-units'">
<xsl:copy-of select="."/> <xsl:copy-of select="."/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@linkend"/> (in full book) <xsl:value-of select="@linkend"/> (in full book)
</xsl:otherwise> </xsl:otherwise>
@ -211,6 +413,7 @@
<!-- Perl modules : transform them to minimal sect1. Use a template <!-- Perl modules : transform them to minimal sect1. Use a template
for installation instructions --> for installation instructions -->
<xsl:template match="bridgehead"> <xsl:template match="bridgehead">
<xsl:if test="ancestor::sect1[@id='perl-modules']">
<xsl:element name="sect1"> <xsl:element name="sect1">
<xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
<xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute> <xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
@ -248,10 +451,11 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:element> </xsl:element>
</xsl:if>
</xsl:template> </xsl:template>
<!-- The case of depdendencies of perl modules. Same treatment <!-- The case of depdendencies of perl modules. Same treatment
as for perl modules. Just easier because always perl standard --> as for perl modules. Just easier because always perl standard -->
<xsl:template match="para"> <xsl:template match="para">
<xsl:element name="sect1"> <xsl:element name="sect1">
<xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
@ -307,6 +511,13 @@
select=".//userinput[starts-with(string(),'cat ')]"/> select=".//userinput[starts-with(string(),'cat ')]"/>
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
<xsl:variable name="download-dir">
<xsl:call-template name="download-dir">
<xsl:with-param name="package" select="concat(' ',$package,'-')"/>
<xsl:with-param name="cat-md5"
select=".//userinput[starts-with(string(),'cat ')]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="install-instructions"> <xsl:variable name="install-instructions">
<xsl:call-template name="inst-instr"> <xsl:call-template name="inst-instr">
<xsl:with-param name="inst-instr" <xsl:with-param name="inst-instr"
@ -328,6 +539,7 @@
<xsl:attribute name="url"> <xsl:attribute name="url">
<xsl:value-of <xsl:value-of
select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/> select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
<xsl:value-of select="$download-dir"/>
<xsl:value-of select="$tarball"/> <xsl:value-of select="$tarball"/>
</xsl:attribute> </xsl:attribute>
</xsl:element> </xsl:element>
@ -338,6 +550,7 @@
<xsl:attribute name="url"> <xsl:attribute name="url">
<xsl:value-of <xsl:value-of
select=".//para[contains(string(),'(FTP)')]/ulink/@url"/> select=".//para[contains(string(),'(FTP)')]/ulink/@url"/>
<xsl:value-of select="$download-dir"/>
<xsl:value-of select="$tarball"/> <xsl:value-of select="$tarball"/>
</xsl:attribute> </xsl:attribute>
</xsl:element> </xsl:element>
@ -367,7 +580,7 @@
</para> </para>
<screen><userinput>packagedir=<xsl:value-of <screen><userinput>packagedir=<xsl:value-of
select="substring-before($tarball,'.tar.bz2')"/> select="substring-before($tarball,'.tar.')"/>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
<xsl:value-of select="substring-before($install-instructions, <xsl:value-of select="substring-before($install-instructions,
'as_root')"/> 'as_root')"/>
@ -407,9 +620,43 @@ END DEBUG -->
select="substring-after($cat-md5,'&#xA;')"/> select="substring-after($cat-md5,'&#xA;')"/>
</xsl:call-template> </xsl:call-template>
</xsl:when> </xsl:when>
<xsl:when test="contains(substring-before($cat-md5,$package),' ')">
<xsl:call-template name="tarball">
<xsl:with-param name="package" select="$package"/>
<xsl:with-param name="cat-md5"
select="substring-after($cat-md5,' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:copy-of select="substring-after( <xsl:copy-of select="substring-after(
substring-before($cat-md5,'&#xA;'),' ')"/> substring-before($cat-md5,'&#xA;'),' ')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- get the download dirname from the text that comes from the .md5 file -->
<xsl:template name="download-dir">
<xsl:param name="package"/>
<xsl:param name="cat-md5"/>
<xsl:choose>
<xsl:when test="not(@id='xorg7-legacy')">
<xsl:copy-of select="''"/>
</xsl:when>
<xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
<xsl:call-template name="download-dir">
<xsl:with-param name="package" select="$package"/>
<xsl:with-param name="cat-md5"
select="substring-after($cat-md5,'&#xA;')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains(substring-before($cat-md5,$package),' ')">
<xsl:call-template name="download-dir">
<xsl:with-param name="package" select="$package"/>
<xsl:with-param name="cat-md5"
select="substring-after($cat-md5,' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="substring-before($cat-md5,' ')"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>

View file

@ -0,0 +1,583 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE stylesheet [
<!ENTITY detect-config
"contains(string($current-instr),'useradd') or
contains(string($current-instr),'groupadd') or
contains(string($current-instr),'usermod') or
contains(string($current-instr),'icon-cache') or
contains(string($current-instr),'desktop-database') or
contains(string($current-instr),'compile-schemas') or
contains(string($current-instr),'query-loaders') or
contains(string($current-instr),'pam.d') or
contains(string($current-instr),'/opt/rustc') or
contains(string($current-instr),'libQt5WebEngine') or
contains(string($current-instr),'desktop-file-edit') or
contains(string($current-instr),'.old') or
contains(string($current-instr),'tracker-miner') or
contains(string($current-instr),'gtweak') or
contains(string($current-instr),'query-immodules') or
contains(string($current-instr),'chgrp -v mail') or
contains(string($current-instr),'gnome-control-center')">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template name="process-install">
<xsl:param name="instruction-tree"/>
<xsl:param name="want-stats"/>
<xsl:param name="root-seen"/>
<xsl:param name="install-seen"/>
<xsl:param name="test-seen"/>
<xsl:param name="doc-seen"/>
<!-- Isolate the current instruction -->
<xsl:variable name="current-instr" select="$instruction-tree[1]"/>
<xsl:choose>
<!--============================================================-->
<!-- First, if we have an empty tree, close everything and exit -->
<xsl:when test="not($current-instr)">
<xsl:if test="$install-seen">
<xsl:call-template name="end-install"/>
</xsl:if>
<xsl:if test="$root-seen">
<xsl:call-template name="end-root"/>
</xsl:if>
<xsl:if test="$doc-seen and not($root-seen)">
<xsl:call-template name="end-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$test-seen">
<xsl:call-template name="end-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
</xsl:when><!-- end empty tree -->
<!--============================================================-->
<xsl:when test="$current-instr[@role='root' and @remap='test']">
<xsl:if test="$install-seen">
<xsl:call-template name="end-install"/>
</xsl:if>
<xsl:if test="$root-seen">
<xsl:call-template name="end-root"/>
</xsl:if>
<xsl:if test="$doc-seen and not($root-seen)">
<xsl:call-template name="end-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($test-seen)">
<xsl:call-template name="begin-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="begin-root"/>
<!-- We first apply mode="root" templates, and save the result in a variable -->
<xsl:variable name="processed-instr">
<xsl:apply-templates select="$current-instr" mode="root"/>
</xsl:variable>
<!-- We then process as a test instruction -->
<xsl:call-template name="process-test">
<xsl:with-param name="test-instr" select="$processed-instr"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
<xsl:call-template name="process-install">
<xsl:with-param
name="instruction-tree"
select="$instruction-tree[position()>1]"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
<xsl:with-param name="root-seen" select="boolean(1)"/>
<xsl:with-param name="install-seen" select="boolean(0)"/>
<xsl:with-param name="test-seen" select="boolean(1)"/>
<xsl:with-param name="doc-seen" select="boolean(0)"/>
</xsl:call-template>
</xsl:when><!-- end role="root" and remap="test" -->
<!--============================================================-->
<xsl:when test="$current-instr[@role='root' and @remap='doc']">
<xsl:if test="$test-seen">
<xsl:call-template name="end-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$doc-seen and not($root-seen)">
<xsl:call-template name="end-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($root-seen)">
<xsl:call-template name="begin-root"/>
</xsl:if>
<xsl:if test="not($install-seen)">
<xsl:call-template name="begin-install"/>
</xsl:if>
<!-- We first apply mode="install" templates, and save the result in a
variable -->
<xsl:variable name="processed-instr">
<xsl:apply-templates select="$current-instr" mode="install"/>
</xsl:variable>
<!-- Then comment it out -->
<xsl:call-template name="output-comment-out">
<xsl:with-param name="out-string" select="$processed-instr"/>
</xsl:call-template>
<!-- The above template ends with a commented line, so that if end-install
adds a closing single quote, it will not be seen. Add a CR to prevent
that -->
<xsl:text>
</xsl:text>
<xsl:call-template name="process-install">
<xsl:with-param
name="instruction-tree"
select="$instruction-tree[position()>1]"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
<xsl:with-param name="root-seen" select="boolean(1)"/>
<xsl:with-param name="install-seen" select="boolean(1)"/>
<xsl:with-param name="test-seen" select="boolean(0)"/>
<xsl:with-param name="doc-seen" select="boolean(1)"/>
</xsl:call-template>
</xsl:when><!-- end role="root" and remap="doc" -->
<!--============================================================-->
<xsl:when test="$current-instr[@role='root']">
<!-- We have two cases, depending on the content: either a config instruction,
that we do not record with porg (first case below), or a true install
instruction (otherwise below) -->
<xsl:choose>
<!--____________________________________________________________ -->
<xsl:when test="&detect-config;">
<xsl:if test="$install-seen">
<xsl:call-template name="end-install"/>
</xsl:if>
<xsl:if test="$test-seen">
<xsl:call-template name="end-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$doc-seen and not($root-seen)">
<xsl:call-template name="end-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($root-seen)">
<xsl:call-template name="begin-root"/>
</xsl:if>
<xsl:apply-templates select="$current-instr" mode="root"/>
<xsl:call-template name="process-install">
<xsl:with-param
name="instruction-tree"
select="$instruction-tree[position()>1]"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
<xsl:with-param name="root-seen" select="boolean(1)"/>
<xsl:with-param name="install-seen" select="boolean(0)"/>
<xsl:with-param name="test-seen" select="boolean(0)"/>
<xsl:with-param name="doc-seen" select="boolean(0)"/>
</xsl:call-template>
</xsl:when><!-- end config as root -->
<!--____________________________________________________________ -->
<xsl:otherwise><!-- we have a true install instruction -->
<xsl:if test="$test-seen">
<xsl:call-template name="end-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$doc-seen and not($root-seen)">
<xsl:call-template name="end-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$want-stats and not($install-seen)">
<xsl:if test="$root-seen">
<xsl:call-template name="end-root"/>
</xsl:if>
<xsl:text>
echo Time before install: ${SECONDS} >> $INFOLOG</xsl:text>
<xsl:apply-templates
select="$instruction-tree[@role='root']/userinput"
mode="destdir"/>
<xsl:text>
echo Time after install: ${SECONDS} >> $INFOLOG
echo Size after install: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
</xsl:text>
<xsl:if test="$root-seen">
<xsl:call-template name="begin-root"/>
</xsl:if>
</xsl:if>
<xsl:if test="not($root-seen)">
<xsl:call-template name="begin-root"/>
</xsl:if>
<xsl:if test="not($install-seen)">
<xsl:call-template name="begin-install"/>
</xsl:if>
<xsl:apply-templates select="$current-instr" mode="install"/>
<xsl:call-template name="process-install">
<xsl:with-param
name="instruction-tree"
select="$instruction-tree[position()>1]"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
<xsl:with-param name="root-seen" select="boolean(1)"/>
<xsl:with-param name="install-seen" select="boolean(1)"/>
<xsl:with-param name="test-seen" select="boolean(0)"/>
<xsl:with-param name="doc-seen" select="boolean(0)"/>
</xsl:call-template>
</xsl:otherwise><!-- end true install instruction -->
<!--____________________________________________________________ -->
</xsl:choose>
</xsl:when><!-- role="root" and no remap -->
<!--============================================================-->
<xsl:when test="$current-instr[@remap='test'] or
$current-instr/self::command">
<xsl:if test="$install-seen">
<xsl:call-template name="end-install"/>
</xsl:if>
<xsl:if test="$root-seen">
<xsl:call-template name="end-root"/>
</xsl:if>
<xsl:if test="$doc-seen and not($root-seen)">
<xsl:call-template name="end-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($test-seen)">
<xsl:if test="not($doc-seen)">
<xsl:call-template name="end-make">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="begin-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<!-- We first apply normal templates, and save the result in a variable -->
<xsl:variable name="processed-instr">
<xsl:apply-templates select="$current-instr"/>
</xsl:variable>
<!-- We then process as a test instruction -->
<xsl:call-template name="process-test">
<xsl:with-param name="test-instr" select="$processed-instr"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
<xsl:call-template name="process-install">
<xsl:with-param
name="instruction-tree"
select="$instruction-tree[position()>1]"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
<xsl:with-param name="root-seen" select="boolean(0)"/>
<xsl:with-param name="install-seen" select="boolean(0)"/>
<xsl:with-param name="test-seen" select="boolean(1)"/>
<xsl:with-param name="doc-seen" select="boolean(0)"/>
</xsl:call-template>
</xsl:when><!-- end no role, remap=test -->
<!--============================================================-->
<xsl:when test="$current-instr[@remap='doc']">
<xsl:if test="$install-seen">
<xsl:call-template name="end-install"/>
</xsl:if>
<xsl:if test="$root-seen">
<xsl:call-template name="end-root"/>
</xsl:if>
<xsl:if test="$test-seen">
<xsl:call-template name="end-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($doc-seen) or $root-seen">
<xsl:if test="not($test-seen) and not($root-seen)">
<xsl:call-template name="end-make">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="begin-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<!-- We first apply normal templates, and save the result in a variable -->
<xsl:variable name="processed-instr">
<xsl:apply-templates select="$current-instr"/>
</xsl:variable>
<!-- We then process as a doc instruction -->
<xsl:call-template name="process-doc">
<xsl:with-param name="doc-instr" select="$processed-instr"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
<xsl:call-template name="process-install">
<xsl:with-param
name="instruction-tree"
select="$instruction-tree[position()>1]"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
<xsl:with-param name="root-seen" select="boolean(0)"/>
<xsl:with-param name="install-seen" select="boolean(0)"/>
<xsl:with-param name="test-seen" select="boolean(0)"/>
<xsl:with-param name="doc-seen" select="boolean(1)"/>
</xsl:call-template>
</xsl:when><!-- no role, remap="doc" -->
<!--============================================================-->
<xsl:otherwise><!-- no role no remap -->
<xsl:if test="$install-seen">
<xsl:call-template name="end-install"/>
</xsl:if>
<xsl:if test="$root-seen">
<xsl:call-template name="end-root"/>
</xsl:if>
<xsl:if test="$doc-seen and not($root-seen)">
<xsl:call-template name="end-doc">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$test-seen">
<xsl:call-template name="end-test">
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates select="$current-instr"/>
<xsl:call-template name="process-install">
<xsl:with-param
name="instruction-tree"
select="$instruction-tree[position()>1]"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
<xsl:with-param name="root-seen" select="boolean(0)"/>
<xsl:with-param name="install-seen" select="boolean(0)"/>
<xsl:with-param name="test-seen" select="boolean(0)"/>
<xsl:with-param name="doc-seen" select="boolean(0)"/>
</xsl:call-template>
</xsl:otherwise><!-- no role, no remap -->
<!--============================================================-->
</xsl:choose>
</xsl:template>
<xsl:template match="userinput" mode="install">
<xsl:text>
</xsl:text>
<xsl:call-template name="output-install">
<xsl:with-param name="out-string" select="string()"/>
</xsl:call-template>
</xsl:template>
<!-- userinput templates for mode="root" and normal are in scripts.xsl -->
<xsl:template name="process-test">
<xsl:param name="test-instr"/>
<xsl:param name="want-stats"/>
<xsl:choose>
<!-- the string may begin with a linefeed -->
<xsl:when test="substring($test-instr,1,1)='&#xA;'">
<xsl:text>
</xsl:text>
<xsl:call-template name="process-test">
<xsl:with-param name="test-instr"
select="substring-after($test-instr,'&#xA;')"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($test-instr,'&#xA;')">
<xsl:call-template name="process-test">
<xsl:with-param name="test-instr"
select="substring-before($test-instr,'&#xA;')"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:call-template name="process-test">
<xsl:with-param name="test-instr"
select="substring-after($test-instr,'&#xA;')"/>
<xsl:with-param name="want-stats" select="$want-stats"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="not($want-stats)">
<xsl:text>#</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="contains($test-instr,'make')
and not(contains($test-instr,'make -k'))">
<xsl:copy-of select="substring-before($test-instr,'make')"/>
<xsl:text>make -k</xsl:text>
<xsl:copy-of select="substring-after($test-instr,'make')"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$test-instr"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="substring($test-instr,
string-length($test-instr),
1)!='\'">
<xsl:if test="$want-stats">
<xsl:text> &gt;&gt; $TESTLOG 2>&amp;1</xsl:text>
</xsl:if>
<xsl:text> || true</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="process-doc">
<xsl:param name="doc-instr"/>
<xsl:param name="want-stats"/>
<xsl:choose>
<xsl:when test="$want-stats">
<xsl:copy-of select="$doc-instr"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="output-comment-out">
<xsl:with-param name="out-string" select="$doc-instr"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="output-comment-out">
<!-- Output instructions with each line commented out. -->
<xsl:param name="out-string"/>
<xsl:choose>
<!-- the string may begin with a linefeed -->
<xsl:when test="substring($out-string,1,1)='&#xA;'">
<xsl:text>
</xsl:text>
<xsl:call-template name="output-comment-out">
<xsl:with-param name="out-string"
select="substring-after($out-string,'&#xA;')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($out-string,'&#xA;')">
<xsl:text>#</xsl:text>
<xsl:copy-of select="substring-before($out-string,'&#xA;')"/>
<xsl:text>
</xsl:text>
<xsl:call-template name="output-comment-out">
<xsl:with-param name="out-string"
select="substring-after($out-string,'&#xA;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>#</xsl:text>
<xsl:copy-of select="$out-string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="end-make">
<xsl:param name="want-stats"/>
<xsl:if test="$want-stats">
<xsl:text>
echo Time after make: ${SECONDS} >> $INFOLOG
echo Size after make: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="begin-doc">
<xsl:param name="want-stats"/>
<xsl:if test="$want-stats">
<xsl:text>
echo Time before doc: ${SECONDS} >> $INFOLOG
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="begin-test">
<xsl:param name="want-stats"/>
<xsl:if test="$want-stats">
<xsl:text>
echo Time before test: ${SECONDS} >> $INFOLOG
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="begin-root">
<xsl:if test="$sudo='y'">
<xsl:text>
sudo -E sh -e &lt;&lt; ROOT_EOF
PATH=$PATH:/usr/sbin</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="begin-install">
<xsl:if test="$wrap-install = 'y'">
<xsl:text>
if [ -r "$JH_PACK_INSTALL" ]; then
source $JH_PACK_INSTALL
export -f wrapInstall
export -f packInstall
fi
wrapInstall '</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="end-doc">
<xsl:param name="want-stats"/>
<xsl:if test="$want-stats">
<xsl:text>
echo Time after doc: ${SECONDS} >> $INFOLOG
echo Size after doc: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="end-test">
<xsl:param name="want-stats"/>
<xsl:if test="$want-stats">
<xsl:text>
echo Time after test: ${SECONDS} >> $INFOLOG
echo Size after test: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="end-root">
<xsl:if test="$sudo='y'">
<xsl:text>
ROOT_EOF</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="end-install">
<xsl:if test="$del-la-files = 'y'">
<xsl:call-template name="output-root">
<xsl:with-param name="out-string" select="$la-files-instr"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$wrap-install = 'y'">
<xsl:text>'&#xA;packInstall</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="output-install">
<xsl:param name="out-string" select="''"/>
<xsl:choose>
<xsl:when test="starts-with($out-string, 'make ') or
contains($out-string,' make ') or
contains($out-string,'&#xA;make')">
<xsl:call-template name="output-install">
<xsl:with-param
name="out-string"
select="substring-before($out-string,'make ')"/>
</xsl:call-template>
<xsl:text>make -j1 </xsl:text>
<xsl:call-template name="output-install">
<xsl:with-param
name="out-string"
select="substring-after($out-string,'make ')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($out-string,string($APOS))
and $wrap-install = 'y'">
<xsl:call-template name="output-root">
<xsl:with-param
name="out-string"
select="substring-before($out-string,string($APOS))"/>
</xsl:call-template>
<xsl:text>'\''</xsl:text>
<xsl:call-template name="output-install">
<xsl:with-param name="out-string"
select="substring-after($out-string,string($APOS))"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="output-root">
<xsl:with-param name="out-string" select="$out-string"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!--===================================================================-->
<!-- Localization in the form ll_CC.charmap@modifier (to be used in
bash shell startup scripts). ll, CC, and charmap must be present:
no way to use "C" or "POSIX". -->
<xsl:param name="language" select="'en_US.UTF-8'"/>
<!-- Break it in pieces -->
<xsl:variable name="lang-ll">
<xsl:copy-of select="substring-before($language,'_')"/>
</xsl:variable>
<xsl:variable name="lang-CC">
<xsl:copy-of
select="substring-before(substring-after($language,'_'),'.')"/>
</xsl:variable>
<xsl:variable name="lang-charmap">
<xsl:choose>
<xsl:when test="contains($language,'@')">
<xsl:copy-of
select="substring-before(substring-after($language,'.'),'@')"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="substring-after($language,'.')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="lang-modifier">
<xsl:choose>
<xsl:when test="contains($language,'@')">
<xsl:copy-of select="concat('@',substring-after($language,'@'))"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- end of language variables -->
<!--===================================================================-->
<!-- to be used at places where we need the domain- or host- name -->
<xsl:param name="fqdn" select="'belgarath.example.org'"/>
<!-- make various useful variables -->
<xsl:variable name="hostname" select="substring-before($fqdn,'.')"/>
<xsl:variable name="domainname" select="substring-after($fqdn,'.')"/>
<xsl:variable name="DOMAINNAME" select="translate($domainname,
'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
<!-- end of host/domain name variables -->
<!--===================================================================-->
<!-- keyboard layout for the gdm page (as of BLFS 9.0) -->
<xsl:param name="xkblayout" select="'us'"/>
<!--===================================================================-->
<!-- the main template: to be adjusted depending on the book -->
<xsl:template match="replaceable">
<xsl:choose>
<!-- When adding a user to a group, the book uses "username" in a replaceable
tag. Replace by the user name only if not running as root -->
<xsl:when test="contains(string(),'username') and $sudo='y'">
<xsl:text>$USER</xsl:text>
</xsl:when>
<!-- The next three entries are for gpm. I guess those settings are OK
for a laptop or desktop. -->
<xsl:when test="contains(string(),'yourprotocol')">
<xsl:text>imps2</xsl:text>
</xsl:when>
<xsl:when test="contains(string(),'yourdevice')">
<xsl:text>/dev/input/mice</xsl:text>
</xsl:when>
<xsl:when test="contains(string(),'additional options')"/>
<!-- the book has four fields for language. The language param is
broken into four pieces above. We use the results here. -->
<xsl:when test="contains(string(),'&lt;ll&gt;')">
<xsl:copy-of select="$lang-ll"/>
</xsl:when>
<xsl:when test="contains(string(),'&lt;CC&gt;')">
<xsl:copy-of select="$lang-CC"/>
</xsl:when>
<xsl:when test="contains(string(),'&lt;charmap&gt;')">
<xsl:copy-of select="$lang-charmap"/>
</xsl:when>
<xsl:when test="contains(string(),'@modifier')">
<xsl:copy-of select="$lang-modifier"/>
</xsl:when>
<!-- keyboard layout for X/waylang (only GDM as of BLFS-9.0) -->
<xsl:when test="contains(string(),'layout')">
<xsl:copy-of select="$xkblayout"/>
</xsl:when>
<!-- At several places, the number of jobs is given as "N" in a replaceable
tag. We either detect "N" alone or &lt;N&gt; Replace N with 4. -->
<xsl:when test="contains(string(),'&lt;N&gt;') or string()='N'">
<xsl:text>4</xsl:text>
</xsl:when>
<!-- Mercurial config file uses user_name. Replace only if non root.
Add a bogus mail field. That works for the proposed tests anyway. -->
<xsl:when test="contains(string(),'user_name') and $sudo='y'">
<xsl:text>$USER ${USER}@mail.bogus</xsl:text>
</xsl:when>
<!-- Use the config for Gtk+3 as is -->
<xsl:when test="ancestor::sect1[@id='gtk3' or @id='gtk4']">
<xsl:copy-of select="string()"/>
</xsl:when>
<!-- Give 1Gb to fop. Hopefully, nobody has less RAM nowadays. -->
<xsl:when test="contains(string(),'RAM_Installed')">
<xsl:text>1024</xsl:text>
</xsl:when>
<!-- for MIT-Kerberos config file -->
<xsl:when test="string()='&lt;EXAMPLE.ORG&gt;'">
<xsl:copy-of select="$DOMAINNAME"/>
</xsl:when>
<xsl:when test="string()='&lt;example.org&gt;'">
<xsl:copy-of select="$domainname"/>
</xsl:when>
<xsl:when test="string()='&lt;belgarath.example.org&gt;'">
<xsl:copy-of select="$fqdn"/>
</xsl:when>
<!-- in this case, even root can be used -->
<xsl:when test="string()='&lt;loginname&gt;'">
<xsl:text>$USER</xsl:text>
</xsl:when>
<!-- for xorg environment. Note that libreoffice too uses &lt;PREFIX&gt; -->
<xsl:when test="string()='&lt;PREFIX&gt;' and
ancestor::sect1[@id='xorg-env']">
<xsl:text>/usr</xsl:text>
</xsl:when>
<!-- for libreoffice. Note that xorg environment too uses &lt;PREFIX&gt; -->
<xsl:when test="string()='&lt;PREFIX&gt;' and
ancestor::sect1[@id='libreoffice']">
<xsl:text>/opt/</xsl:text>
<xsl:value-of select="ancestor::sect1/@xreflabel"/>
</xsl:when>
<!-- for abiword -->
<xsl:when test="string()='&lt;lang&gt;'">
<xsl:choose>
<xsl:when test="starts-with($language,'en_US')">
<!-- normal.awt for en_US is already there, copy
the one for en_GB (could be any other) -->
<xsl:text>en_GB</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- in general, there are normal.awt-ll_CC files-->
<xsl:copy-of select="$lang-ll"/>
<xsl:text>_</xsl:text>
<xsl:copy-of select="$lang-CC"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
<xsl:text>EDITME**</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="replaceable" mode="root">
<xsl:apply-templates select="."/>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load diff

119
CHEATSHEET Normal file
View file

@ -0,0 +1,119 @@
This file contains examples of menu settings for various tasks.
------------------------------
LFS book, System V, stable (8.2) version.
Download the files to /usr/src (verify you have write access)
Build in /mnt/lfs (should be owned by root, verify you can execute sudo)
Clean the build directory before beginning
Build a kernel, whose configuration is in /home/user/config-4.15-lfs-1
An fstab for the future system is located in /home/user/fstablfs
Run only the critical testsuites
Settings for a French user
Run four make jobs in parallel
-----------------------------
BOOK Settings --->
Use BOOK (Linux From Scratch System V) --->
Release (Branch or stable book) --->
Branch (preceded by "branch-"), stable Version, or tag (8.2)
[ ] Add blfs-tool support (NEW)
[ ] Add custom tools support (NEW)
General Settings --->
Build Directory (/mnt/lfs)
[*] Retrieve source files
Package Archive Directory (/usr/src)
[ ] Retry on 'connection refused' failure (NEW)
Number of retry attempts on download failures (20) (NEW)
Download timeout (in seconds) (30) (NEW)
FTP mirror (http://ftp.osuosl.org) (NEW)
[*] Run the makefile
[*] Rebuild files
Build Settings --->
[*] Run testsuites
Tests level (Only final critical testsuites) --->
Flavour (Don't stop on testsuite failures) --->
[ ] Package management
[ ] Create a log of installed files for each package
[*] Use a custom fstab file
Fstab file (optional) ($HOME/fstablfs)
[*] Build the kernel
Kernel config file ($HOME/config-4.15-lfs-1)
[ ] Strip Installed Binaries/Libraries
[ ] Install non-wide-character ncurses
[ ] DO NOT use/display progress_bar
TimeZone (Europe/Paris)
Language (fr_FR.UTF-8)
[ ] Install the full set of locales
Groff page size (A4) --->
Advanced Features --->
[*] Create SBU and disk usage report
[ ] Run comparison analysis on final stage
[*] Optimization and parallelization
Optimization settings --->
Number of parallel `make' jobs (4)
Optimization level (Both temp tools and final system) --->
Internal Settings (WARNING: for jhalfs developers only) --->
[ ] Rebuild the Makefile (see help)
------------------------------
------------------------------
LFS book, systemd, XML source of the LFS book in /usr/src/lfsbook
Download the files to /usr/src (verify you have write access)
Build in /mnt/lfs (should be owned by root, verify you can execute sudo)
Clean the build directory before beginning
Build a kernel, whose configuration is in /home/user/config-4.15-lfs-systemd
An fstab for the future system si located in /home/user/fstablfs
Run all the testsuites
Settings for an user in California
Run four make jobs in parallel
-----------------------------
BOOK Settings --->
Use BOOK (Linux From Scratch systemd) --->
Release (Working Copy) --->
Loc of working copy (mandatory) (/usr/src/lfsbook)
[ ] Add blfs-tool support (NEW)
[ ] Add custom tools support (NEW)
General Settings --->
Build Directory (/mnt/lfs)
[*] Retrieve source files
Package Archive Directory (/usr/src)
[ ] Retry on 'connection refused' failure (NEW)
Number of retry attempts on download failures (20) (NEW)
Download timeout (in seconds) (30) (NEW)
FTP mirror (http://ftp.osuosl.org) (NEW)
[*] Run the makefile
[*] Rebuild files
Build Settings --->
[*] Run testsuites
Tests level (Both temporary tools and final system testsuites) --->
Flavour (Don't stop on testsuite failures) --->
[ ] Package management
[ ] Create a log of installed files for each package
[*] Use a custom fstab file
Fstab file (optional) ($HOME/fstablfs)
[*] Build the kernel
Kernel config file ($HOME/config-4.15-lfs-systemd
[ ] Strip Installed Binaries/Libraries
[ ] Install non-wide-character ncurses
[ ] DO NOT use/display progress_bar
TimeZone (America/Los_Angeles)
Language (en_US.UTF-8)
[ ] Install the full set of locales
Groff page size (letter) --->
Advanced Features --->
[*] Create SBU and disk usage report
[ ] Run comparison analysis on final stage
[*] Optimization and parallelization
Optimization settings --->
Number of parallel `make' jobs (4)
Optimization level (Both temp tools and final system) --->
Internal Settings (WARNING: for jhalfs developers only) --->
[ ] Rebuild the Makefile (see help)
------------------------------

View file

@ -1,449 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
%general-entities;
]>
<!-- $Id$ -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
<!-- Build method used -->
<xsl:param name="method" select="chroot"/>
<!-- Run test suites?
0 = none
1 = only Glibc, GCC and Binutils testsuites
2 = all testsuites
3 = alias to 2
-->
<xsl:param name="testsuite" select="1"/>
<!-- Bomb on test suites failures?
n = no, I want to build the full system and review the logs
y = yes, bomb at the first test suite failure to can review the build dir
-->
<xsl:param name="bomb-testsuite" select="n"/>
<!-- Install vim-lang package? OBSOLETE should always be 'n'-->
<xsl:param name="vim-lang" select="n"/>
<!-- Time zone -->
<xsl:param name="timezone" select="GMT"/>
<!-- Page size -->
<xsl:param name="page" select="letter"/>
<!-- Locale settings -->
<xsl:param name="lang" select="C"/>
<!-- Sparc64 processor type -->
<xsl:param name="sparc" select="none"/>
<!-- x86 32 bit target triplet -->
<xsl:param name="x86" select="i686-pc-linux-gnu"/>
<!-- mips target triplet -->
<xsl:param name="mips" select="mips-unknown-linux-gnu"/>
<xsl:template match="/">
<xsl:apply-templates select="//sect1"/>
</xsl:template>
<xsl:template match="sect1">
<xsl:choose>
<xsl:when test="../@id='chapter-partitioning' or
../@id='chapter-getting-materials'"/>
<xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
<xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
<xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
<xsl:otherwise>
<xsl:if test="count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt;
count(descendant::screen[@role='nodump'])">
<!-- The dirs names -->
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
<!-- The file names -->
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
<!-- The build order -->
<xsl:variable name="position" select="position()"/>
<xsl:variable name="order">
<xsl:choose>
<xsl:when test="string-length($position) = 1">
<xsl:text>00</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:when test="string-length($position) = 2">
<xsl:text>0</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$position"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:choose>
<xsl:when test="@id='ch-chroot-changingowner' or
@id='ch-chroot-creatingdirs' or
@id='ch-chroot-createfiles' or
@id='ch-system-stripping'">
<xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(@id='ch-system-stripping')">
<xsl:text>set -e</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
<xsl:if test="sect2[@role='installation'] and
not(@id='ch-system-multiarch-wrapper')">
<xsl:text>cd $PKGDIR&#xA;</xsl:text>
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:if test="not(@id='ch-chroot-chroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit</xsl:text>
</exsl:document>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="screen">
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
<xsl:apply-templates select="userinput" mode="screen"/>
</xsl:if>
</xsl:template>
<xsl:template match="para/userinput">
<xsl:if test="(contains(string(),'test') or
contains(string(),'check')) and
($testsuite = '2' or $testsuite = '3')">
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="userinput" mode="screen">
<xsl:choose>
<!-- Estandarized package formats -->
<xsl:when test="contains(string(),'tar.gz')">
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
<xsl:text>tar.*</xsl:text>
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Setting $LANG for /etc/profile -->
<xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
contains(string(),'export LANG=')">
<xsl:value-of select="substring-before(string(),'export LANG=')"/>
<xsl:text>export LANG=</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:value-of select="substring-after(string(),'charmap]')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Compile the keymap into the kernel has been disabled for 1.0 -->
<xsl:when test="contains(string(),'defkeymap')"/>
<!-- Copying the kernel config file -->
<xsl:when test="string() = 'make mrproper'">
<xsl:text>make mrproper&#xA;</xsl:text>
<xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
<xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
</xsl:if>
<xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
<xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
</xsl:if>
</xsl:when>
<!-- No interactive commands are needed if the .config file is the proper one -->
<xsl:when test="contains(string(),'menuconfig')"/>
<!-- test instructions -->
<xsl:when test="@remap = 'test'">
<xsl:choose>
<!-- Avoid executing the note before perl tests while in 'chroot' -->
<xsl:when test="ancestor::note[@os='a00'] and $method='chroot'"/>
<xsl:when test="$testsuite = '0'"/>
<xsl:when test=
"$testsuite = '1' and
not(ancestor::sect1[@id='ch-system-gcc']) and
not(ancestor::sect1[contains(@id,'ch-system-eglibc')]) and
not(ancestor::sect1[contains(@id,'ch-system-glibc')]) and
not(ancestor::sect1[contains(@id,'ch-system-gmp')]) and
not(ancestor::sect1[contains(@id,'ch-system-mpfr')]) and
not(ancestor::sect1[contains(@id,'ch-system-mpc')]) and
not(ancestor::sect1[contains(@id,'ch-system-ppl')]) and
not(ancestor::sect1[contains(@id,'ch-system-isl')]) and
not(ancestor::sect1[contains(@id,'ch-system-cloog')]) and
not(ancestor::sect1[contains(@id,'ch-system-cloog-ppl')]) and
not(ancestor::sect1[@id='ch-system-binutils'])"/>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:choose>
<!-- special case for (e)glibc -->
<xsl:when test="contains(string(), 'glibc-check-log')">
<xsl:value-of
select="substring-before(string(),'2&gt;&amp;1')"/>
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<!-- special case for procps-ng -->
<xsl:when test="contains(string(), 'pushd')">
<xsl:text>{ </xsl:text>
<xsl:apply-templates/>
<xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:when test="contains(string(), 'make -k')">
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:when test="contains(string(), 'make')">
<xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:if test="not(contains(string(), '&gt;&gt;'))">
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- bomb-testsuite != 'n'-->
<xsl:choose>
<!-- special case for (e)glibc -->
<xsl:when test="contains(string(), 'glibc-check-log')">
<xsl:value-of
select="substring-before(string(),'2&gt;&amp;1')"/>
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<!-- special case for gmp -->
<xsl:when test="contains(string(), 'tee gmp-check-log')">
<xsl:text>(</xsl:text>
<xsl:apply-templates/>
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &amp;&amp; exit $PIPESTATUS)&#xA;</xsl:text>
</xsl:when>
<!-- special case for procps-ng -->
<xsl:when test="contains(string(), 'pushd')">
<xsl:text>{ </xsl:text>
<xsl:apply-templates/>
<xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
</xsl:when>
<xsl:when test="contains(string(), 'make -k')">
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:if test="not(contains(string(), '&gt;&gt;'))">
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- End of test instructions -->
<!-- Fixing toolchain test suites run XXX more to fix -->
<xsl:when test="contains(string(),'glibc-check-log')">
<xsl:choose>
<xsl:when test="$testsuite != '0'">
<xsl:value-of select="substring-before(string(),'2&gt;')"/>
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="string() = 'make check' or
contains(string(), 'make -k check')">
<xsl:choose>
<xsl:when test="$testsuite != '0'">
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'test_summary') or
contains(string(),'expect -c')">
<xsl:choose>
<xsl:when test="$testsuite != '0'">
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/>
<xsl:text> || true&#xA;</xsl:text>
</xsl:when>
<!-- Add -j1 to make install commands -->
<xsl:when test="contains(string(),'make ') and
contains(string(),'install')">
<xsl:value-of select="substring-before(string(),'make ')"/>
<xsl:text>make -j1 </xsl:text>
<xsl:value-of select="substring-after(string(),'make ')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- The rest of commands -->
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="replaceable">
<xsl:choose>
<xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
<xsl:value-of select="$timezone"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-system-eglibc']">
<xsl:value-of select="$timezone"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-system-groff']">
<xsl:value-of select="$page"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
<xsl:choose>
<xsl:when test="contains(string(),'BUILD32')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'BUILD64')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'GCCTARGET')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-final-preps-variables']">
<xsl:choose>
<xsl:when test="contains(string(),'target triplet')">
<xsl:value-of select="$x86"/>
</xsl:when>
<xsl:when test="contains(string(),'mips')">
<xsl:value-of select="$mips"/>
</xsl:when>
<xsl:when test="contains(string(),'BUILD32')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'BUILD64')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'GCCTARGET')">
<xsl:choose>
<xsl:when test="$sparc = '1' or $sparc = '2'">
<xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
</xsl:when>
<xsl:when test="$sparc = '3'">
<xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
<xsl:text>EDITME**</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load diff

View file

@ -1,157 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
%general-entities;
]>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
<!-- XSLT stylesheet to create shell scripts from CLFS2 books. -->
<!-- Install vim-lang package? -->
<xsl:param name="vim-lang" select="y"/>
<!-- Time zone -->
<xsl:param name="timezone" select="GMT"/>
<!-- Page size -->
<xsl:param name="page" select="letter"/>
<!-- Locale settings -->
<xsl:param name="lang" select="C"/>
<xsl:template match="/">
<xsl:apply-templates select="//sect1"/>
</xsl:template>
<xsl:template match="sect1">
<xsl:choose>
<xsl:when test="../@id='chapter-partitioning' or
../@id='chapter-getting-materials' or
../@id='chapter-final-preps'"/>
<xsl:otherwise>
<xsl:if test="count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt;
count(descendant::screen[@role='nodump'])">
<!-- The dirs names -->
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
<!-- The file names -->
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
<!-- The build order -->
<xsl:variable name="position" select="position()"/>
<xsl:variable name="order">
<xsl:choose>
<xsl:when test="string-length($position) = 1">
<xsl:text>00</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:when test="string-length($position) = 2">
<xsl:text>0</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$position"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
<xsl:if test="not(@id='ch-system-stripping')">
<xsl:text>set -e&#xA;</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
<xsl:if test="sect2[@role='installation'] and
not(@id='ch-cross-tools-sysroot-wrapper')">
<xsl:text>cd $PKGDIR&#xA;</xsl:text>
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:text>exit</xsl:text>
</exsl:document>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="screen">
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
<xsl:apply-templates select="userinput" mode="screen"/>
</xsl:if>
</xsl:template>
<xsl:template match="para/userinput"/>
<xsl:template match="userinput" mode="screen">
<xsl:choose>
<!-- Estandarized package formats -->
<xsl:when test="contains(string(),'tar.gz')">
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
<xsl:text>tar.*</xsl:text>
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Setting $LANG for /etc/profile -->
<xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
contains(string(),'export LANG=')">
<xsl:value-of select="substring-before(string(),'export LANG=')"/>
<xsl:text>export LANG=</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:value-of select="substring-after(string(),'charmap]')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Compile the keymap into the kernel has been disabled -->
<xsl:when test="contains(string(),'defkeymap')"/>
<!-- Copying the kernel config file -->
<xsl:when test="string() = 'make mrproper'">
<xsl:text>make mrproper&#xA;</xsl:text>
<xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
</xsl:when>
<!-- No interactive commands are needed if the .config file is the proper one -->
<xsl:when test="contains(string(),'menuconfig')"/>
<!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/>
<xsl:text> || true&#xA;</xsl:text>
</xsl:when>
<!-- The rest of commands -->
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="replaceable">
<xsl:choose>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-glibc']">
<xsl:value-of select="$timezone"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-eglibc']">
<xsl:value-of select="$timezone"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-groff'] or
ancestor::sect1[@id='ch-system-groff']">
<xsl:value-of select="$page"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
<xsl:text>EDITME**</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,536 +0,0 @@
#!/bin/bash
# $Id$
###################################
### FUNCTIONS ###
###################################
#----------------------------#
host_prep_Makefiles() { # Initialization of the system
#----------------------------#
local CLFS_HOST
echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
# defined here, only for ease of reading
CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
(
cat << EOF
025-addinguser:
@\$(call echo_message, Building)
@if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\
touch luser-exist; \\
fi;
@\$(call housekeeping)
026-settingenvironment: 025-addinguser
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi;
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
touch envars && \\
chown \$(LUSER):\$(LGROUP) envars
@\$(call housekeeping)
027-create-directories: 026-settingenvironment
@\$(call echo_message, Building)
@mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt}
@mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys}
@mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool}
@mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local}
@install -d -m 0750 \$(MOUNT_PT)/root
@install -d -m 1777 \$(MOUNT_PT){/var,}/tmp
@mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
@for dir in \$(MOUNT_PT)/usr{,/local}; do \\
ln -s share/{man,doc,info} \$\$dir ; \\
done
@\$(call housekeeping)
028-creating-sysfile: 027-create-directories
@\$(call echo_message, Building)
@touch \$(MOUNT_PT)/etc/mtab
@echo "root::0:0:root:/root:/bin/bash" >> \$(MOUNT_PT)/etc/passwd
@echo "root:x:0:" >> \$(MOUNT_PT)/etc/group
@echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group
@echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group
@echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group
@echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group
@echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group
@echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group
@echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group
@echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group
@echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group
@echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group
@echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group
@echo "video:x:12:" >> \$(MOUNT_PT)/etc/group
@echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group
@echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group
@echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group
@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
@chown -R \$(LUSER) \$(MOUNT_PT) && \\
chmod -R a+w \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
chmod -R a+w \$(SRCSDIR)
@\$(call housekeeping)
EOF
) >> $MKFILE.tmp
host_prep=" 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile"
}
#-----------------------------#
cross_tools_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
for file in cross-tools/* ; do
# Keep the script file name
this_script=`basename $file`
#
# Skip this script...
case $this_script in
*cflags* | *variables* ) # work done in host_prep_Makefiles
continue ;;
*) ;;
esac
#
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
cross_tools="$cross_tools $this_script"
# Grab the name of the target (minus the -headers or -cross in the case of gcc
# and binutils in chapter 5)
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
-e 's@-static@@' \
-e 's@-final@@' \
-e 's@-64@@' \
-e 's@-n32@@'`
case $name in
glibc-headers) name="glibc" ;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done # for file in ....
}
#-----------------------------#
final_system_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}final system ( LUSER ) ${R_arrow}"
for file in final-system/* ; do
# Keep the script file name
this_script=`basename $file`
# Test if the stripping phase must be skipped.
# Skip alsp temp-perl for iterative runs
case $this_script in
*stripping*) [[ "$STRIP" = "n" ]] && continue ;;
esac
# Grab the name of the target, strip id number, XXX-script
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
-e 's@temp-@@' \
-e 's@-64bit@@' \
-e 's@-64@@' \
-e 's@64@@' \
-e 's@n32@@'`
# Find the version of the command files, if it corresponds with the building of
# a specific package.
pkg_tarball=$(get_package_tarball_name $name)
# Append each name of the script files to a list (this will become
# the names of the targets in the Makefile
basicsystem="$basicsystem ${this_script}"
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
# Touch timestamp file if installed files logs will be created.
# But only for the firt build when running iterative builds.
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
LUSER_wrt_unpack "$pkg_tarball"
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
# Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=${this_script}
done # for file in final-system/* ...
}
#-----------------------------#
bootscripts_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts ( LUSER ) ${R_arrow}"
for file in bootscripts/* ; do
# Keep the script file name
this_script=`basename $file`
case $this_script in
*udev) continue ;; # This is not a script but a commentary, we want udev-rules
*console*) continue ;; # Use the files that came with the bootscripts
*network*) continue ;; # Manually create these files
*) ;;
esac
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
bootscripttools="$bootscripttools $this_script"
# Grab the name of the target, strip id number, XXX-script
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
-e 's@-64bit@@' \
-e 's@-64@@' \
-e 's@64@@' \
-e 's@n32@@'`
case $name in
*bootscripts*) name=bootscripts-cross-lfs ;;
*udev-rules) name=udev-cross-lfs ;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
#
LUSER_wrt_RunAsUser "${file}"
#
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done # for file in bootscripts/* ...
}
#-----------------------------#
bootable_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable ( LUSER ) ${R_arrow}"
for file in bootable/* ; do
# Keep the script file name
this_script=`basename $file`
# A little housekeeping on the scripts
case $this_script in
*grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
*kernel) # if there is no kernel config file do not build the kernel
[[ -z $CONFIG ]] && continue
# Copy the config file to /sources with a standardized name
cp $CONFIG $BUILDDIR/sources/kernel-config
;;
esac
#
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
# NOTE: new makfile format forces the last script, *chowning, into a separate
# phase.
case ${this_script} in
*chowning) chowning=" ${this_script}" ;;
*) bootable="$bootable $this_script" ;;
esac
#
# Grab the name of the target, strip id number and misc words.
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
case $this_script in
*kernel*) name=linux
;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
#
# Select a script execution method
case $this_script in
*fstab*) if [[ -n "$FSTAB" ]]; then
LUSER_wrt_CopyFstab
else
LUSER_wrt_RunAsUser "${file}"
fi
;;
*chowning) wrt_RunAsRoot "${file}"
;;
*) LUSER_wrt_RunAsUser "${file}"
;;
esac
#
# Housekeeping...remove any build directory(ies) except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done
}
#-----------------------------#
build_Makefile() { # Construct a Makefile from the book scripts
#-----------------------------#
echo "Creating Makefile... ${BOLD}START${OFF}"
cd $JHALFSDIR/${PROGNAME}-commands
# Start with a clean Makefile.tmp file
>$MKFILE.tmp
host_prep_Makefiles
cross_tools_Makefiles # $cross_tools
final_system_Makefiles # $basicsystem
bootscripts_Makefiles # $bootscripttools
bootable_Makefiles # $bootable
# Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
# Add the BLFS_TOOL targets, if needed.
[[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
# Add a header, some variables and include the function file
# to the top of the real Makefile.
wrt_Makefile_header
# Drop in the main target 'all:' and the chapter targets with each sub-target
# as a dependency.
(
cat << EOF
all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL mk_ROOT
@sudo make restore-luser-env
@sudo make do-housekeeping
@\$(call echo_finished,$VERSION)
ck_UID:
@if [ \`id -u\` = "0" ]; then \\
echo "--------------------------------------------------"; \\
echo "You cannot run this makefile from the root account"; \\
echo "--------------------------------------------------"; \\
exit 1; \\
fi
mk_SETUP:
@\$(call echo_SU_request)
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@
mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request)
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
@touch \$@
mk_CUSTOM_TOOLS: create-sbu_du-report
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
(sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\
(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi;
@touch \$@
mk_BLFS_TOOL: mk_CUSTOM_TOOLS
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
(sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\
(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
fi;
@touch \$@
mk_ROOT: create-sbu_du-report
@\$(call echo_SU_request)
@echo "$VERSION-sysroot - jhalfs build" > clfs-release && \\
sudo mv clfs-release \$(MOUNT_PT)/etc
@sudo make BREAKPOINT=\$(BREAKPOINT) ROOT
@touch \$@
SETUP: $host_prep
LUSER: $cross_tools $basicsystem $bootscripttools $bootable
CUSTOM_TOOLS: $custom_list
BLFS_TOOL: $blfs_tool
ROOT: $chowning
create-sbu_du-report: mk_LUSER
@\$(call echo_message, Building)
@if [ "\$(ADD_REPORT)" = "y" ]; then \\
./create-sbu_du-report.sh logs $VERSION; \\
\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
fi;
@touch \$@
restore-luser-env:
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
fi;
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
do-housekeeping:
@-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\
rm -rf \$(LUSER_HOME); \\
fi;
EOF
) >> $MKFILE
# Bring over the items from the Makefile.tmp
cat $MKFILE.tmp >> $MKFILE
rm $MKFILE.tmp
echo "Creating Makefile... ${BOLD}DONE${OFF}"
}

View file

@ -1,156 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
%general-entities;
]>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
<!-- XSLT stylesheet to create shell scripts from CLFS2 books. -->
<!-- Endian level -->
<xsl:param name="endian" select="xbig"/>
<!-- Time zone -->
<xsl:param name="timezone" select="GMT"/>
<!-- Page size -->
<xsl:param name="page" select="letter"/>
<!-- Locale settings -->
<xsl:param name="lang" select="C"/>
<xsl:template match="/">
<xsl:apply-templates select="//sect1"/>
</xsl:template>
<xsl:template match="sect1">
<xsl:choose>
<xsl:when test="../@id='chapter-partitioning' or
../@id='chapter-getting-materials' or
../@id='chapter-final-preps'"/>
<xsl:otherwise>
<xsl:if test="count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt;
count(descendant::screen[@role='nodump'])">
<!-- The dirs names -->
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
<!-- The file names -->
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
<!-- The build order -->
<xsl:variable name="position" select="position()"/>
<xsl:variable name="order">
<xsl:choose>
<xsl:when test="string-length($position) = 1">
<xsl:text>00</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:when test="string-length($position) = 2">
<xsl:text>0</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$position"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!/bin/bash&#xA;set +h&#xA;set -e&#xA;&#xA;</xsl:text>
<!-- Set envars needed by uClibc -->
<xsl:if test="@id='ch-cross-tools-uclibc'">
<xsl:copy-of select="//sect1[@id='ch-cross-tools-toolchain']/screen"/>
<xsl:text>&#xA;&#xA;</xsl:text>
</xsl:if>
<xsl:if test="sect2[@role='installation']">
<xsl:text>cd $PKGDIR&#xA;</xsl:text>
</xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:text>exit</xsl:text>
</exsl:document>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="screen">
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
<xsl:apply-templates select="userinput" mode="screen"/>
</xsl:if>
</xsl:template>
<xsl:template match="para/userinput"/>
<xsl:template match="userinput" mode="screen">
<xsl:choose>
<!-- Estandarized package formats -->
<xsl:when test="contains(string(),'tar.gz')">
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
<xsl:text>tar.*</xsl:text>
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Select Endian level for uClibc -->
<!--
<xsl:when test="$endian='xbig' and contains(string(),'LITTLE_ENDIAN')"/>
<xsl:when test="$endian='xlittle' and contains(string(),'BIG_ENDIAN')"/>
-->
<!-- Setting $LANG for /etc/profile -->
<xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
contains(string(),'export LANG=')">
<xsl:value-of select="substring-before(string(),'export LANG=')"/>
<xsl:text>export LANG=</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:value-of select="substring-after(string(),'charmap]')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Compile the keymap into the kernel has been disabled -->
<xsl:when test="contains(string(),'defkeymap')"/>
<!-- Copying the kernel config file -->
<xsl:when test="string() = 'make mrproper'">
<xsl:text>make mrproper&#xA;</xsl:text>
<xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
</xsl:when>
<!-- No interactive commands are needed if the .config file is the proper one -->
<xsl:when test="contains(string(),'menuconfig')"/>
<!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/>
<xsl:text> || true&#xA;</xsl:text>
</xsl:when>
<!-- The rest of commands -->
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="replaceable">
<xsl:choose>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-glibc']">
<xsl:value-of select="$timezone"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-cross-tools-groff'] or
ancestor::sect1[@id='ch-system-groff']">
<xsl:value-of select="$page"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
<xsl:text>EDITME**</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,586 +0,0 @@
#!/bin/bash
# $Id$
###################################
### FUNCTIONS ###
###################################
#----------------------------#
host_prep_Makefiles() { # Initialization of the system
#----------------------------#
local CLFS_HOST
echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
# defined here, only for ease of reading
CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
(
cat << EOF
025-addinguser:
@\$(call echo_message, Building)
@if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\
touch luser-exist; \\
fi;
@\$(call housekeeping)
026-settingenvironment: 025-addinguser
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi;
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "export CLFS_MIPS_LEVEL=\"${MIPS_LEVEL}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "export BUILD=\"${ABI}\"" >> \$(LUSER_HOME)/.bashrc && \\
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
touch envars && \\
chown \$(LUSER):\$(LGROUP) envars
@\$(call housekeeping)
027-create-directories: 026-settingenvironment
@\$(call echo_message, Building)
@mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt}
@mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys}
@mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool}
@mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local}
@install -d -m 0750 \$(MOUNT_PT)/root
@install -d -m 1777 \$(MOUNT_PT){/var,}/tmp
@mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo}
@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
@for dir in \$(MOUNT_PT)/usr{,/local}; do \\
ln -s share/{man,doc,info} \$\$dir ; \\
done
@\$(call housekeeping)
028-creating-sysfile: 027-create-directories
@\$(call echo_message, Building)
@touch \$(MOUNT_PT)/etc/mtab
@echo "root::0:0:root:/root:/bin/ash" >> \$(MOUNT_PT)/etc/passwd
@echo "root:x:0:" >> \$(MOUNT_PT)/etc/group
@echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group
@echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group
@echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group
@echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group
@echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group
@echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group
@echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group
@echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group
@echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group
@echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group
@echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group
@echo "video:x:12:" >> \$(MOUNT_PT)/etc/group
@echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group
@echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group
@echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group
@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
@chown -R \$(LUSER) \$(MOUNT_PT) && \\
chmod -R a+w \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
chmod -R a+w \$(SRCSDIR)
@\$(call housekeeping)
EOF
) >> $MKFILE.tmp
host_prep=" 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile"
}
#-----------------------------#
systemprep_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}system prep tools ( LUSER ) ${R_arrow}"
for file in systemprep/* ; do
# Keep the script file name
this_script=`basename $file`
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile)
cross_tools="$cross_tools $this_script"
# Grab the name of the target (minus the -headers or -cross in the case of gcc
# and binutils in chapter 5)
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
[[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done # for file in ....
}
#-----------------------------#
cross_tools_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
for file in cross-tools/* ; do
# Keep the script file name
this_script=`basename $file`
#
# Skip this script...
# NOTE.. the book indicated you only needed to install groff or file if the host
# had older versions. The packages would be installed in the target directory
# and not the host.
case $this_script in
*cflags* | *variables* | *abi | *toolchain*) # work done in host_prep_Makefiles
continue ;;
*) ;;
esac
#
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile)
cross_tools="$cross_tools $this_script"
# Grab the name of the target (minus the -headers or -cross in the case of gcc
# and binutils in chapter 5)
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
-e 's@-static@@' \
-e 's@-final@@' \
-e 's@-64@@' \
-e 's@-n32@@'`
case $name in
uclibc*) name="uClibc" ;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
# Touch timestamp file if installed files logs will be created.
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
# Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done # for file in ....
}
#-----------------------------#
final_system_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}final system ( LUSER ) ${R_arrow}"
for file in final-system/* ; do
# Keep the script file name
this_script=`basename $file`
# Grab the name of the target, strip id number, XXX-script
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
-e 's@temp-@@' \
-e 's@-64bit@@' \
-e 's@-64@@' \
-e 's@64@@' \
-e 's@n32@@'`
# Find the version of the command files, if it corresponds with the building of
# a specific package.
pkg_tarball=$(get_package_tarball_name $name)
# Append each name of the script files to a list (this will become
# the names of the targets in the Makefile
basicsystem="$basicsystem ${this_script}"
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
# Touch timestamp file if installed files logs will be created.
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
LUSER_wrt_unpack "$pkg_tarball"
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
#
LUSER_wrt_RunAsUser "${file}"
#
# Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=${this_script}
done # for file in final-system/* ...
}
#-----------------------------#
bootscripts_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts ( LUSER ) ${R_arrow}"
for file in bootscripts/* ; do
# Keep the script file name
this_script=`basename $file`
case $this_script in
*console*) continue ;; # Use the files that came with the bootscripts
*network*) continue ;; # Manually create these files
*) ;;
esac
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
bootscripttools="$bootscripttools $this_script"
# Grab the name of the target, strip id number, XXX-script
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
-e 's@-64bit@@' \
-e 's@-64@@' \
-e 's@64@@' \
-e 's@n32@@'`
case $name in
*bootscripts*) name=clfs-embedded-bootscripts ;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
#
LUSER_wrt_RunAsUser "${file}"
#
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done # for file in bootscripts/* ...
}
#-----------------------------#
bootable_Makefiles() { #
#-----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable ( LUSER ) ${R_arrow}"
for file in bootable/* ; do
# Keep the script file name
this_script=`basename $file`
# A little housekeeping on the scripts
case $this_script in
*grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
*kernel) # if there is no kernel config file do not build the kernel
[[ -z $CONFIG ]] && continue
# Copy the config file to /sources with a standardized name
cp $CONFIG $BUILDDIR/sources/kernel-config
;;
esac
#
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
# NOTE: new makfile format forces the last script, *chowning, into a separate
# phase.
case ${this_script} in
*chowning) chowning=${this_script} ;;
*) bootable="$bootable $this_script" ;;
esac
#
# Grab the name of the target, strip id number and misc words.
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
case $this_script in
*kernel*) name=linux
;;
esac
pkg_tarball=$(get_package_tarball_name $name)
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV"
#
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
LUSER_wrt_unpack "$pkg_tarball"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_TouchTimestamp
fi
fi
#
# Select a script execution method
case $this_script in
*fstab*) if [[ -n "$FSTAB" ]]; then
LUSER_wrt_CopyFstab
else
LUSER_wrt_RunAsUser "${file}"
fi
;;
*chowning) wrt_RunAsRoot "${file}"
;;
*) LUSER_wrt_RunAsUser "${file}"
;;
esac
#
# Housekeeping...remove any build directory(ies) except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "${name}"
if [ "${INSTALL_LOG}" = "y" ] ; then
LUSER_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done
}
#-----------------------------#
build_Makefile() { # Construct a Makefile from the book scripts
#-----------------------------#
echo "Creating Makefile... ${BOLD}START${OFF}"
cd $JHALFSDIR/${PROGNAME}-commands
# Start with a clean Makefile.tmp file
>$MKFILE.tmp
host_prep_Makefiles
[[ "${PLATFORM% -*}" = "WRT" ]] && systemprep_Makefiles # $cross_tools
cross_tools_Makefiles # $cross_tools
final_system_Makefiles # $basicsystem
bootscripts_Makefiles # $bootscripttools
bootable_Makefiles # $bootable
# Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
# Add a header, some variables and include the function file
# to the top of the real Makefile.
wrt_Makefile_header
# Drop in the main target 'all:' and the chapter targets with each sub-target
# as a dependency.
(
cat << EOF
all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_ROOT
@sudo make restore-luser-env
@sudo make do-housekeeping
@\$(call echo_finished,$VERSION)
ck_UID:
@if [ \`id -u\` = "0" ]; then \\
echo "--------------------------------------------------"; \\
echo "You cannot run this makefile from the root account"; \\
echo "--------------------------------------------------"; \\
exit 1; \\
fi
mk_SETUP:
@\$(call echo_SU_request)
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@
mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request)
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
@touch \$@
mk_CUSTOM_TOOLS: create-sbu_du-report
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
(sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\
(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi;
@touch \$@
mk_ROOT:
@\$(call echo_SU_request)
@echo "$VERSION-embedded - jhalfs build" > clfs-release && \\
sudo mv clfs-release \$(MOUNT_PT)/etc
@sudo make BREAKPOINT=\$(BREAKPOINT) ROOT
@touch \$@
SETUP: $host_prep
LUSER: $cross_tools $basicsystem $bootscripttools $bootable
CUSTOM_TOOLS: $custom_list
ROOT: $chowning
create-sbu_du-report: mk_LUSER
@\$(call echo_message, Building)
@if [ "\$(ADD_REPORT)" = "y" ]; then \\
./create-sbu_du-report.sh logs $VERSION; \\
\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
fi;
@touch \$@
restore-luser-env:
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
fi;
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
do-housekeeping:
@-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\
rm -rf \$(LUSER_HOME); \\
fi;
EOF
) >> $MKFILE
# Bring over the items from the Makefile.tmp
cat $MKFILE.tmp >> $MKFILE
rm $MKFILE.tmp
echo "Creating Makefile... ${BOLD}DONE${OFF}"
}

1951
Config.in

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,3 @@
$Id$
This is the list of functions used in jhalfs, excluding BLFS tool functions This is the list of functions used in jhalfs, excluding BLFS tool functions
and functions defined in {C,H}LFS/master.sh. and functions defined in {C,H}LFS/master.sh.
I felt the need for documenting it when trying to add package management. I felt the need for documenting it when trying to add package management.
@ -39,7 +37,7 @@ create_urls():
From common/libs/func_download_pkgs. From common/libs/func_download_pkgs.
Description: Runs xsltproc with stylesheet urls.xsl on chapter 3 of the Description: Runs xsltproc with stylesheet urls.xsl on chapter 3 of the
book. Add BLFS dependencies and custom dependencies if `BLFS_TOOLS' is `y' book. Add BLFS dependencies and custom dependencies if `BLFS_TOOLS' is `y'
and `CUSTOM_TOOLS' is `y' respectively. and `CUSTOM_TOOLS' is `y' respectively.
Called by: get_sources Called by: get_sources
-------------------------------------------------------------------------- --------------------------------------------------------------------------
wrt_CustomTools_target(): wrt_CustomTools_target():
@ -68,7 +66,7 @@ script-name to the beginning of a line in the list. Writes the name found
to stdout. to stdout.
Implements the behavior described in README.CUSTOM, that is, if script_name Implements the behavior described in README.CUSTOM, that is, if script_name
begins with d-, strip that part. begins with d-, strip that part.
Called by: various functions in master.sh Called by: various functions in master.sh
-------------------------------------------------------------------------- --------------------------------------------------------------------------
LUSER_wrt_target(): LUSER_wrt_target():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
@ -128,67 +126,63 @@ Description: Calculate time with perl, footer to log file
-------------------------------------------------------------------------- --------------------------------------------------------------------------
CHROOT_wrt_RunAsRoot(): CHROOT_wrt_RunAsRoot():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
LUSER_wrt_CopyFstab(): LUSER_wrt_CopyFstab():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
CHROOT_wrt_CopyFstab(): CHROOT_wrt_CopyFstab():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
LUSER_wrt_TouchTimestamp(): LUSER_wrt_TouchTimestamp():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
CHROOT_wrt_TouchTimestamp(): CHROOT_wrt_TouchTimestamp():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
LUSER_wrt_LogNewFiles(): LUSER_wrt_LogNewFiles():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
CHROOT_wrt_LogNewFiles(): CHROOT_wrt_LogNewFiles():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
LUSER_RemoveBuildDirs(): LUSER_RemoveBuildDirs():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
CHROOT_wrt_RemoveBuildDirs(): CHROOT_wrt_RemoveBuildDirs():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
wrt_touch(): wrt_touch():
From common/libs/func_wrt_Makefile. From common/libs/func_wrt_Makefile.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
wrt_compare_targets(): wrt_compare_targets():
From common/libs/func_compare.sh. From common/libs/func_compare.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
wrt_system_build(): wrt_system_build():
From common/libs/func_compare.sh. From common/libs/func_compare.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
wrt_compare_work(): wrt_compare_work():
From common/libs/func_compare.sh. From common/libs/func_compare.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
wrt_do_ica_work(): wrt_do_ica_work():
From common/libs/func_compare.sh. From common/libs/func_compare.sh.
Description: Description:
--------------------------------------------------------------------------
wrt_do_farce_work():
From common/libs/func_compare.sh.
Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
wrt_logs(): wrt_logs():
From common/libs/func_compare.sh. From common/libs/func_compare.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
validate_config(): validate_config():
From common/libs/func_validate_configs.sh. From common/libs/func_validate_configs.sh.
@ -196,135 +190,55 @@ Description: Are the config values sane (within reason)
-------------------------------------------------------------------------- --------------------------------------------------------------------------
write_error_and_die(): write_error_and_die():
From common/libs/func_validate_configs.sh. From common/libs/func_validate_configs.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
validate_file(): validate_file():
From common/libs/func_validate_configs.sh. From common/libs/func_validate_configs.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
validate_dir(): validate_dir():
From common/libs/func_validate_configs.sh. From common/libs/func_validate_configs.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
get_book(): get_book():
From common/libs/func_book_parser. From common/libs/func_book_parser.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
extract_commands(): extract_commands():
From common/libs/func_book_parser. From common/libs/func_book_parser.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
create_package_list(): create_package_list():
From common/libs/func_book_parser. From common/libs/func_book_parser.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
check_version(): check_version():
From common/libs/func_check_version.sh. From common/libs/func_check_version.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
write_error_and_die(): write_error_and_die():
From common/libs/func_check_version.sh. From common/libs/func_check_version.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
check_prerequisites(): check_prerequisites():
From common/libs/func_check_version.sh. From common/libs/func_check_version.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
write_or_exit(): write_or_exit():
From common/progress_bar.sh. From common/progress_bar.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
no_empty_builddir(): no_empty_builddir():
From common/common-functions. From common/common-functions.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
run_make(): run_make():
From common/common-functions. From common/common-functions.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
clean_builddir(): clean_builddir():
From common/common-functions. From common/common-functions.
Description: Description:
--------------------------------------------------------------------------
function dohelp():
From extras/farce.
Description:
--------------------------------------------------------------------------
function emessage():
From extras/farce.
Description:
--------------------------------------------------------------------------
function expected():
From extras/farce.
Description:
--------------------------------------------------------------------------
function failure():
From extras/farce.
Description:
--------------------------------------------------------------------------
function fatal():
From extras/farce.
Description:
--------------------------------------------------------------------------
function filetype():
From extras/farce.
Description:
--------------------------------------------------------------------------
function message():
From extras/farce.
Description:
--------------------------------------------------------------------------
function onlyone():
From extras/farce.
Description:
--------------------------------------------------------------------------
function testar():
From extras/farce.
Description:
--------------------------------------------------------------------------
function testgzip():
From extras/farce.
Description:
--------------------------------------------------------------------------
function testso():
From extras/farce.
Description:
--------------------------------------------------------------------------
function tokenize():
From extras/farce.
Description:
--------------------------------------------------------------------------
function tokenizeanddiff():
From extras/farce.
Description:
--------------------------------------------------------------------------
function validateargs():
From extras/farce.
Description:
--------------------------------------------------------------------------
process_toolchain():
From HLFS/master.sh.
Description: embryo,cocoon and butterfly need special handling
--------------------------------------------------------------------------
chapter3_Makefiles():
From HLFS/master.sh.
Description: Initialization of the system
--------------------------------------------------------------------------
chapter5_Makefiles():
From HLFS/master.sh.
Description: Bootstrap or temptools phase
--------------------------------------------------------------------------
chapter6_Makefiles():
From HLFS/master.sh.
Description: sysroot or chroot build phase
--------------------------------------------------------------------------
chapter7_Makefiles():
From HLFS/master.sh.
Description: Create a bootable system.. kernel, bootscripts..etc
--------------------------------------------------------------------------
build_Makefile():
From HLFS/master.sh.
Description: Construct a Makefile from the book scripts
-------------------------------------------------------------------------- --------------------------------------------------------------------------
simple_error(): simple_error():
From jhalfs. From jhalfs.
@ -332,27 +246,27 @@ Description: Basic error trap.... JUST DIE
-------------------------------------------------------------------------- --------------------------------------------------------------------------
see_ya(): see_ya():
From jhalfs. From jhalfs.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
chapter4_Makefiles(): chapter4_Makefiles():
From LFS/master.sh. From LFS/master.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
chapter5_Makefiles(): chapter5_Makefiles():
From LFS/master.sh. From LFS/master.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
chapter6_Makefiles(): chapter6_Makefiles():
From LFS/master.sh. From LFS/master.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
chapter78_Makefiles(): chapter78_Makefiles():
From LFS/master.sh. From LFS/master.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
build_Makefile(): build_Makefile():
From LFS/master.sh. From LFS/master.sh.
Description: Description:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
validate_opt_settings(): validate_opt_settings():
From optimize/optimize_functions. From optimize/optimize_functions.

View file

@ -1,330 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
%general-entities;
]>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
<!-- XSLT stylesheet to create shell scripts from HLFS books. -->
<!-- What libc implentation must be used? -->
<xsl:param name="model" select="glibc"/>
<!-- What kernel serie must be used? -->
<xsl:param name="kernel" select="2.6"/>
<!-- Is the host kernel using grsecurity? -->
<xsl:param name="grsecurity_host" select="n"/>
<!-- Run test suites?
0 = none
1 = only chapter06 Glibc, GCC and Binutils testsuites
2 = all chapter06 testsuites
3 = alias to 2
-->
<xsl:param name="testsuite" select="1"/>
<!-- Bomb on test suites failures?
n = no, I want to build the full system and review the logs
y = yes, bomb at the first test suite failure to can review the build dir
-->
<xsl:param name="bomb-testsuite" select="n"/>
<!-- Additional features -->
<xsl:param name="features">,ssp,aslr,pax,hardened_tmp,warnings,misc,blowfish,</xsl:param>
<!-- Time zone -->
<xsl:param name="timezone" select="GMT"/>
<!-- Page size -->
<xsl:param name="page" select="letter"/>
<!-- Locale settings -->
<xsl:param name="lang" select="C"/>
<xsl:template match="/">
<xsl:apply-templates select="//sect1"/>
</xsl:template>
<xsl:template match="sect1">
<xsl:if test="(../@id='chapter-temporary-tools' or
../@id='chapter-building-system' or
../@id='chapter-bootable') and
(count(descendant::screen/userinput) &gt; 0 and
count(descendant::screen/userinput) &gt;
count(descendant::screen[@role='nodump'])) and
((@condition=$model or not(@condition)) and
(@vendor=$kernel or not(@vendor)))">
<!-- The dirs names -->
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
<!-- The file names -->
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
<!-- The build order -->
<xsl:variable name="position" select="position()"/>
<xsl:variable name="order">
<xsl:choose>
<xsl:when test="string-length($position) = 1">
<xsl:text>00</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:when test="string-length($position) = 2">
<xsl:text>0</xsl:text>
<xsl:value-of select="$position"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$position"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:choose>
<xsl:when test="@id='ch-system-creatingdirs' or
@id='ch-system-createfiles' or
@id='ch-system-changingowner' or
@id='ch-system-strippingagain'">
<xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(@id='ch-tools-stripping') and
not(@id='ch-system-strippingagain')">
<xsl:text>set -e&#xA;</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
<xsl:if test="(sect2[@role='installation'])">
<xsl:text>cd $PKGDIR&#xA;</xsl:text>
<xsl:if test="@id='ch-system-uclibc'">
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
</xsl:if>
<!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
<xsl:if test="@id='ch-tools-embryo-toolchain' or
@id='ch-tools-cocoon-toolchain' or
@id='ch-system-butterfly-toolchain'">
<xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
<xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
</xsl:if>
<xsl:if test="@id='ch-tools-cocoon-toolchain' or
@id='ch-system-butterfly-toolchain'">
<xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
</xsl:if>
<!-- ONLY butterfly has a testsuite -->
<xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
<xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
</xsl:if>
<!-- END SVN toolchain format -->
</xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:if test="not(@id='ch-system-chroot') and
not(@id='ch-system-revisedchroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit</xsl:text>
</exsl:document>
</xsl:if>
</xsl:template>
<xsl:template match="screen">
<xsl:if test="(@condition=$model or not(@condition)) and
(@vendor=$kernel or not(@vendor)) and
child::* = userinput and (not(@role) or
(@role and contains($features,concat(',',@role,','))))">
<xsl:apply-templates select="userinput" mode="screen"/>
</xsl:if>
</xsl:template>
<xsl:template match="para/userinput">
<xsl:if test="(contains(string(),'test') or
contains(string(),'check')) and
($testsuite = '2' or $testsuite = '3')">
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'make')"/>
<xsl:text>make -k</xsl:text>
<xsl:value-of select="substring-after(string(),'make')"/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="userinput" mode="screen">
<xsl:choose>
<!-- grsecurity kernel in the host? -->
<xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
contains(string(),'sysctl')
and $grsecurity_host ='n'"/>
<!-- Setting $LANG for /etc/profile -->
<xsl:when test="ancestor::sect1[@id='bootable-profile'] and
contains(string(),'export LANG=')">
<xsl:value-of select="substring-before(string(),'export LANG=')"/>
<xsl:text>export LANG=</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:value-of select="substring-after(string(),'CC]')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Copying the kernel config file -->
<xsl:when test="string() = 'make mrproper'">
<xsl:text>make mrproper&#xA;</xsl:text>
<xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
</xsl:when>
<!-- No interactive commands are needed if the .config file is the proper one -->
<xsl:when test="string() = 'make menuconfig'"/>
<!-- For uClibc we need to set CONFIG_SITE -->
<xsl:when test="contains(string(),'CONFIG_SITE')">
<xsl:value-of select="substring-before(string(),'export')"/>
<xsl:text>echo "export</xsl:text>
<xsl:value-of select="substring-after(string(),'export')"/>
<xsl:text>" &gt;&gt; ~/.bashrc&#xA;</xsl:text>
</xsl:when>
<!-- For uClibc we need to cd to the Gettext package -->
<xsl:when test="contains(string(),'cd gettext-runtime/')">
<xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
<xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- The Coreutils and Module-Init-Tools test suites are optional -->
<xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
ancestor::sect1[@id='ch-system-module-init-tools']) and
(contains(string(),'check') or
contains(string(),'distclean') or
contains(string(),'dummy'))">
<xsl:choose>
<xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
<xsl:otherwise>
<xsl:if test="not(contains(string(),'check'))">
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:if>
<xsl:if test="contains(string(),'check')">
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:value-of select="substring-before(string(),'check')"/>
<xsl:text>-k check</xsl:text>
<xsl:value-of select="substring-after(string(),'check')"/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Fixing butterfly toolchain test suite run -->
<xsl:when test="ancestor::sect1[@id='ch-system-butterfly-toolchain']
and string() = 'make -k check'">
<xsl:choose>
<xsl:when test="$testsuite != '0'">
<xsl:choose>
<xsl:when test="$bomb-testsuite = 'n'">
<xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
<xsl:if test="contains(string(),' -k ')">
<xsl:text> || true</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- Fixing Glbc test suite -->
<xsl:when test="contains(string(),'rm -v configparms') and
contains(string(),'-fno-stack-protector')">
<xsl:choose>
<xsl:when test="$testsuite != '0'">
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(string(),'glibc-check-log')">
<xsl:choose>
<xsl:when test="$testsuite != '0'">
<xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
<xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- Fixing Cocoon sanity checks -->
<xsl:when test="contains(string(),'./strcat-overflow')">
<xsl:text>set +e&#xA;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#xA;set -e&#xA;</xsl:text>
</xsl:when>
<!-- Fixing Butterfly sanity checks -->
<xsl:when test="contains(string(),'./fortify-test')
or contains(string(),'./ssp-test')">
<xsl:text>! </xsl:text>
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/>
<xsl:text> || true&#xA;</xsl:text>
</xsl:when>
<!-- The rest of commands -->
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="literal">
<xsl:if test="(@condition=$model or not(@condition)) and
(@vendor=$kernel or not(@vendor))">
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<xsl:template match="replaceable">
<xsl:choose>
<xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
ancestor::sect1[@id='ch-system-uclibc']">
<xsl:value-of select="$timezone"/>
</xsl:when>
<xsl:when test="ancestor::sect1[@id='ch-system-groff']">
<xsl:value-of select="$page"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>**EDITME</xsl:text>
<xsl:apply-templates/>
<xsl:text>EDITME**</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,659 +0,0 @@
#!/bin/bash
set -e # Enable error trapping
# $Id$
###################################
### FUNCTIONS ###
###################################
#----------------------------#
process_toolchain() { # embryo,cocoon and butterfly need special handling
#----------------------------#
local toolchain=$1
local this_file=$2
local tc_phase
local binutil_tarball
local gcc_core_tarball
local TC_MountPT
local remove_existing
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@' -e 's,'$N',,'`
case $tc_phase in
embryo | \
cocoon) # Vars for LUSER phase
remove_existing="remove_existing_dirs"
TC_MountPT="\$(MOUNT_PT)\$(SRC)"
;;
butterfly) # Vars for CHROOT phase
remove_existing="remove_existing_dirs2"
TC_MountPT="\$(SRC)"
;;
esac
#
# Safe method to remove existing toolchain dirs
binutil_tarball=$(get_package_tarball_name "binutils")
gcc_core_tarball=$(get_package_tarball_name "gcc-core")
(
cat << EOF
@\$(call ${remove_existing},$binutil_tarball)
@\$(call ${remove_existing},$gcc_core_tarball)
EOF
) >> $MKFILE.tmp
#
# Manually remove the toolchain directories..
(
cat << EOF
@rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
rm -rf ${TC_MountPT}/${tc_phase}-build
EOF
) >> $MKFILE.tmp
(
cat << EOF
@echo "export PKGDIR=${TC_MountPT}" > envars
EOF
) >> $MKFILE.tmp
case ${tc_phase} in
butterfly)
[[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${toolchain}"
CHROOT_wrt_RunAsRoot "$this_file"
;;
*) LUSER_wrt_RunAsUser "$this_file"
;;
esac
#
(
cat << EOF
@\$(call ${remove_existing},$binutil_tarball)
@\$(call ${remove_existing},$gcc_core_tarball)
EOF
) >> $MKFILE.tmp
#
# Manually remove the toolchain directories..
(
cat << EOF
@rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
rm -rf ${TC_MountPT}/${tc_phase}-build
EOF
) >> $MKFILE.tmp
}
#----------------------------#
chapter3_Makefiles() { # Initialization of the system
#----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ( SETUP ) ${R_arrow}"
# If $LUSER_HOME is already present in the host, we asume that the
# hlfs user and group are also presents in the host, and a backup
# of their bash init files is made.
(
cat << EOF
020-creatingtoolsdir:
@\$(call echo_message, Building)
@mkdir \$(MOUNT_PT)/tools && \\
rm -f /tools && \\
ln -s \$(MOUNT_PT)/tools /
@\$(call housekeeping)
021-addinguser: 020-creatingtoolsdir
@\$(call echo_message, Building)
@if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\
touch luser-exist; \\
fi;
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
chmod a+wt \$(SRCSDIR)
@\$(call housekeeping)
022-settingenvironment: 021-addinguser
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi;
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
echo "HLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
echo "export HLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
echo "" >> \$(LUSER_HOME)/.bashrc && \\
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
chmod -R a+wt \$(MOUNT_PT) && \\
touch envars && \\
chown \$(LUSER) envars
@\$(call housekeeping)
EOF
) >> $MKFILE.tmp
chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
}
#----------------------------#
chapter5_Makefiles() { # Bootstrap or temptools phase
#----------------------------#
local file
local this_script
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
for file in chapter05/* ; do
# Keep the script file name
this_script=`basename $file`
# Skip this script depending on jhalfs.conf flags set.
case $this_script in
# If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
*tcl* ) [[ "$TEST" = "0" ]] && continue; ;;
*expect* ) [[ "$TEST" = "0" ]] && continue; ;;
*dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;;
# Test if the stripping phase must be skipped
*stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
*) ;;
esac
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
chapter5="$chapter5 $this_script"
# Grab the name of the target
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
# Adjust 'name'
case $name in
uclibc) name="uClibc" ;;
esac
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
# This is a very special script and requires manual processing
# NO Optimization allowed
if [[ ${name} = "embryo-toolchain" ]] || \
[[ ${name} = "cocoon-toolchain" ]]; then
LUSER_wrt_target "$this_script" "$PREV"
process_toolchain "${this_script}" "${file}"
wrt_touch
PREV=$this_script
continue
fi
#
LUSER_wrt_target "$this_script" "$PREV"
# Find the version of the command files, if it corresponds with the building of
# a specific package. Fix GCC tarball name for 2.4-branch.
case $name in
gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;;
* ) pkg_tarball=$(get_package_tarball_name $name) ;;
esac
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
# Insert instructions for unpacking the package and to set the PKGDIR variable.
LUSER_wrt_unpack "$pkg_tarball"
# If using optimizations, write the instructions
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
# Insert date and disk usage at the top of the log file, the script run
# and date and disk usage again at the bottom of the log file.
LUSER_wrt_RunAsUser "${file}"
# Remove the build directory(ies) except if the package build fails
# (so we can review config.cache, config.log, etc.)
if [ "$pkg_tarball" != "" ] ; then
LUSER_RemoveBuildDirs "$name"
fi
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done # end for file in chapter05/*
}
#----------------------------#
chapter6_Makefiles() { # sysroot or chroot build phase
#----------------------------#
local file
local this_script
# Set envars and scripts for iteration targets
if [[ -z "$1" ]] ; then
local N=""
else
local N=-build_$1
local chapter6=""
mkdir chapter06$N
cp chapter06/* chapter06$N
for script in chapter06$N/* ; do
# Overwrite existing symlinks, files, and dirs
sed -e 's/ln -s /ln -sf /g' \
-e 's/^mv /&-f /g' \
-e 's/mkdir -v/&p/g' -i ${script}
# Rename the scripts
mv ${script} ${script}$N
done
# Remove Bzip2 binaries before make install
sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N
# Fix how Module-Init-Tools do the install target
sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools$N
# Don't readd already existing groups
sed -e '/groupadd/d' -i chapter06$N/*-udev$N
fi
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
for file in chapter06$N/* ; do
# Keep the script file name
this_script=`basename $file`
# Skip this script depending on jhalfs.conf flags set.
case $this_script in
# We'll run the chroot commands differently than the others, so skip them in the
# dependencies and target creation.
*chroot* ) continue ;;
# Test if the stripping phase must be skipped
*-stripping* ) [[ "$STRIP" = "n" ]] && continue ;;
# Skip linux-headers in iterative builds
*linux-headers*) [[ -n "$N" ]] && continue ;;
esac
# Grab the name of the target
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
case $name in
uclibc) name="uClibc" ;;
esac
# Find the version of the command files, if it corresponds with the building of
# a specific package. Fix GCC tarball name for 2.4-branch.
case $name in
gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;;
* ) pkg_tarball=$(get_package_tarball_name $name) ;;
esac
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in
*stripping*) ;;
*) continue ;;
esac
fi
# Append each name of the script files to a list (this will become
# the names of the targets in the Makefile
case "${this_script}" in
*kernfs* ) runasroot=" ${this_script}" ;;
* ) chapter6="$chapter6 ${this_script}" ;;
esac
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
if [[ ${name} = "butterfly-toolchain" ]]; then
CHROOT_wrt_target "${this_script}" "$PREV"
# Touch timestamp file if installed files logs will be created.
# But only for the firt build when running iterative builds.
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_TouchTimestamp
fi
process_toolchain "${this_script}" "${file}"
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi
wrt_touch
PREV=$this_script
continue
fi
# kernfs is run in SUDO target
case "${this_script}" in
*kernfs* ) LUSER_wrt_target "${this_script}" "$PREV" ;;
* ) CHROOT_wrt_target "${this_script}" "$PREV" ;;
esac
# If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
if [ "$pkg_tarball" != "" ] ; then
# Touch timestamp file if installed files logs will be created.
# But only for the firt build when running iterative builds.
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$pkg_tarball"
# If the testsuites must be run, initialize the log file
# butterfly-toolchain tests are enabled in 'process_tookchain' function
# 2.4-branch toolchain is ernabled here.
case $name in
glibc | gcc | binutils)
[[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" ;;
* ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}" ;;
esac
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
# In kernfs we need to set HLFS and not to use chroot.
case "${this_script}" in
*kernfs* ) wrt_RunAsRoot "${file}" ;;
* ) CHROOT_wrt_RunAsRoot "${file}" ;;
esac
#
# Write installed files log and remove the build directory(ies)
# except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then
CHROOT_wrt_RemoveBuildDirs "$name"
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi
fi
#
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
# Keep the script file name for Makefile dependencies.
PREV=${this_script}
# Set system_build envar for iteration targets
system_build=$chapter6
done # end for file in chapter06/*
}
#----------------------------#
chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..etc
#----------------------------#
local file
local this_script
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7 ( BOOT ) ${R_arrow}"
for file in chapter07/*; do
# Keep the script file name
this_script=`basename $file`
case $this_script in
*grub) continue ;; # Grub must be configured manually.
*console) continue ;; # Use the file generated by lfs-bootscripts
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab
;;
*kernel) # If no .config file is supplied, the kernel build is skipped
[[ -z $CONFIG ]] && continue
cp $CONFIG $BUILDDIR/sources/kernel-config
;;
esac
# First append then name of the script file to a list (this will become
# the names of the targets in the Makefile
chapter7="$chapter7 $this_script"
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
CHROOT_wrt_target "$this_script" "$PREV"
case "${this_script}" in
*bootscripts*)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack $(get_package_tarball_name "lfs-bootscripts")
blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
;;
*kernel)
name="linux"
pkg_tarball=$(get_package_tarball_name $name)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$pkg_tarball"
;;
esac
case "${this_script}" in
*fstab*) # Check if we have a real /etc/fstab file
if [[ -n "$FSTAB" ]] ; then
CHROOT_wrt_CopyFstab
else
CHROOT_wrt_RunAsRoot "$file"
fi
;;
*) # All other scripts
CHROOT_wrt_RunAsRoot "${file}"
;;
esac
# Remove the build directory except if the package build fails.
case "${this_script}" in
*bootscripts*)
(
cat << EOF
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
rm -r \$(SRC)/\$\$ROOT
@rm -rf \`cat sources-dir\` && \\
rm sources-dir
EOF
) >> $MKFILE.tmp
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi
;;
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi ;;
esac
# Include a touch of the target name so make can check if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
# Keep the script file name for Makefile dependencies.
PREV=$this_script
done # for file in chapter07/*
}
#----------------------------#
build_Makefile() { # Construct a Makefile from the book scripts
#----------------------------#
echo "Creating Makefile... ${BOLD}START${OFF}"
cd $JHALFSDIR/${PROGNAME}-commands
# Start with a clean Makefile.tmp file
>$MKFILE.tmp
chapter3_Makefiles
chapter5_Makefiles
chapter6_Makefiles
# Add the iterations targets, if needed
[[ "$COMPARE" = "y" ]] && wrt_compare_targets
chapter7_Makefiles
# Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
# Add the BLFS_TOOL targets, if needed
[[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
# Add a header, some variables and include the function file
# to the top of the real Makefile.
wrt_Makefile_header
# Add chroot commands
CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
i=1
for file in chapter06/*chroot* ; do
chroot=`cat $file | \
sed -e "s@chroot@$CHROOT_LOC@" \
-e '/#!\/bin\/bash/d' \
-e '/^export/d' \
-e '/^logout/d' \
-e 's@ \\\@ @g' | \
tr -d '\n' | \
sed -e 's/ */ /g' \
-e 's|\\$|&&|g' \
-e 's|exit||g' \
-e 's|$| -c|' \
-e 's|"$$HLFS"|$(MOUNT_PT)|'\
-e 's|set -e||' \
-e 's|set +h||'`
echo -e "CHROOT$i= $chroot\n" >> $MKFILE
i=`expr $i + 1`
done
# Drop in the main target 'all:' and the chapter targets with each sub-target
# as a dependency.
(
cat << EOF
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
@sudo make do-housekeeping
@echo "$VERSION - jhalfs build" > hlfs-release && \\
sudo install -m444 hlfs-release \$(MOUNT_PT)/etc/hlfs-release
@\$(call echo_finished,$VERSION)
ck_UID:
@if [ \`id -u\` = "0" ]; then \\
echo "--------------------------------------------------"; \\
echo "You cannot run this makefile from the root account"; \\
echo "--------------------------------------------------"; \\
exit 1; \\
fi
mk_SETUP:
@\$(call echo_SU_request)
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@
mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request)
@(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
@sudo make restore-luser-env
@touch \$@
mk_SUDO: mk_LUSER
@sudo make SUDO
@touch \$@
mk_CHROOT: mk_SUDO
@if [ ! -e \$(MOUNT_PT)/dev ]; then \\
mkdir \$(MOUNT_PT)/dev && \\
sudo mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3 && \\
sudo mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1 && \\
sudo chown -R 0:0 \$(MOUNT_PT)/dev; \\
fi;
@\$(call echo_CHROOT_request)
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
@touch \$@
mk_BOOT: mk_CHROOT
@\$(call echo_CHROOT_request)
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
@touch \$@
mk_CUSTOM_TOOLS: create-sbu_du-report
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
(sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi;
@touch \$@
mk_BLFS_TOOL: mk_CUSTOM_TOOLS
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
(sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
fi;
@touch \$@
SETUP: $chapter3
LUSER: $chapter5
SUDO: $runasroot
CHROOT: SHELL=/tools/bin/bash
CHROOT: $chapter6
BOOT: $chapter7
CUSTOM_TOOLS: $custom_list
BLFS_TOOL: $blfs_tool
create-sbu_du-report: mk_BOOT
@\$(call echo_message, Building)
@if [ "\$(ADD_REPORT)" = "y" ]; then \\
./create-sbu_du-report.sh logs $VERSION; \\
\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
fi;
@touch \$@
restore-luser-env:
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
fi;
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
touch \$@ && \\
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
do-housekeeping:
@-umount \$(MOUNT_PT)/dev/pts
@-umount \$(MOUNT_PT)/dev/shm
@-umount \$(MOUNT_PT)/dev
@-umount \$(MOUNT_PT)/sys
@-umount \$(MOUNT_PT)/proc
@-rm /tools
@-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\
rm -rf \$(LUSER_HOME); \\
fi;
EOF
) >> $MKFILE
# Bring over the items from the Makefile.tmp
cat $MKFILE.tmp >> $MKFILE
rm $MKFILE.tmp
echo "Creating Makefile... ${BOLD}DONE${OFF}"
}

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# $Id$
################################### ###################################
### FUNCTIONS ### ### FUNCTIONS ###
################################### ###################################
@ -10,276 +8,199 @@
############################################################# #############################################################
#----------------------------# #-------------------------#
chapter4_Makefiles() { # chapter_targets() { #
#----------------------------# #-------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}" # $1 is the chapter number. Pad it with 0 to the left to obtain a 2-digit
# number:
printf -v dir chapter%02d $1
# If $LUSER_HOME is already present in the host, we asume that the # $2 contains the build number if rebuilding for ICA
# lfs user and group are also presents in the host, and a backup if [[ -z "$2" ]] ; then
# of their bash init files is made.
(
cat << EOF
020-creatingtoolsdir:
@\$(call echo_message, Building)
@mkdir \$(MOUNT_PT)/tools && \\
rm -f /tools && \\
ln -s \$(MOUNT_PT)/tools /
@\$(call housekeeping)
021-addinguser: 020-creatingtoolsdir
@\$(call echo_message, Building)
@-if [ ! -d \$(LUSER_HOME) ]; then \\
groupadd \$(LGROUP); \\
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
else \\
touch luser-exist; \\
fi;
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
chmod a+wt \$(SRCSDIR)
@\$(call housekeeping)
022-settingenvironment: 021-addinguser
@\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
fi;
@if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
fi;
@echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
echo "LFS_TGT=`uname -m`-lfs-linux-gnu" >> \$(LUSER_HOME)/.bashrc && \\
echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
echo "export LFS LC_ALL LFS_TGT PATH" >> \$(LUSER_HOME)/.bashrc && \\
echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
touch envars && \\
chown \$(LUSER) envars
@\$(call housekeeping)
EOF
) > $MKFILE.tmp
chapter4=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
}
#----------------------------#
chapter5_Makefiles() {
#----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
for file in chapter05/* ; do
# Keep the script file name
this_script=`basename $file`
# If no testsuites are run, then TCL, Expect, DejaGNU and Check
# aren't needed (but building them does not hurt).
# Fix also locales creation when running chapter05 testsuites (ugly)
case "${this_script}" in
# *tcl) [[ "${TEST}" = "0" ]] && continue ;;
# *expect) [[ "${TEST}" = "0" ]] && continue ;;
# *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
# *check) [[ "${TEST}" = "0" ]] && continue ;;
*stripping) [[ "${STRIP}" = "n" ]] && continue ;;
*glibc) [[ "${TEST}" = "3" ]] && \
sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
esac
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
# DO NOT append the changingowner script, it need be run as root.
# A hack is necessary: create script in chap5 BUT run as a dependency for
# SUDO target
case "${this_script}" in
*changingowner) runasroot="$runasroot ${this_script}" ;;
*) chapter5="$chapter5 ${this_script}" ;;
esac
# Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
# and binutils in chapter 5)
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' \
-e 's@-pass[0-9]\{1\}@@' \
-e 's@-libstdc++@@'`
# Set the dependency for the first target.
if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Find the name of the tarball and the version of the package
pkg_tarball=$(get_package_tarball_name $name)
pkg_version=$(get_package_version $pkg_tarball)
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version"
# If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then
# Insert instructions for unpacking the package and to set the PKGDIR variable.
LUSER_wrt_unpack "$pkg_tarball"
# If the testsuites must be run, initialize the log file
[[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}" "$pkg_version"
# If using optimizations, write the instructions
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
# Insert date and disk usage at the top of the log file, the script run
# and date and disk usage again at the bottom of the log file.
# The changingowner script must be run as root.
case "${this_script}" in
*changingowner) wrt_RunAsRoot "$file" "$pkg_version" ;;
*) LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
esac
# Remove the build directory(ies) except if the package build fails
# (so we can review config.cache, config.log, etc.)
if [ "$pkg_tarball" != "" ] ; then
case "${name}" in
*xz-utils) LUSER_RemoveBuildDirs "xz" ;;
*) LUSER_RemoveBuildDirs "$name" ;;
esac
fi
# Include a touch of the target name so make can check
# if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
# Keep the script file name for Makefile dependencies.
PREV=${this_script}
done # end for file in chapter05/*
}
#----------------------------#
chapter6_Makefiles() {
#----------------------------#
# Set envars and scripts for iteration targets
if [[ -z "$1" ]] ; then
local N="" local N=""
else else
local N=-build_$1 local N=-build_$2
local chapter6="" local CHROOT_TGT=""
mkdir chapter06$N mkdir ${dir}$N
cp chapter06/* chapter06$N cp ${dir}/* ${dir}$N
for script in chapter06$N/* ; do for script in ${dir}$N/* ; do
# Overwrite existing symlinks, files, and dirs # Overwrite existing symlinks, files, and dirs
sed -e 's/ln *-sv/&f/g' \ sed -e 's/ln *-sv/&f/g' \
-e 's/mv *-v/&f/g' \ -e 's/mv *-v/&f/g' \
-e 's/mkdir *-v/&p/g' -i ${script} -e 's/mkdir *-v/&p/g' -i ${script}
# Suppress the mod of "test-installation.pl" because now
# the library path points to /usr/lib
if [[ ${script} =~ glibc ]]; then
sed '/DL=/,/unset DL/d' -i ${script}
fi
# Rename the scripts # Rename the scripts
mv ${script} ${script}$N mv ${script} ${script}$N
done done
# Remove Bzip2 binaries before make install (LFS-6.2 compatibility) # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i ${dir}$N/*-bzip2$N
# Remove openssl-<version> from /usr/share/doc (LFS-9.x), because
# otherwise the mv command creates an openssl directory.
sed -e 's@mv -v@rm -rfv /usr/share/doc/openssl-*\n&@' \
-i ${dir}$N/*-openssl$N
fi fi
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}" echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter $1$N${R_arrow}"
for file in chapter06$N/* ; do for file in ${dir}$N/* ; do
# Keep the script file name # Keep the script file name
this_script=`basename $file` this_script=`basename $file`
# Skip the "stripping" scripts if the user does not want to strip. # Some scripts need peculiar actions:
# Skip also linux-headers in iterative builds. # - Stripping at the end of system build: lfs.xsl does not generate
# correct commands if the user does not want to strip, so skip it
# in this case
# - do not reinstall linux-headers when rebuilding
# - grub config: must be done manually; skip it
# - handle fstab and .config. Skip kernel if .config not supplied
case "${this_script}" in case "${this_script}" in
*stripping*) [[ "${STRIP}" = "n" ]] && continue ;; *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
*linux-headers*) [[ -n "$N" ]] && continue ;; *linux-headers*) [[ -n "$N" ]] && continue ;;
8*grub) (( nb_chaps == 5 )) && continue ;;
10*grub) continue ;;
*fstab) [[ -z "${FSTAB}" ]] ||
[[ ${FSTAB} == $BUILDDIR/sources/fstab ]] ||
cp ${FSTAB} $BUILDDIR/sources/fstab ;;
*kernel) [[ -z ${CONFIG} ]] && continue
[[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] ||
cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
esac esac
# Grab the name of the target
# This is only used to check the name in "opt_override" or "BLACKLIST"
name=`echo ${this_script} | sed -e 's@[0-9]\{3,4\}-@@' \
-e 's@-pass[0-9]\{1\}@@' \
-e 's@-libstdc++@@' \
-e 's,'$N',,' \
-e 's@-32@@'`
# Grab the name of the target. # Find the name of the tarball and the version of the package
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'` # If it doesn't exist, we skip it in iterations rebuilds (except stripping
# and revisedchroot, where .a and .la files are removed).
# Find the tarball corresponding to our script. pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
# If it doesn't, we skip it in iterations rebuilds (except stripping). pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
pkg_tarball=$(get_package_tarball_name $name)
pkg_version=$(get_package_version $pkg_tarball)
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in case "${this_script}" in
*stripping*) ;; *stripping*|*cleanup*|*revised*) ;;
*) continue ;; *) continue ;;
esac esac
fi fi
# Append each name of the script files to a list (this will become # Append the name of the script to a list. The name of the
# the names of the targets in the Makefile) # list is contained in the variable Makefile_target. We adjust this
# The kernfs script must be run as part of SUDO target. # variable at various points. Note that it is initialized to "SETUP"
# in the main function, before calling this function for the first time.
case "${this_script}" in case "${this_script}" in
*kernfs) runasroot="$runasroot ${this_script}" ;; *settingenvironment) Makefile_target=LUSER_TGT ;;
*) chapter6="$chapter6 ${this_script}" ;; *changingowner ) Makefile_target=SUDO_TGT ;;
*creatingdirs ) Makefile_target=CHROOT_TGT ;;
*bootscripts ) Makefile_target=BOOT_TGT ;; # case of sysv book
*network ) Makefile_target=BOOT_TGT ;; # case of systemd book
esac esac
eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target # Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function. # as a dependency. Also call the echo_message function.
# In the mount of kernel filesystems we need to set LFS case $Makefile_target in
# and not to use chroot. CHROOT_TGT) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
case "${this_script}" in *) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
*kernfs) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
*) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
esac esac
# If $pkg_tarball isn't empty, we've got a package... # If $pkg_tarball isn't empty, we've got a package...
# Insert instructions for unpacking the package and changing directories
if [ "$pkg_tarball" != "" ] ; then if [ "$pkg_tarball" != "" ] ; then
# Touch timestamp file if installed files logs will be created. # Touch timestamp file if installed files logs shall be created.
# But only for the firt build when running iterative builds. # But only for the final install chapter and not when rebuilding it
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then if [ "${INSTALL_LOG}" = "y" ] &&
(( 1+nb_chaps <= $1 )) &&
[ "x$N" = x ] ; then
CHROOT_wrt_TouchTimestamp CHROOT_wrt_TouchTimestamp
fi fi
CHROOT_Unpack "$pkg_tarball" # Always initialize the test log file, since the test instructions may
# If the testsuites must be run, initialize the log file # be "uncommented" by the user
case $name in case $Makefile_target in
binutils | gcc | glibc | gmp | mpfr ) CHROOT_TGT) CHROOT_wrt_test_log "${this_script}" "$pkg_version" ;;
[[ "$TEST" != "0" ]] && LUSER_TGT ) LUSER_wrt_test_log "${this_script}" "$pkg_version" ;;
CHROOT_wrt_test_log "${this_script}" "$pkg_version"
;;
* )
[[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] &&
CHROOT_wrt_test_log "${this_script}" "$pkg_version"
;;
esac esac
# If using optimizations, write the instructions
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
# In the mount of kernel filesystems we need to set LFS # If using optimizations, write the instructions
# and not to use chroot. case "${OPTIMIZE}$1${nb_chaps}${this_script}${REALSBU}" in
0* | *binutils-pass1y | 15* | 167* | 177*) ;;
*kernel*) ;; # No CFLAGS for kernel
*) wrt_optimize "$name" ;;
esac
# There is no need to tweak MAKEFLAGS anymore, this is done
# by lfs.xsl. But still, NINJAJOBS needs to be set if
# N_PARALLEL is defined.
if [ -n "N_PARALLEL" ]; then
wrt_makeflags "$name" "$JH_MAKEFLAGS" "$N_PARALLEL"
fi
fi # end of package specific instructions
# Some scriptlet have a special treatment; otherwise standard
case "${this_script}" in case "${this_script}" in
*kernfs) wrt_RunAsRoot "$file" "$pkg_version" ;; *addinguser)
*) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;; (
# /var/lib may already exist and be owned by root if blfs tools
# have been installed.
cat << EOF
@if [ -f luser-id ]; then \\
function useradd() { true; }; \\
function groupadd() { true; }; \\
export -f useradd groupadd; \\
fi; \\
export LFS=\$(MOUNT_PT) && \\
\$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@ 2>&1; \\
\$(PRT_DU) >>logs/\$@
@chown \$(LUSER):\$(LGROUP) envars
@if [ -d "\$(MOUNT_PT)/var/lib" ]; then \\
chown \$(LUSER):\$(LGROUP) \$(MOUNT_PT)/var/lib; \\
fi
@chmod -R a+wt $JHALFSDIR
@chmod a+wt \$(SRCSDIR)
EOF
) >> $MKFILE.tmp
;;
*settingenvironment)
(
cat << EOF
@cd && \\
function source() { true; } && \\
export -f source && \\
\$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@ 2>&1 && \\
sed 's|/mnt/lfs|\$(MOUNT_PT)|' -i .bashrc && \\
echo source $JHALFSDIR/envars >> .bashrc
@\$(PRT_DU) >>logs/\$@
EOF
) >> $MKFILE.tmp
;;
*fstab) if [[ -n "$FSTAB" ]]; then
CHROOT_wrt_CopyFstab
else
CHROOT_wrt_RunAsRoot "$file"
fi
;;
*)
# Insert date and disk usage at the top of the log file, the script
# run and date and disk usage again at the bottom of the log file.
case "${Makefile_target}" in
SETUP_TGT | SUDO_TGT) wrt_RunAsRoot "$file" "$pkg_version" ;;
LUSER_TGT) LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
CHROOT_TGT | BOOT_TGT) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
esac
;;
esac esac
# Write installed files log and remove the build directory(ies) # Write installed files log and remove the build directory(ies)
# except if the package build fails. # except if the package build fails.
if [ "$pkg_tarball" != "" ] ; then if [ "$pkg_tarball" != "" ] ; then
case "${name}" in if [ "${INSTALL_LOG}" = "y" ] &&
*xz-utils) CHROOT_wrt_RemoveBuildDirs "xz" ;; (( 1+nb_chaps <= $1 )) &&
*) CHROOT_wrt_RemoveBuildDirs "$name" ;; [ "x${N}" = "x" ] ; then
esac CHROOT_wrt_LogNewFiles "${this_script}"
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi fi
fi fi
@ -293,134 +214,59 @@ chapter6_Makefiles() {
# Keep the script file name for Makefile dependencies. # Keep the script file name for Makefile dependencies.
PREV=${this_script} PREV=${this_script}
# Set system_build envar for iteration targets # Set "system_build" var for iteration targets
system_build=$chapter6 if [ -z "$N" ] && (( 1+nb_chaps == $1 )); then
done # end for file in chapter06/* system_build="$system_build $this_script"
fi
done # end for file in $dir/*
# Set "system_build" when rebuilding: note the CHROOT_TGT is local
# in that case.
if [ -n "$N" ]; then
system_build="$CHROOT_TGT"
fi
} }
#----------------------------#
chapter78_Makefiles() {
#----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}"
for file in chapter0{7,8}/* ; do
# Keep the script file name
this_script=`basename $file`
# Grub must be configured manually.
# Handle fstab creation.
# If no .config file is supplied, the kernel build is skipped
case ${this_script} in
*grub) continue ;;
*fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
*kernel) [[ -z ${CONFIG} ]] && continue
cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
esac
# First append each name of the script files to a list (this will become
# the names of the targets in the Makefile
chapter78="$chapter78 ${this_script}"
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
CHROOT_wrt_target "${this_script}" "$PREV"
# Find the bootscripts or networkscripts (for systemd)
# and kernel package names
case "${this_script}" in
*bootscripts)
name="lfs-bootscripts"
pkg_tarball=$(get_package_tarball_name $name)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$pkg_tarball"
;;
*network-scripts)
name="lfs-network-scripts"
pkg_tarball=$(get_package_tarball_name $name)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$pkg_tarball"
;;
*kernel)
name="linux"
pkg_tarball=$(get_package_tarball_name $name)
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_TouchTimestamp
fi
CHROOT_Unpack "$pkg_tarball"
# If using optimizations, use MAKEFLAGS (unless blacklisted)
# no setting of CFLAGS and friends.
[[ "$OPTIMIZE" != "0" ]] && wrt_makeflags "$name"
;;
esac
# Check if we have a real /etc/fstab file
case "${this_script}" in
*fstab) if [[ -n $FSTAB ]]; then
CHROOT_wrt_CopyFstab
else
CHROOT_wrt_RunAsRoot "$file"
fi
;;
*) CHROOT_wrt_RunAsRoot "$file"
;;
esac
case "${this_script}" in
*bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy"
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi ;;
*network-scripts) CHROOT_wrt_RemoveBuildDirs "dummy"
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi ;;
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
if [ "${INSTALL_LOG}" = "y" ] ; then
CHROOT_wrt_LogNewFiles "$name"
fi ;;
esac
# Include a touch of the target name so make can check
# if it's already been made.
wrt_touch
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
# Keep the script file name for Makefile dependencies.
PREV=${this_script}
done # for file in chapter0{7,8}/*
}
#----------------------------# #----------------------------#
build_Makefile() { # build_Makefile() { #
#----------------------------# #----------------------------#
echo "Creating Makefile... ${BOLD}START${OFF}" echo "Creating Makefile... ${BOLD}START${OFF}"
cd $JHALFSDIR/${PROGNAME}-commands cd "$JHALFSDIR/$COMMANDS"
# Start with a clean Makefile.tmp file # Start with empty files
>$MKFILE >$MKFILE
>$MKFILE.tmp
chapter4_Makefiles # Ensure the first dependency is empty
chapter5_Makefiles unset PREV
chapter6_Makefiles
# Add the iterations targets, if needed # We begin with the SETUP target; successive targets will be assigned in
[[ "$COMPARE" = "y" ]] && wrt_compare_targets # the chapter_targets function.
chapter78_Makefiles Makefile_target=SETUP_TGT
# We need to know the chapter numbering, which depends on the version
# of the book. Use the number of subdirs to know which version we have
chaps=($(echo chapter*))
nb_chaps=${#chaps[*]} # 5 if classical version, 7 if new version
# DEBUG
# echo chaps: ${chaps[*]}
# echo nb_chaps: $nb_chaps
# end DEBUG
# Make a temporary file with all script targets
for (( i = 4; i < nb_chaps+4; i++ )); do
chapter_targets $i
if (( i == nb_chaps )); then : # we have finished temporary tools
# Add the save target, if needed
[[ "$SAVE_CH5" = "y" ]] && wrt_save_target $Makefile_target
fi
if (( i == 1+nb_chaps )); then : # we have finished final system
# Add the iterations targets, if needed
[[ "$COMPARE" = "y" ]] && wrt_compare_targets $i
fi
done
# Add the CUSTOM_TOOLS targets, if needed # Add the CUSTOM_TOOLS targets, if needed
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
@ -443,12 +289,41 @@ build_Makefile() { #
i=`expr $i + 1` i=`expr $i + 1`
done done
# Drop in the main target 'all:' and the chapter targets with each sub-target # If CPUSET is defined and not equal to "all", then we define a first target
# as a dependency. # that calls a script which re-enters make calling target all
if [ -n "$CPUSET" ] && [ "$CPUSET" != all ]; then
( (
cat << EOF cat << EOF
all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS all-with-cpuset:
@CPUSPEC="\$(CPUSET)" ./run-in-cgroup.sh \$(MAKE) all
EOF
) >> $MKFILE
fi
# Drop in the main target 'all:' and the chapter targets with each sub-target
# as a dependency. Also prevent running targets in parallel.
(
cat << EOF
.NOTPARALLEL:
all: ck_UID ck_terminal mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
@sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
EOF
) >> $MKFILE
# With systemd, the commands in chapter 9 do not create a
# valid /etc/resolv.conf, so that if blfs_tools are installed, and
# make-ca is run, it cannot connect. In this case, resolv.conf
# from the host has been copied, and we need to remove it now.
if [ "$INITSYS" = systemd ]; then
(
cat << EOF
@sudo rm -v \$(MOUNT_PT)/etc/resolv.conf
EOF
) >> $MKFILE
fi
(
cat << EOF
@sudo make do_housekeeping @sudo make do_housekeeping
@echo $VERSION > lfs-release && \\ @echo $VERSION > lfs-release && \\
sudo mv lfs-release \$(MOUNT_PT)/etc && \\ sudo mv lfs-release \$(MOUNT_PT)/etc && \\
@ -461,6 +336,15 @@ all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_
> lsb-release && \\ > lsb-release && \\
sudo mv lsb-release \$(MOUNT_PT)/etc && \\ sudo mv lsb-release \$(MOUNT_PT)/etc && \\
sudo chown root:root \$(MOUNT_PT)/etc/lsb-release sudo chown root:root \$(MOUNT_PT)/etc/lsb-release
@/bin/echo -e -n \\
NAME=\\"Linux From Scratch\\"\\\\n\\
VERSION=\\"$VERSION\\"\\\\n\\
ID=lfs\\\\n\\
PRETTY_NAME=\\"Linux From Scratch $VERSION\\"\\\\n\\
VERSION_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
> os-release && \\
sudo mv os-release \$(MOUNT_PT)/etc && \\
sudo chown root:root \$(MOUNT_PT)/etc/os-release
@\$(call echo_finished,$VERSION) @\$(call echo_finished,$VERSION)
ck_UID: ck_UID:
@ -471,123 +355,174 @@ ck_UID:
exit 1; \\ exit 1; \\
fi fi
ck_terminal:
@stty size | ( read L C; \\
if (( L < 24 )) || (( C < 80 )) ; then \\
echo "--------------------------------------------------"; \\
echo "Terminal too small: \$\$C columns x \$\$L lines";\\
echo "Minimum: 80 columns x 24 lines";\\
echo "--------------------------------------------------"; \\
exit 1; \\
fi )
mk_SETUP: mk_SETUP:
@\$(call echo_SU_request) @\$(call echo_SU_request)
@sudo make save-luser
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
@touch \$@ @touch \$@
mk_LUSER: mk_SETUP mk_LUSER: mk_SETUP
@\$(call echo_SULUSER_request) @\$(call echo_SULUSER_request)
@( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER" ) @\$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER"
@sudo make restore-luser-env @sudo make restore-luser
@touch \$@ @touch \$@
mk_SUDO: mk_LUSER mk_SUDO: mk_LUSER
@sudo rm -f envars
@sudo make BREAKPOINT=\$(BREAKPOINT) SUDO @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
@touch \$@ @touch \$@
mk_CHROOT: mk_SUDO mk_CHROOT: mk_SUDO devices
@\$(call echo_CHROOT_request) @\$(call echo_CHROOT_request)
@( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT") @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
@touch \$@ @touch \$@
mk_BOOT: mk_CHROOT mk_BOOT: mk_CHROOT devices
@\$(call echo_CHROOT_request) @\$(call echo_CHROOT_request)
@( sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT") @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
@touch \$@ @touch \$@
mk_BLFS_TOOL: create-sbu_du-report mk_BLFS_TOOL: create-sbu_du-report devices
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\ \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
(sudo \$(CHROOT2) -c "make -C $BLFS_ROOT/work"); \\ (sudo \$(CHROOT1) -c "make -C $BLFS_ROOT/work"); \\
fi; fi;
@touch \$@ @touch \$@
mk_CUSTOM_TOOLS: mk_BLFS_TOOL mk_CUSTOM_TOOLS: mk_BLFS_TOOL devices
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\ \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\ sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
(sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\ (sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
fi; fi;
@touch \$@ @touch \$@
devices: ck_UID devices: ck_UID
sudo mount -v --bind /dev \$(MOUNT_PT)/dev sudo env LFS=\$(MOUNT_PT) kernfs-scripts/devices.sh
sudo mount -vt devpts devpts \$(MOUNT_PT)/dev/pts EOF
sudo mount -vt proc proc \$(MOUNT_PT)/proc ) >> $MKFILE
sudo mount -vt sysfs sysfs \$(MOUNT_PT)/sys # With systemd, the commands in chapter 9 do not create a
sudo mount -vt tmpfs tmpfs \$(MOUNT_PT)/run # valid /etc/resolv.conf, so that if we want to enter chroot,
if [ -h \$(MOUNT_PT)/dev/shm ]; then \\ # and systemd has not yet been run (otherwise /etc/resolv.conf
sudo mkdir -p \$(MOUNT_PT)/\$\$(readlink \$(MOUNT_PT)/dev/shm); \\ # exists), we just copy resolv.conf from the host.
if [ "$INITSYS" = systemd ]; then
(
cat << EOF
if ! [ -e \$(MOUNT_PT)/etc/resolv.conf ]; then \\
sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/etc; \\
sudo touch \$(MOUNT_PT)/etc/.host-resolvconf; \\
fi fi
EOF
) >> $MKFILE
fi
(
cat << EOF
teardown: teardown:
sudo umount -v \$(MOUNT_PT)/sys sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
sudo umount -v \$(MOUNT_PT)/proc EOF
sudo umount -v \$(MOUNT_PT)/dev/pts ) >> $MKFILE
if mountpoint -q \$(MOUNT_PT)/run; then \\ # With systemd, the commands in chapter 9 do not create a
sudo umount -v \$(MOUNT_PT)/run; \\ # valid /etc/resolv.conf, so that if we want to enter chroot,
elif [ -h \$(MOUNT_PT)/dev/shm ]; then \\ # and systemd has not yet been run (otherwise /etc/resolv.conf
link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\ # exists), we just copy resolv.conf from the host.
sudo umount -v \$(MOUNT_PT)/\$\$link; \\ # We need to remove it now, if it has been created.
unset link; \\ if [ "$INITSYS" = systemd ]; then
else \\ (
sudo umount -v \$(MOUNT_PT)/dev/shm; \\ cat << EOF
if [ -e \$(MOUNT_PT)/etc/.host-resolvconf ]; then \\
sudo rm -v \$(MOUNT_PT)/etc/resolv.conf; \\
sudo rm -v \$(MOUNT_PT)/etc/.host-resolvconf; \\
fi fi
sudo umount -v \$(MOUNT_PT)/dev EOF
) >> $MKFILE
fi
(
cat << EOF
chroot: devices chroot1: devices
sudo \$(CHROOT2) -sudo \$(CHROOT1)
\$(MAKE) teardown \$(MAKE) teardown
SETUP: $chapter4 chroot: devices
LUSER: $chapter5 -sudo \$(CHROOT1)
SUDO: $runasroot \$(MAKE) teardown
CHROOT: SHELL=/tools/bin/bash
CHROOT: $chapter6
BOOT: $chapter78
CUSTOM_TOOLS: $custom_list
SETUP: $SETUP_TGT
LUSER: $LUSER_TGT
SUDO: $SUDO_TGT
EOF
) >> $MKFILE
# With systemd, the commands in chapter 9 do not create a
# valid /etc/resolv.conf, so that if blfs_tools are installed, and
# make-ca is run, it cannot connect. We just copy resolv.conf
# from the host. We'll remove it at the end.
if [ "$INITSYS" = systemd ]; then
(
cat << EOF
@cp -v /etc/resolv.conf \$(MOUNT_PT)/etc
EOF
) >> $MKFILE
fi
(
cat << EOF
CHROOT: SHELL=\$(filter %bash,\$(CHROOT1))
CHROOT: $CHROOT_TGT
BOOT: $BOOT_TGT
CUSTOM_TOOLS: $custom_list
create-sbu_du-report: mk_BOOT create-sbu_du-report: mk_BOOT
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ "\$(ADD_REPORT)" = "y" ]; then \\ @if [ "\$(ADD_REPORT)" = "y" ]; then \\
sudo ./create-sbu_du-report.sh logs $VERSION; \\ sudo ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\ \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
fi; fi
@touch \$@ @touch \$@
restore-luser-env: save-luser:
@\$(call echo_message, Building) @\$(call echo_message, Building)
@if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ @LUSER_ID=\$\$(grep '^\$(LUSER):' /etc/passwd | cut -d: -f3); \\
mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\ if [ -n "\$\$LUSER_ID" ]; then \\
fi; if [ ! -d \$(LUSER_HOME).XXX ]; then \\
@if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ mv \$(LUSER_HOME){,.XXX}; \\
mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\ mkdir \$(LUSER_HOME); \\
fi; chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
@chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* fi; \\
echo "\$\$LUSER_ID" > luser-id; \\
echo User \$(LUSER) exists with ID \$\$LUSER_ID; \\
else \\
rm -f luser-id; \\
echo User \$(LUSER) does not exist; \\
echo It will be created with book instructions.; \\
fi
@\$(call housekeeping)
restore-luser:
@\$(call echo_message, Building)
@if [ -f luser-id ]; then \\
rm -rf \$(LUSER_HOME); \\
mv \$(LUSER_HOME){.XXX,}; \\
rm luser-id; \\
else \\
userdel \$(LUSER); \\
groupdel \$(LGROUP); \\
rm -rf \$(LUSER_HOME); \\
fi
@\$(call housekeeping) @\$(call housekeeping)
do_housekeeping: do_housekeeping:
@-umount \$(MOUNT_PT)/sys @-rm -f /tools
@-umount \$(MOUNT_PT)/proc
@-if mountpoint -q \$(MOUNT_PT)/run; then \\
umount \$(MOUNT_PT)/run; \\
elif [ -h \$(MOUNT_PT)/dev/shm ]; then \\
link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
umount \$(MOUNT_PT)/\$\$link; \\
unset link; \\
else \\
umount \$(MOUNT_PT)/dev/shm; \\
fi
@-umount \$(MOUNT_PT)/dev/pts
@-umount \$(MOUNT_PT)/dev
@-rm /tools
@-if [ ! -f luser-exist ]; then \\
userdel \$(LUSER); \\
rm -rf \$(LUSER_HOME); \\
fi;
EOF EOF
) >> $MKFILE ) >> $MKFILE

353
LICENSE
View file

@ -1,340 +1,19 @@
GNU GENERAL PUBLIC LICENSE Copyright (C) 2005-2019, jhalfs team
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA of this software and associated documentation files (the "Software"), to deal
Everyone is permitted to copy and distribute verbatim copies in the Software without restriction, including without limitation the rights
of this license document, but changing it is not allowed. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Preamble The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The licenses for most software are designed to take away your THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
freedom to share and change it. By contrast, the GNU General Public IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
License is intended to guarantee your freedom to share and change free FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
software--to make sure the software is free for all its users. This AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
General Public License applies to most of the Free Software LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Foundation's software and to any other program whose authors commit to OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using it. (Some other Free Software Foundation software is covered by SOFTWARE
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -1,36 +1,23 @@
# From the Build Scripts Written By: Jim Gifford <lfs@jg555.com> # From the Build Scripts Written By: Jim Gifford <lfs@jg555.com>
# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org # Modified By: Joe Ciccone <jciccone@linuxfromscratch.org
# Additional changes: George Boudreau <georgeb@linuxfromscratch.org> # Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
# Manuel Canales Esparcia
# Pierre Labastie
TOPDIR=$(shell pwd)
CONFIG_CONFIG_IN = Config.in CONFIG_CONFIG_IN = Config.in
CONFIG = menu CONFIG = menu
all: menuconfig all: menuconfig
# @clear @$$(grep RUN_ME configuration 2>/dev/null | sed -e 's@RUN_ME=\"@@' -e 's@\"@@')
@`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' `
$(CONFIG)/conf: menuconfig:
$(MAKE) -C $(CONFIG) conf @cp -a configuration configuration.old 2>/dev/null || true
@CONFIG_="" KCONFIG_CONFIG=configuration \
$(CONFIG)/mconf: python3 $(CONFIG)/menuconfig.py $(CONFIG_CONFIG_IN)
$(MAKE) -C $(CONFIG) ncurses conf mconf
menuconfig: $(CONFIG)/mconf
-@cp -a configuration configuration.old
@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
config: $(CONFIG)/conf
@$(CONFIG)/conf $(CONFIG_CONFIG_IN)
# Clean up # Clean up
clean: clean:
rm -f configuration configuration.old error rm -f configuration configuration.old error
- $(MAKE) -C $(CONFIG) clean
clean-target: .PHONY: all menuconfig clean
rm -f error
- $(MAKE) -C $(CONFIG) clean
.PHONY: all menuconfig config clean clean-target

472
README
View file

@ -1,220 +1,371 @@
$Id$
1. INTRODUCTION:: 1. INTRODUCTION::
This collection of scripts, known as jhalfs, strives to create The scripts in this directory implement an automation of the building
accurate makefiles from the Linux From Scratch book series XML files. of a GNU/LInux system, as described in the Linux From Scratch book series.
This software is an evolution of the original "jhalfs-0.2" code developed The name of the project is jhalfs: in that name, "alfs" stands for
by Jeremy Huntwork. "automated linux from scratch", and the initials "jh" have been kept since
the original "jhalfs-0.2" code developed by Jeremy Huntwork.
The usage of this script assumes you have read and are familiar with The list of supported books can be found at
the book(s) and, therefore, the configuration variables found in menuconfig http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks (maybe outdated,
interface will have meaning to you. current develoment books and latest version are always supported).
The list of supported books can be found at The documentation is split among various README.* files. Here is a list
http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks of what is in which:
- README (this file): instructions to use the LFS book. This should be
enough if you just want to build a base system as per the LFS book. It
is also a required reading for all the other projects.
- README.BLFS: instructions to install an automated build infrastructure
for the BLFS book. There are two ways to do so: (i) install the
tools at the end of an LFS build, or
(ii) install the tools on an already running system. Both methods are
described in that file.
- README.CUSTOM: instructions to run custom commands either during the LFS
build, or at the end of a LFS build. Note that you will not find
instructions on how to write those commands, but some examples are
available.
- README.PACKAGE_MANAGEMENT: instructions to use package management during
the build (Note: the only package manager that is regularly tested is
porg)
NOTES:: Other sources of information are the context help in the menu interface,
*. The resulting Makefile takes considerable time to run to completion. and the LFS books themselves (both required readings of course!).
Lay in a supply of caffeine beverages.
*. It is recommended that you temporarily unpack your linux kernel,
run <make menuconfig>, configure the kernel as per the book and save
the resulting .config file. This suggestion also applies to the
configuration of the uClibc package when building a HLFS system using
uClibc rather than glibc.
*. Read carefully this file and the other README.* files before start
using the tool.
2. PREREQUISITES:: 2. PREREQUISITES::
To use this tool you MUST: It is strongly advised that you first build manually a complete system
before attempting to automate the build.
- have experience building {c,h,b}LFS packages
- know how to edit and write shell scripts
- know how a Makefile works
- be able to trace build failures and to find what is causing it
(user error, package bug, {c,h,b}LFS command bug, or jhalfs code bug)
If you do not have the above skills, please don't use this tool.
Of course the "Host System Requirements" should be fulfilled. Some
supplementary packages are needed for using jhalfs. They are detailed
at the bottom of the page:
https://www.linuxfromscratch.org/alfs/download.html. In short, you need
wget, sudo, libxml2, libxslt, docbook-4.5-xml, and docbook-xsl-nons.
3. INSTALLATION:: 3. INSTALLATION::
No installation is required. System-wide installation is not allowed. No installation is required. You may want to move the files in this
directory to a convenient location, and then follow the instructions below.
4. CONFIGURATION:: 4. CONFIGURATION::
We have installed the familiar menu based configuration tool driven by 4.1. CONFIGURATION OF THE TOOLS:
GNU make. see the section RUNNING, for details There is no configuration of the tools themselves. The various
parameters for the build are set through a menu driven interface. See
the section RUNNING below for details.
4.2. PRELIMINARY TASKS:
This tool has no support at all for creating a partition and a mount
point for the built system. You should follow the book up to the section
"Mounting the new partition". Note that the default name for the
partition mount point is "/mnt/build_dir", instead of /mnt/lfs.
You can change that default to anything you'd like in the menu, so you
may name it /mnt/lfs if you prefer . We'll use the name /mnt/build_dir
in the sequel.
For downloading packages, you can use the tool or download them
yourself. Even if using the tool, it is recommended to set up a source
repository where you store already downloaded packages. The tool will
automatically search a package in this repository before downloading it
if it is not found there. This repository cannot be the same as
/mnt/build_dir/sources. As an example, we'll use /usr/src. You should
arrange for the user running the tool to have write access to this
directory.
If you want to build the kernel as part of the automated build,
a configuration file must be provided. In order to do so, it is
recommended to download the kernel tarball, unpack it, run
<make menuconfig> (or any other *config), configure the kernel as per
the book, and save the resulting .config file to a location where it can
be retrieved later on. It is suggested to put it into the source
repository, with a versioned name, e.g.
/usr/src/config-<arch>-<kernel version>-<config details>.
Another file you may provide is the fstab file. As for the kernel
configuration, this file has to be prepared before running the menu.
You can copy-paste the file from the "Creating the /etc/fstab File"
page, then edit to suit the future lfs system layout, then save the
file. A convenient location and name is /usr/src/fstablfs.
At a more advanced level, you may want to supply custom commands
to be run at the end of LFS build. Scripts containing those commands
are located in the ./custom/config directory. Examples are given in
./custom/examples. A template is provided as ./custom/template. See
README.CUSTOM for more details.
5. RUNNING:: 5. RUNNING::
The command <make> will launch a menu based configuration program. You will IMPORTANT::
recognize the layout from building the kernel or uClibc/BusyBox. The
underlying menu code was borrowed from BusyBox and slightly modified for
our use.
Help on parameter function is available from the on-line help. Please
make use of that feature for additional information not in this file.
Once you have set the parameters you wish and have saved your work the
jhalfs script is launch. The script verify first that the host can run
it and build the xLFS system, then validate the configuration and present
you with your selections which you may accept or reject.
If you accepted the displayed settings jhalfs will proceed to create the
Makefile, optionally download packages.
IMPORTANT::
You must be logged as a normal user with sudo privileges to run You must be logged as a normal user with sudo privileges to run
the Makefile. Furthermore, you are supposed to have enough privilege the Makefile. Furthermore, you are supposed to have enough privilege
to become any user. If you are not bothered about security issues, to become any user. If you are not bothered about security issues,
the entry for the user "jhalfs_user" in /etc/sudoers could be the entry for the user running the tool in /etc/sudoers could be
jhalfs_user ALL=(ALL) NOPASSWD:ALL <user> ALL=(ALL) NOPASSWD:ALL
NOTE:: The command <make> will launch a menu based configuration program,
If you run the jhalfs script directly the only function you can select similar to the kernel "menuconfig" configuration tool.
is to display the version number running <./jhalfs -v>
6. BLFS_TOOL SUPPORT:: Help on parameter function is available from the on-line help (type the
character `?' after highlighting the parameter). Please do use the help:
it may contain additional information not duplicated in this file.
For books that support it (TODO: which ones?), there is an option MENU "BOOK Settings"
to install an automated framework for building BLFS packages. Let
us call it blfs-tool for now. When you tick `BOOK Settings/Add
blfs-tool support' in jhalfs configuration menu, the tools are
installed in $BLFS_ROOT (default /blfs_root) on the xLFS system,
and a few dependencies (which you may select) are built at the
end of the jhalfs run, before the custom tools. As of March 8, 2012,
works only with LFS. The instructions for building the dependencies
are taken from the BLFS book.
(TODO: is this relevant to present CLFS?) Use BOOK: You have three choices: LFS System V, LFS systemd, BLFS.
WARNING:: If you add blfs-tool support on a CLFS Sysroot build The BLFS part is described in README.BLFS
you MUST edit the scripts to fix the installation paths.
After booting the new xLFS system some steps are needed to finish Book version: You have two choices: "Branch" or "Working Copy"
the installation of the automated tools: Branch will have the tool clone the book's git repository. The
choice of the branch (actually any git commit) or of the file
location for the working copy is done in the next menu entry.
- A user account must be created. You must be logged on that user Multilib: Four choices: Normal LFS, Multilib with i686 libraries,
account to use blfs-tool. This is not strictly necessary, multilib with x32 libraries, multilib with all libraries.
since the packages can be built as root, too, but it is It is recommended to use "Normal LFS" unless you know what you
never a good idea to build packages as root. are doing
- Move /blfs-root to that user's home and change ownership of the Build method: two choices: chroot (as in book), boot
directory and files to the user. Presently, the "boot" method is not implemented, so keep the default.
- Give the user read and write privileges over the $TRACKING_DIR Add blfs-tools support (see README.BLFS)
directory and the files that it contains. This will install the blfs tools onto the newly built system. It
is not the same thing as choosing the BLFS book in the menu, which
will install the blfs tools on the currently running system.
- Configure sudo, adding the needed privileges for the user. For Add custom tools support (see README.CUSTOM)
newer sudo version, do not forget to add a line Defaults secure_path=
containing /sbin and /usr/sbin (in /etc/sudoers), otherwise some
executables are not found.
- Although it is not strictly necessary, it is recommended to install MENU "General Settings"
the bash shell startup files (as per `3.After LFS Configuration
Issues' of the BLFS book), as some instructions in BLFS rely on
their being present.
We assume that blfs-tool will be used on a running fresh xLFS system. Build Directory: the name of the root of the LFS system
To use it to build BLFS packages from the chroot jail is also possible, This is the equivalent of the LFS variable in the book. Set it
but not supported. to "/mnt/lfs" if you have followed the book for creating the LFS
partition and mount point.
To know how to use blfs-tool, see README.BLFS. Retrieve source files: Say y to have jhalfs download the packages
If you say no, you must download the packages yourself and put
them into the /mnt/build_dir/sources directory. Follow book's
chapter 3 instructions.
If you say yes, you'll be asked several other questions:
- Package Archive Directory: Repository of downloaded packages
This directory, which is on the host and should be writable
by the user running the tool, is for storing downloaded packages.
If you keep the default "$SRC_ARCHIVE", you can set this variable
to the absolute path of the repository and export it. Or if the
variable is not set, jhalfs downloads the sources directly to
/mnt/build_dir/sources.
Instead of using the SRC_ARCHIVE envar, you can also enter the
path of the repository directory into this field.
- Retry on 'connection refused' failure: self explanatory
- Number of retry attempts on download failures: self explanatory
- Download timeout (in seconds): self explanatory
7. LAYOUT:: Run the makefile: start the build immediately after running the tool
This is not the preferred method: it is recommended to rather
run "make -C /mnt/build_dir/jhalfs" after the tool has finished
setting up the build. But this may be handy if you are sure everything
is well, and want to leave the tool and the build run without
supervision.
/BLFS (see README.BLFS) Rebuild files: clean up the /mnt/build_dir directory
Say n if you want to rerun the tool (to update generated scripts
for example) without removing what has already been done. Otherwise,
say y. Note that there are some guards against removing a directory
containing useful things, but double check that the /mnt/build_dir
directory is really what you want to erase.
/CLFS/master.sh MENU "Build Settings"
/clfs.xsl
/CLFS2/master.sh MENU Parallelism settings
/clfs2.xsl - Use all cores:
If you say y, MAKEFLAGS will be set to "-j$(nproc)" at the
beginning of each script. Other envars are supposed to be passed
from the environment, as done in new books. Note that for old books,
this means the scripts using make or ninja will be run with all
cores, but not when this needs to set special envars like
TESTSUITEFLAGS. You can still define the number of cores used
in next field.
If you say n, you'll be asked for a static number of threads
to use.
- set of cpus to use, or 'all' for all cpus (only if using all cores):
You can define here the cores you want to use. See help for
details. This is the preferred way of reducing the number of cores
rather than using a static thread number.
- Number of parallel `make' jobs (only if not using all cores):
Every occurrence of $(nproc) in new books will be replaced with
the number entered here. Also MAKEFLAGS will be set to "-jN" (where
N is the number entered) at the beginning of each scripts. Furthermore
NINJAJOBS will be set to N in the environment. This allows to run all
books with N threads, except for paarts that need other envars to be
set
- Build Binutils pass1 without parallelism (Real SBU)
The standard SBU is defined as the time to run the binutils-pass1
build with only one thread. Saying y here allows to get a value for
it. If you say n, the value is not meaningful for SBU measurements.
/CLFS3/master.sh Run testsuites: say y to run the test suites
/clfs3.xsl You'll have the choice between running all the test suites, or only
those deemed critical (binutils, gmp, mpfr, mpc, and gcc).
/HLFS/master.sh Package management: see README.PACKAGE_MANAGEMENT
/hlfs.xsl
Create a log of installed files for each package: self explanatory
Strip Installed Binaries/Libraries: use the book instructions for
stripping
DO NOT use/display progress_bar (self explanatory)
MENU System configuration
Use a custom fstab file:
If you say y, you'll have to provide a file containing the fstab
for the LFS system. See above "preliminary tasks".
Build the kernel:
If you say y, you'll be asked for a file containing the kernel
configuration. See above "preliminary tasks".
Install non-wide-character ncurses (rarely used nowadays):
If you say y, the system will use instructions in the note on the
ncurses page to install those libraries.
TimeZone: set to the result of "tzselect"
Language: set to the result of the instructions on "The Bash Shell
Startup Files" page.
Install the full set of locales: installs all the locales known to
glibc.
Groff page size: choice between "A4" and "Letter".
Hostname: self explanatory
Network configuration: various fields for setting network. Look at
chapter 9 for background.
Console configuration: various fields for setting console, as described
in chapter 9.
MENU Advanced features:
Optimization: Optimization settings are done by editing files in the
"optimize" directory. The menu just allows you to choose between applying
optimizations only to the final chapter or to all the book. Say n for
a normal build
Create SBU and disk usage report: self explanatory
Save temporary system work: self explanatory (see help)
Run comparison analysis on final stage: build the system several times
using the preceding one, to test whether it is able to rebuild itself
identically. Don't use normally...
Internal Settings (WARNING: for jhalfs developers only): says it all
Once you have set the parameters and saved the configuration, the script
is launched. Its aim is to extract instructions from the selected book
to generate scripts, and to generate a Makefile, which allows running
the scripts in the right order. The script verifies first that the host
can run itself and build the xLFS system, then validates the configuration
and lists the parameters. At this point, you may choose to quit or to
continue with the listed parameters. The script will then proceed to
generate the Makefile and the build scripts, optionally download
packages, and eventually verify the host prerequisite. If you have
selected "Run the makefile", the command <make> is launched in the
adequate directory, and the build begins. If not, you'll have to run
"make" manually, for example: "make -C /mnt/build_dir/jhalfs", if you
have used the default parameters (see the layout under $BUILDDIR in the
Q&A below).
NOTE::
If you run the jhalfs script directly the only function you can select
is to display the version number by running <./jhalfs -v>
6. LAYOUT::
/BLFS/* (see README.BLFS)
/LFS/master.sh /LFS/master.sh
/lfs.xsl /lfs.xsl
/common/common_functions /common/chroot.xsl
/common_functions
/create-sbu_du-report.sh
/hostreqs.xsl
/kernfs.xsl
/makefile_functions /makefile_functions
/packages.xsl /packages.xsl
/urls.xsl
/create-sbu_du-report.sh
/progress_bar.sh /progress_bar.sh
/blfs-tool-deps/9xx-* /urls.xsl
/libs/func_* /libs/func_*
/custom/template /custom/examples/*
/config/ /config/* (needs to be created after cloning since it is an
/examples/* empty directory initially)
/examples_CLFS-E/* /template
/extras/do_copy_files /extras/do_copy_files
/do_ica_prep /do_ica_prep
/do_ica_work /do_ica_work
/farce
/filelist /menu/*
/optimize/opt_config /optimize/opt_config
/opt_override /opt_override
/optimize_functions /optimize_functions
/opt_config.d/noOpt /opt_config.d/noOpt
/noSymbols /noSymbols
/O2pipe
/O3pipe /O3pipe
/O3pipe_march /O3pipe_march
/defOpt_fPIC /defOpt_fPIC
/menu/* /pkgmngt/packageManager.xml.dpkg
/packageManager.xml.pacman
/packageManager.xml.porg
/packageManager.xml.template
/packInstall.sh.dpkg
/packInstall.sh.pacman
/packInstall.sh.porg
/packInstall.sh.template
CHEATSHEET
FUNCTION_LIST
LICENSE
README README
README.BLFS README.BLFS
README.CLFS
README.HLFS
README.CUSTOM README.CUSTOM
README.PACKAGE_MANAGEMENT
TODO TODO
LICENSE
Config.in Config.in
Makefile
jhalfs jhalfs
blfs-tool Makefile
8. FAQ:: 7. FAQ::
Q. "This 'help' file is very sparse" Q. "It doesn't work"
A. Yes, it is. This tool, jhalfs, is for those who understand the LFS books A. There are several reasons why it may be so. One possibility is the
and wish to automate the build. 99% of any problems that arise can be following: jhalfs was designed to work against the development versions
solved by reading the book(s). of the LFS series of books. Consequently changes in a book sometimes
break older versions of jhalfs. Before you start pulling out your hair,
Q. "It doesn't work!" download the latest version of jhalfs to see if that solves your
A. Yes it does, try >> make problem. Note that it may be the other way around. If you want to build
Remember you must have 'sudo' privileges. an old version of the book, you may have to downgrade your jhalfs
version.
Q. "It still doesn't work"
A. jhalfs was designed to work against the development versions of the LFS
series of books. Consequently changes in a book(s) sometimes breaks older
versions of jhalfs. Before you start pulling out your hair download the
latest version of jhalfs to see if that solves your problem.
Q. "How do I specify the build location?" Q. "How do I specify the build location?"
A. The original LFS document worked against the well known location /mnt/lfs. A. The original LFS document worked against the well known location
This script automates the build of all of the LFS series of books and uses /mnt/lfs. This script automates the build of all of the LFS series of
a generic location $BUILDDIR with a default value of /mnt/build_dir. books and uses a generic location $BUILDDIR with a default value of
You may change this value to suit your needs. /mnt/build_dir. You may change this value to suit your needs.
The layout below $BUILDDIR is as follows. The layout below $BUILDDIR is as follows.
$BUILDDIR/ $BUILDDIR/
jhalfs (Makefile, cmd scripts, logs, etc..) jhalfs (Makefile, cmd scripts, logs, etc..)
sources (where packages reside) sources (where packages reside)
tools (temporary bootstrap system) tools (temporary cross compiler)
cross-tools (temporary CLFS only)
... ...
FHS dir structure FHS dir structure
... ...
@ -222,10 +373,10 @@ $Id$
Q. "What is the function of the SRC_ARCHIVE variable?" Q. "What is the function of the SRC_ARCHIVE variable?"
A. When jhalfs runs and packages download was selected, it creates a local A. When jhalfs runs and packages download was selected, it creates a local
copy of the necessary packages in BUILDDIR/sources by downloading the copy of the necessary packages in $BUILDDIR/sources by downloading the
files. If the variable SRC_ARCHIVE is defined the software will first files. If the variable SRC_ARCHIVE is defined the software will first
look in this location for the file and, if found, will copy it to look in this location for the file and, if found, will copy it to
BUILDDIR/sources. $BUILDDIR/sources.
If the files are not found in SRC_ARCHIVE _and_ you have write priv to If the files are not found in SRC_ARCHIVE _and_ you have write priv to
the directory any downloaded files will be mirrored there. the directory any downloaded files will be mirrored there.
@ -238,37 +389,9 @@ $Id$
Q. "Why have 2 copies of the files?" Q. "Why have 2 copies of the files?"
A. The package files must be visible during the chroot phase and this is a A. The package files must be visible during the chroot phase and this is a
simple and reliable method of doing so. This method also handles the CLFS simple and reliable method of doing so. This method also handles the
boot build method where the final build may be done on a separate machine. boot build method where the final build may be done on a separate
machine.
Q. "What is the function of "User account" and "Group account" menu settings?"
A. If you are running jhalfs from a low or non-privileged account you may not
have the priv to create/delete the user needed to build temporary tools.
These settings allow you to use your own user and group name to do that
build steps.
These variables are adjustable also when invoking make:
$BUILDDIR make LUSER=myaccount LGROUP=mygroup
The only changes to your account will be the creation of a NEW .bashrc
after saving your original to .bashrc.XXX
Q. "When I try to build CLFS the Makefile fails at the mid-point"
A. There could be numerous reasons for the failure but the most likely reason
is you are doing a cross-build using the 'chroot' method and the target is
not compatible with the host. If you choose to build using the chroot
method a test is performed at the end of the temptools phase. If the test
succeeds the build continues inside a chroot jail. However if the test fails
it means the host and target are not compatible an you should use the
'boot' method to create your target code.
As an extreme example: You can build a sparc target on a x86 platform but
only the temptools phase. You must select the 'boot' method and not the
'chroot.' You must transfer the toolchain to a sparc platform, reboot the
sparc box and continue the build.
Of all the LFS series of books Cross-LFS requires the greatest
understanding of host/target hardware combination. Please read the book
carefully and don't skip the easy parts (there are none..)
Q. "How could I stop the build at a predefined chosen point?" Q. "How could I stop the build at a predefined chosen point?"
A. Launch the Makefile manually passing the last numbered target to be build A. Launch the Makefile manually passing the last numbered target to be build
@ -286,3 +409,4 @@ $Id$
Authors: Authors:
George Boudreau George Boudreau
Manuel Canales Esparcia Manuel Canales Esparcia
Pierre Labastie

View file

@ -1,11 +1,5 @@
$Id$
1. INTRODUCTION:: 1. INTRODUCTION::
If you want to add blfs-tool support into an xLFS base system build,
read the "BLFS_TOOL SUPPORT" section found in the README and be sure
to follow the after-booting installation intructions.
To automate package builds from the BLFS book instructions is a huge To automate package builds from the BLFS book instructions is a huge
task. Some of the issues are: the BLFS book isn't linear; some package task. Some of the issues are: the BLFS book isn't linear; some package
pages use a custom layout; there are circular dependencies; several pages use a custom layout; there are circular dependencies; several
@ -17,26 +11,156 @@ $Id$
build scripts and Makefile will work "as is", thus, as a general rule, build scripts and Makefile will work "as is", thus, as a general rule,
you will need to review and edit the scripts while reading the book. you will need to review and edit the scripts while reading the book.
The blfs tools allow also to update packages from the LFS book. LFS
packages which may be updated appear in the menu interface. When selected,
their scriptlet is generated in the same manner as for BLFS packages.
(TODO: presently, when an LFS package needs a patch, you'll have to
donwload it manually to your $SRC_ARCHIVE directory (usually /sources)).
2. PREREQUISITES:: 2. PREREQUISITES::
To use this tool you MUST: In addition to a full LFS system, the following packages and their
dependencies are needed by this tool:
- required: libxml2, libxslt, DocBook XML DTD
- recommended: wget (to download the package tarballs) and sudo (to build
as a user)
- optional: lynx (allows to read the generated linearized book), GPM (to
cut and paste commands from the book), git (to update the book
sources)
Note that the optional dependencies are recommended for ease of use of the
tool.
- have experience building BLFS packages You should also have the following personal skills:
- know how to edit and write shell scripts - Ability to write and debug shell scripts: as said in the introduction,
- know how a Makefile works not all the generated scripts can be used directly. They need to be
- be able to trace build failures and to find what is causing it edited to produce an error free build.
(user error, package bug, BLFS command bug, or jhalfs code bug) - Ability to debug build failures, like missing dependencies or
installation directories not known to the system (when you install in
/opt for example).
- Ability to choose the tools you need to configure and administrate
your system: in the BLFS book, nothing is mandatory, nothing is
useless. You are on your own in choosing what to build, but wrong
decisions may lead to a non functional system...
If you do not have the above skills, please don't use this tool. 3. INSTALL::
There are two ways to install the BLFS tools on an LFS system, described
in paragraphs 3.1 and 3.2, respectively:
3. USAGE:: 3.1 INSTALLATION ON A RUNNING SYSTEM
Due to the complexity of the BLFS book, the scripts and Makefile Select "Use Book --> Beyond Linux From Scratch" in the jhalfs menu:
generation is done in several steps: The tools are installed in $HOME$BLFS_ROOT (the default for $BLFS_ROOT
is /blfs_root). The BLFS book is downloaded or copied to its directory.
The tracking directory (see below) is created (if it does not already
exist) and initialized. Before running "make", you should ensure the
tracking directory (default location /var/lib/jhalfs/BLFS) can be:
- either created by the user running "make", if it does not exist
- or that it is writable by the user running "make", if it exists.
3.1 INSTALLED PACKAGES TRACKING SYSTEM:: After the intallation, you should perform the following additional steps:
- Configure sudo, adding the needed privileges for the user.
- Although it is not strictly necessary, it is recommended to install
the bash shell startup files (as per `3. After LFS Configuration
Issues' of the BLFS book), as some instructions in BLFS rely on
their being present.
- At this point, the tool has no way to know which versions of LFS packages
are installed, so that the menu interface will show all the LFS packages,
as if they were not installed. If you have a released version of LFS, or
the date of your GIT version of LFS is known, you should run the
update-lfs.sh script. If you have updated some
LFS packages since first installation, or have been using a custom
working copy of the LFS book, the only (tedious) way is to create
empty files with names <package>-<installed-version> in the tracking
directory, and run the tool.
- If you have also installed some BLFS packages, they are not in the
tracking file. The only way is to create empty files with names
<package>-<installed-version> in the tracking directory, and run the tool.
3.2 INSTALLATION ON A JUST BUILT LFS SYSTEM
For books that support it (only LFS),
there is an option to install the BLFS tools right after building
the LFS system: just tick `BOOK Settings/Add blfs-tool support' in
jhalfs configuration menu. The tools are installed in $BLFS_ROOT
(default /blfs_root) on the LFS system, and the dependencies are built
at the end of the jhalfs run, before the custom tools.
After booting the new LFS system some steps are needed to finish
the installation of the automated tools:
- A user account must be created. You must be logged on that user
account to use blfs-tool. This is not strictly necessary,
since the packages can be built as root, too, but it is
never a good idea to build packages as root.
- Move /blfs-root to that user's home and change ownership of the
directory and files to the user.
- Give the user read and write privileges over the $TRACKING_DIR
directory and the files that it contains.
- Configure sudo and add the bash shell startup files, as described
above
- Note that the versions of LFS packages are automatically known to
the tool in this case, and there is no need to run the update-lfs.sh
script.
We assume that the BLFS tools will be used on a booted LFS system.
Using them to build BLFS packages in a chroot jail is also possible,
but not supported.
3.3 DIRECTORY LAYOUT IN THE $BLFS_ROOT DIRECTORY
blfs-xml/* GIT tree of the selected BLFS book version
lfs-xml/* GIT tree of the selected LFS book version
lib/constants.inc functions libraries
/func_dependencies for building the dependency tree
menu/* menuconfig source code
xsl/gen_pkg_list.xsl XSL stylesheet to generate the package database
/gen_config.xsl XSL stylesheet to generate the Config.in file
for use in the menuconfig system
/dependencies.xsl XSL stylesheet to generate the dependency list
of a package
/make_book.xsl XSL stylesheet to generate the linear book.xml
/lfs_make_book.xsl XSL stylesheet to incoporate LFS pages into the
linear book.xml
/scripts.xsl XSL stylesheet to generate the scriptlets from
book.xml
/bump.xsl XSL stylesheet to update the tracking file
/process-install.xsl XSL stylesheet included by scripts.xsl, for
outputting cleanly install instructions
/process-replaceable.xsl XSL stylesheet included by scripts.xsl, for
generating correct instructions when a
<replaceable> tag is encountered.
README.BLFS this file
TODO developers notes (well, not updated often)
gen_pkg_book.sh resolves dependencies, generates a linear BLFS
book, and finally generates build scripts
gen-makefile.sh generates the target Makefile
progress_bar.sh the target Makefile progress bar
gen-special.sh Helper script for generating the package
database
Makefile Used by make to update the package database
from the GIT tree, then launch the menuconfig
interface, and run gen_pkg_book.sh based on
configuration settings
packdesc.dtd a simple DTD describing the format of the
package database and the tracking file.
Working files: several files are generated when first running the tool:
packages.xml auto-generated package database
Config.in input file for the menu driven choices
configuration file generated by the menuconfig process
dependencies/* files recording the dependency tree
book.xml the linearized book
book-html/* the linearized book rendered in html
scripts/* the scriptlets
3.4 INSTALLED PACKAGES TRACKING SYSTEM:
This tool includes a very simple tracking system to log which packages This tool includes a very simple tracking system to log which packages
have been installed using the tool. It is used to skip installed packages have been installed using the tool. It is used to skip installed packages
@ -47,135 +171,83 @@ $Id$
The tracking system itself is an XML file: instpkg.xml. It is The tracking system itself is an XML file: instpkg.xml. It is
initialized when <make> is first run in blfs_root. It resides in a initialized when <make> is first run in blfs_root. It resides in a
directory, which is created when needed during the process of building directory, which is created when needed during the process of building
custom tools or blfs dependencies, right after xLFS. You can specify custom tools or blfs dependencies, right after LFS. You can specify
that directory location in the blfs-tools submenu of jhalfs. You may that directory location in the blfs-tools sub-menu of jhalfs. You may
need to update permissions and/or ownership of this directory before need to update permissions and/or ownership of this directory before
using the blfs tool (see README in jhalfs). using the blfs tool (see README in jhalfs).
The default location of the tracking directory is /var/lib/jhalfs/BLFS. The default location of the tracking directory is /var/lib/jhalfs/BLFS.
NB : after the initial build, that directory is only used to contain NB : after the initial build, that directory is only used to contain
instpkg.xml, unless custom tools have been built. In the latter case, instpkg.xml, unless custom tools have been built. In the latter case,
it also contains empty files whose name are $PKG-$VERSION for each it also contains empty files whose name are "$PKG-$VERSION" for each
versionned package built. The information about those packages is versionned package built. The information about those packages is
included into instpkg.xml the next time the tool is run. included into instpkg.xml the next time the tool is run.
3.2 BLFS_TOOL INSTALLATION:: 4. USAGE::
3.2.1 Normal install
The tools are installed just after the building of xLFS, if the
appropriate options have been selected in the building menu, as per
jhalfs README. If you forgot to select the options and xLFS has been
built, it is possible to go back to selecting the appropriate
BLFS tools options in the jhalfs menu, then tick `Run makefile'
and not `Rebuild files'. You obtain a /blfs_root directory in the
root directory of the new xLFS system, which contains the followings:
blfs-xml/* SVN tree of the selected BLFS book version
lib/constants.inc functions libraries
/func_dependencies for building the dependency tree
menu/* lxdialog and menuconfig source code
xsl/gen_pkg_list.xsl XSL stylesheet to generate the package database
/gen_config.xsl XSL stylesheet to generate the Config.in file
for use in the menuconfig system
/dependencies.xsl XSL stylesheet to generate the dependency list
of a package
/make_book.xsl XSL stylesheet to generate the linear book.xml
/scripts.xsl XSL stylesheet to generate the scriptlets from
book.xml
/bump.xsl XSL stylesheet to generate to update the tracking
file
README.BLFS this file
TODO developers notes (well, not updated often)
gen_pkg_book.sh resolves dependencies and generates linear BLFS
books and build scripts
gen-makefile.sh generates the target Makefile
progress_bar.sh the target Makefile progress bar
gen-special.sh Helper script for generating the package database
Makefile Used by make to update the package database from
the SVN tree, then launch the menuconfig interface,
and run gen_pkg_book.sh based on configuration
settings
packdesc.dtd a simple DTD describing the format of the package
database and the tracking file.
envars.conf envars needed when running the target build scripts
3.2.2 Install to an already running LFS/BLFS system
If you forgot to install the tools when building xLFS, or want to try
the tools, you can just run the install-blfs-tools.sh script. It will
create the above hierarchy in your home directory and intialize the
tracking file. You have first to make sure that the tracking dir exists
and is writable by the user. You may also populate it with (empty) files
whose names are of the form package-version, for installed packages, so
that they are included into the tracking file.
3.3.3 Working files
Several files are generated during the process:
packages.xml auto-generated packages database
Config.in input file for the menu driven choices
configuration file generated by the menuconfig process
dependencies/* files recording the dependency tree
book.xml the linearized book
book-html/* the linearized book rendered in html
scripts/* the scriptlets
From now on, all the work must be done from inside the installation From now on, all the work must be done from inside the installation
root directory. root directory.
You may move that directory to the $HOME of a non root user, or build Due to the complexity of the BLFS book, the scripts and Makefile
as root from that directory. generation is done in several steps:
3.3 UPDATING BOOK SOURCES:: 4.1 UPDATING BOOK SOURCES::
If you are using the development book version and you want to update If you are using the development book version and you want to update
installed packages to the latest version found in that book, you need to installed packages to the latest version found in that book, you need to
update the XML sources and packages database. This is not necessary if update the XML sources and packages database. To do that, run
you just built xLFS, and you can skip to step 3.4. "make update". This is not necessary if you just built LFS, and you
can skip to step 4.2.
To do that, run "make update". It may happen that the subversion
version of your building host is older than the version you just
built. This may generate weird errors like "'.' omitted". The easiest
thing to do in that case, is to completely remove the blfs-xml directory
and run "make update". With recent versions of subversion, you can also
run "svn upgrade" from inside the blfs-xml directory.
On the next configuration run, packages already installed but listed On the next configuration run, packages already installed but listed
with a new version in the book will be available for target selection with a new version in the book will be available for target selection
and used to solve dependencies. and used to solve dependencies.
3.4 CONFIGURING AND PARSING THE BOOK:: 4.2 CONFIGURING AND PARSING THE BOOK::
The next step is to create a book and build scripts in dependency The next step is to create a book and build scripts in dependency
build order for one or several packages. build order for one or several packages.
Run <make> to launch the configuration interface. The main menu contains Run <make> to launch the configuration interface. The main menu contains
two blocks: individual package selection, and build options. four blocks: individual package selection, Build settings, Build layout,
and Optimization.
In the build options section, the dependencies level and default packages In the package selection block, menus and submenus are organized
used to solve alternatives are set (currently, only for the MTA). You can as the book's parts, chapters and sections. You can navigate those menus
also select whether the build will be made as a normal user or as root. and select as many targets as you want. But we suggest to not select
Those settings are saved to be reused in future configuration runs.
Note that you may select as many targets as you want, not just one
as in the previous version of this tool. But we suggest to not select
too many at a time to be able to sort issues! too many at a time to be able to sort issues!
When you are done with the menu, a few checks occur, and the book is In the "Build settings" submenu, the dependency level and default
generated. When circular dependencies are found, a 3 line message is packages used to solve alternatives are set (currently, only for the MTA).
printed: You can also select whether the build will be made as a normal user or as
A is a dependency of B root, whether to use "porg style" package management, whether to remove
C is a dependency of A ".la" files, and wheter statistics for the package are generated (build
A is a dependency of C time, memory footprint and "DESTDIR" install). If you use package
and a question: management, you have to enter the path to the packInstall.sh script too.
Do you want to build A first?
This means that the system has found the dependency chain: B->A->C->A. In the "Build layout" submenu, you can select where the source tarballs
You have therefore to choose whether A is built before C, or reside and are downloaded, where the packages are built, and whether to
C before A: the system cannot make that choice (well, maybe in a few keep the build tree after installation.
year, with an AI system able to understand the book). If you answer no,
C is built first. If you answer yes, C is put in place of A as a dependency In the "Optimization" submenu, you can select the number of parallel
of B, then the tree dependency restarts from there, that is with the jobs, and set the usual CFLAGS, CXXFLAGS, and LDFLAGS. the special
layout B->C->... You may then hit the case B->C->A->C, for which you keyword "EMPTY" can be used for those flags to ensure they are unset.
should answer no, unless you want to enter an infinite (human driven)
loop;-) Note that there are help strings associated to those menus. Please
read them for details!
Those settings are saved to be reused in future configuration runs.
When you are done with the menu, a few checks occur, and the dependency
chain is generated. Each dependency appears with its priority (required,
recommended, optional, or external), and it's level. There is a root level
1. The selected packages have level 2. The dependencies of selected packages
have level 3, the dependencies of the dependencies have level 4, and so on.
When circular dependencies are found, they appear with a priority of
"circular". This means that two (or more) dependency chains arrive at the
same package. The algorithm chooses the chain with the highest priority and
reorders dependencies to remove the other chain(s). This is not always the
solution an user would prefer, but we have found no way to do it better.
You end up with a book.xml file which contains the linearized book, You end up with a book.xml file which contains the linearized book,
and a rendered HTML, in the directory book-html, which you can browse with and a rendered HTML, in the directory book-html, which you can browse with
@ -184,10 +256,10 @@ $Id$
Furthermore, there is a directory "scripts", which contains the generated Furthermore, there is a directory "scripts", which contains the generated
scriptlets. scriptlets.
There is also another directory, "dependencies" that contains files There is yet another directory, "dependencies" that contains files
generated while resolving dependencies. generated while resolving dependencies.
3.5 EDITING BUILD SCRIPTS:: 4.3 EDITING BUILD SCRIPTS::
Now it is time to review the generated book and scripts, making any Now it is time to review the generated book and scripts, making any
changes to the scripts necessary to fix generation bugs or to suit your changes to the scripts necessary to fix generation bugs or to suit your
@ -198,99 +270,105 @@ $Id$
"bar" before "foo" package and the "foo" script is named "064-z-foo", you "bar" before "foo" package and the "foo" script is named "064-z-foo", you
just need to create a "064-y-bar" build script. just need to create a "064-y-bar" build script.
Remember, the package tracking system isn't a package management tool Remember, the package tracking system isn't a package management tool
and knows nothing about packages not in the BLFS book. and knows nothing about packages not in the BLFS book.
Also, review and edit envars.conf. This file is used to set global envars 4.4 CREATING THE MAKEFILE::
needed by the build scripts.
3.6 CREATING THE MAKEFILE::
When the build scripts are ready to be run, the Makefile can be When the build scripts are ready to be run, the Makefile can be
created. Create an empty directory (for example "mkdir work") and cd created. Create an empty subdirectory (for example "mkdir work") and cd
to that directory. Then run ../gen-makefile.sh to that directory. Then run ../gen-makefile.sh. Note that the directory
is completely emptied before generating the Makefile, so to prevent
erasing useful data, the script ensures that the name of the current
working directory starts with "work".
Review the Makefile, and, if all looks sane, start the build by running Review the Makefile, and, if all looks sane, start the build by running
"make". "make".
4. GENERATED BUILD SCRIPTS ISSUES:: 5. GENERATED BUILD SCRIPTS ISSUES::
In this section, known issues with the generated build scripts are In this section, known issues with the generated build scripts are
discussed. They are due to build procedures and/or BLFS layout discussed. They are due to build procedures and/or BLFS layout
particularities that we can't handle. In several cases, editing the particularities that we can't handle. In several cases, editing the
build scripts is mandatory. build scripts is mandatory.
You may also need to insert some build scripts created by you to resolve You may also need to insert some build scripts created by you to resolve
unhandled dependencies and/or to remove some script installing the affected unhandled dependencies and/or to remove some script installing an unneeded
package by hand. package (unneeded packages may be pulled in the dependency chain, if
they occur as an "or" with another package).
When there are circular dependencies (only one known in BLFS 8.0 for
recommended dependencies), you may need to move around scripts so that they
run in the order script-A script-B script-A. This involves copying script-A
to another name (using the xxx-a- fields), and possibly renaming the xxx-a-
fields of each involved script.
4.1 BLFS BOOTSCRIPTS:: 5.1 BLFS BOOTSCRIPTS::
Normally, bootscript installation should work. On the other hand, the Normally, bootscript installation should work. On the other hand, the
book does not give instruction for running them, so you might have to book does not give instruction for running them, so you might have to
manually insert /etc/init.d/rc.d/<initscript> at some place during the build. manually insert "/etc/init.d/rc.d/<initscript> start" at some place during
the build.
4.2 PACKAGE CONFIGURATION:: 5.2 PACKAGE CONFIGURATION::
For those packages that have a "Configuration" section, you should For those packages that have a "Configuration" section, you should
edit the build script to fit the needs of your system. Sometimes, the edit the build script to fit the needs of your system. Sometimes, the
bash startup files are modified (see for example the instructions for bash startup files are modified. The generated scripts contain a
llvm). The shipped 'envars.conf' contains a line 'source /etc/profile', line 'source /etc/profile', which ensures that the proper environment
which ensures that the proper environment variables are used. variables are used.
4.3 GCC, JDK, Sane, and KDE-multimedia, freetype2, MesaLib and others 5.3 PAGES WITH TWO OR MORE PACKAGES::
For example: sane, poppler, audacious, freetts, which, etc.
On the pages for those packages, the BLFS book actually has instructions On the pages for those packages, the BLFS book actually has instructions
to download and install two or more packages. You must edit the scripts to to download and install two or more packages. You must edit the scripts to
fix this. fix this. A common pitfall is that the variable PACKAGE may be used for
several tarballs. Be sure to save the PACKAGE variable to some other
name (for example PKG1, PKG2, etc) after each download. The unpacking
instructions may need to be repeated for each tarball in turn.
We will try to fix some of them, but this may not be possible. 5.4 XORG7
4.4 XORG7 The book has special page layouts for the Xorg7 packages. The tool
breaks those pages into individual pages for each packages in the linear
book. Also, the menu gives the choice to select each package individually.
The generated scripts for Xorg7 packages have $SRC_ARCHIVE To build the whole Xorg7 chapter, select xinit. The (recommended)
support for individual packages, but not for patches nor *.wget and *.md5 dependency chain brings in the whole set of Xorg packages.
files.
If you have previously downloaded the patches, you must edit 5.5 PATCHES
the scripts to use your local packages.
The *.wget and *.md5 files should be downladed always from inside
the scripts to be sure that the most current individual packages are
used. Thus don't reuse previously existing ones.
In the script for xorg7-font, be sure to move the fonts directories
symlinks creation to after the "for ... done" loop.
4.5 PATCHES
Please, make sure that all scripts have the commands to download/apply Please, make sure that all scripts have the commands to download/apply
the required patches. Due to book layout issues, some patches may be the required patches. Due to book layout issues, some patches may be
missing. missing (as of BLFS 8.0, all the patches seem to be downloaded).
4.6 ROOT COMMANDS 5.6 ROOT COMMANDS
If building as a normal user (the default setting), be sure that all If building as a normal user (the default setting), be sure that all
commands that require root privileges are run using sudo. Also make sure commands that require root privileges are run using sudo. Also make sure
necessary root privilege commands are visible in your PATH. Or use necessary root privilege commands are visible in your PATH. The scripts
the `Defaults secure_path=' in /etc/sudoers. ensure that /usr/sbin is appended to the user's PATH when running
privileged commands.
For commands necessitating root privileges, the generated scripts wrap For commands necessitating root privileges, the generated scripts wrap
them with the construct: them with the construct:
sudo -E sh << ROOT_EOF sudo -E sh -e << ROOT_EOF
<commands to be executed as root with `$', ``', and `\' escaped> <commands to be executed as root with `$', ``', and `\' escaped>
ROOT_EOF ROOT_EOF
The -E switch ensures the whole environment is passed to the The "-e" switch to sh ensures the command block exits with error if an
commands to be run with root privileges. It is effective only if the error occurs. The "-E" switch to sudo ensures the whole environment is
/etc/sudoers file contains `Defaults setenv', or SETENV in the user passed to the commands to be run with root privileges. It is effective
attributes. If you think it is a security issue, you may forbid this only if the /etc/sudoers file contains `Defaults setenv', or SETENV in
flag in /etc/sudoers, but then, you have to un-escape `$' for variables the user attributes (this is implicit if the command the user is allowed
coming from the environment in the instructions. to run is `ALL'). If you think it is a security issue, you may forbid
Although this construct is rather strong, it can fail in some corner this flag in /etc/sudoers, but then, you have to un-escape `$' for
cases, so carefully review those instructions. variables coming from the environment in the instructions. Although this
construct is rather strong, it can fail in some corner cases, so
carefully review those instructions.
Due to book layout issues, some sudo commands may be missing. Due to book layout issues, some sudo commands may be missing.
4.7 OTHERS 5.7 OTHERS
There may be other issues that we are not aware of. If you find There may be other issues that we are not aware of. If you find
any, please report it to <alfs-discuss@linuxfromscratch.org>. any, please report it to <alfs-discuss@linuxfromscratch.org>.

View file

@ -1,44 +0,0 @@
# $Id$
CLFS-1.x NOTES
None for now.
CLFS SYSROOT METHOD NOTES
.- If you want to install additional custom packages via "Add custom tools
support" and/or select "Add blfs-tool support", be sure to review and edit
their packages build scripts to follow the sysroot build method or you will
end messing your host system. Be very careful with this.
.- If you install additional packages not using the "Add custom tools support"
feature (i,e, you will install it manually after finished the Makefile run)
you will need to run manually the "Changing the Ownership Of The CLFS System"
phase commands found in the book.
CLFS EMBEDDED SYSTEMS NOTES
.- Mips, WRT and ARM builds are broken due a book bug on the uClibc
*ENDIAN* configuration settings.
.- To install CBLFS packages you must to use the "Add custom tools support"
feature. To learn how it works and how to use it, see the section titled
"Adding Post-System Build Configuration Files and Extra Packages"
found in README.CUSTOM. That is also applicable to bootloaders installation.
.- If you install additional packages not using the "Add custom tools support"
feature (i,e, you will install it manually after finished the Makefile run)
you will need to run manually the "Changing the Ownership Of The CLFS System"
phase commands found in the book.
.- If your target is a MIPS wireless router, you must to select "mips" as
your target architecture and "WRT - MIPS based wireless route" as your
hardware platform.
.- The backup & clean-up phases aren't run. This is to allow users to
review the installed files and do a more in-deeper clean-up before creating
the system tarball.

View file

@ -1,25 +1,21 @@
#
# $Id$
#
HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE
Normally JHALFS creates a Makefile containing only those scripts found in Normally JHALFS creates a Makefile containing only those scripts found in
the {B,C,H}LFS books. An automated construction tool cannot predict the the {,B}LFS books. An automated construction tool cannot predict the
needs of every individual and requests are made "Can you add xxxx package". needs of every individual and requests are made "Can you add xxxx package".
Rather than adding numerous package scripts and switches for each request it Rather than adding numerous package scripts and switches for each request it
was easier to add a tool for the user(s) to code their own package needs. was easier to add a tool for the user(s) to code their own package needs.
There is two areas that can be customized: how the base system is build There are two areas that can be customized: how the base system is built
and what additional configurations and packages requires your hardware to can and what additional configurations and packages your hardware requires to be
boot and work with. Each one of this areas is handled in a different way. able to boot and run. Each of those areas are handled in a different way.
BASE SYSTEM CUSTOMIZATION BASE SYSTEM CUSTOMIZATION
There is two ways to alter how the base system will be built: There are two ways to alter how the base system will be built:
- Using a working copy of the book sources and editing the XML files. - Using a working copy of the book sources and editing the XML files.
This is the way used by book editors to test packages upgrades, This is the way used by book editors to test packages upgrades,
@ -28,22 +24,22 @@ boot and work with. Each one of this areas is handled in a different way.
This method requires you know very well the book sources and what This method requires you know very well the book sources and what
files need be edited. It will not be discussed here. files need be edited. It will not be discussed here.
- Editing the generated build scripts to make any change you would. - Editing the generated build scripts to make any change you want.
This is the method discussed below. This is the method discussed below.
EDITING THE BASE SCRIPTS EDITING THE BASE SCRIPTS
First step is to generate the build scripts with book defaults. To do that, To begin with, the build scripts should be generated with book defaults. To
configure jhalfs activating any option you want included, but do not select do that, configure jhalfs activating any option you want included, but do not
"Run the Makefile" option. select "Run the Makefile" option.
Under the ${BUILD_DIR}/${SCRIPT_ROOT}/${PROGNAME}-commands directory Under the ${BUILD_DIR}/${SCRIPT_ROOT}/$COMMANDS directory
(using the defaults values to do an LFS build, that directory name is (using the defaults values to do an LFS build, that directory name is
/mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts. /mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts.
If all you want is modify, add, or remove some command from a package If all you want is modify, add, or remove some command from a package
installation, for example to change it ./configure line, just edit the related installation, for example to change its ./configure line, just edit the related
script. If changing or adding a patch, be sure to copy the new patch to the script. If changing or adding a patch, be sure to copy the new patch to the
${BUILD_DIR}/sources directory. When done, run 'make' from inside the ${BUILD_DIR}/sources directory. When done, run 'make' from inside the
${BUILD_DIR}/${SCRIPT_ROOT} directory. ${BUILD_DIR}/${SCRIPT_ROOT} directory.
@ -53,39 +49,38 @@ ${BUILD_DIR}/${SCRIPT_ROOT} directory.
To remove a package from the system, just remove its script(s). To remove a package from the system, just remove its script(s).
To change the version of some package to build a newest or oldest one than the To change the version of some package, or to build a newer or older version
one found in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to than that in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to
change it tarball name and place the new tarball in the ${BUILD_DIR}/sources change its tarball name and place the new tarball in the ${BUILD_DIR}/sources
directory, directory.
To replace a package by an equivalent one, rename the replaced package script To replace a package by an equivalent one, rename the replaced package script
to reflect the new package name (for example, 102-man-db -> 102-man), edit the to reflect the new package name (for example, 102-man-db -> 102-man), edit the
script to made the required commands changes, place the new tarball in the script to make the required commands changes, place the new tarball in the
${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list ${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list
file to replace the removed package tarball name by the new package tarball name. file to replace the removed package tarball name by the new package tarball
name.
To change the build order, rename the scripts changing the first 3-digits To change the build order, rename the scripts changing the first 3-digits
string until have it ordered in the way you want. string until they are sorted in the way you want.
To insert a new package, for example to build Cracklib to can build Shadow To insert a new package, for example to build Cracklib in order to build
with Cracklib support, first you should decide before what default package it Shadow with Cracklib support, you should first decide before what package it
need be installed, in this example before 107-shadow. Then create a new script needs to be installed, in this example 107-shadow. Then create a new script
containing the needed commands, using an existing one as template, and name it with containing the needed commands, using an existing one as template, and name it
the same 3-digits string used for that mentioned default package, but adding with the same 3-digits string used for that mentioned default package, but
another 1-digit string. In our example, the new script to build Cracklib just adding another 1-digit string. In our example, the new script to build Cracklib
before Shadow will be named 107-1-cracklib. This naming schema allow to insert before Shadow will be named 107-1-cracklib. This naming scheme allows inserting
up to 10 scripts before each one of the default scripts. Place the tarball for up to 10 scripts before each of the existing scripts. Place the tarball for
the new package and required patches, if any, if ${BUILD_DIR}/sources and edit the new package and required patches, if any, in ${BUILD_DIR}/sources and edit
${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that
package. package.
When ready, launch again the jhalfs configuration interface. Be sure that When ready, launch again the jhalfs configuration interface. Make sure that
are selected exactly the same options than when generating the default build exactly the same options are selected as when generating the default build
scripts. Be sure that "Rebuild files" is unselected and select "Run the Makefile" scripts. Be sure that "Rebuild files" is unselected and select "Run the
if you want. Then select "Rebuild the Makefile". This will create a new Makefile Makefile" if you want. Then select "Rebuild the Makefile". This will create a
based on the changes you made to the build scripts. new Makefile based on the changes you made to the build scripts.
ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES
@ -96,35 +91,27 @@ more info.
The feature described below was added so users could install remaining The feature described below was added so users could install remaining
configuration files, build the packages necessary to access the Internet configuration files, build the packages necessary to access the Internet
or to support specific hardware, or to install basic utilities that need or to support specific hardware, or to install basic utilities that are
have available from the beginning, and was not intended to replace the BLFS needed from the beginning, and was not intended to replace the BLFS
install system. install system.
:::NOTICE:::
The following examples are for use with LFS and are not applicable to any
of the CLFS-sysroot or CLFS-Embedded books. The directory examples_CLFS-E
contains code extracted from Beyond CLFS-embedded. Any packages you chose to
add should honour the DESTDIR=${CLFS} switch or equivalent.
LAYOUT LAYOUT
A new directory has been added to JHALFS tree which will contain the A new directory has been added to JHALFS tree which contains the
configuration scripts and a few examples. A switch has been added to the configuration scripts and a few examples. A switch has been added to the
configuration file which enables/disables the inclusion of personal scripts. configuration file which enables/disables the inclusion of custom scripts.
custom custom
/config <-- where to put your scripts. /config <-- where to put your scripts.
/examples <-- a few example scripts /examples <-- a few example scripts
/examples_CLFS-E <-- example scripts for CLFS-Embedded
template <-- ALL scripts MUST look like this template <-- ALL scripts MUST look like this
NOTE::: You are responsible for including all dependencies and ensuring they NOTE::: You are responsible for including all dependencies and ensuring they
are built in the proper order. are built in the right order.
1. To add a package to the final JHALFS Makefile you must first create a file 1. To add a package to the final JHALFS Makefile you must first create a file
in the custom/config directory. in the custom/config directory. The directory custom/config may need
to be created first.
**All config files MUST follow the naming convention, xxx-PKG, where xxx **All config files MUST follow the naming convention, xxx-PKG, where xxx
is the order number and PKG is the name of the package. The file naming is the order number and PKG is the name of the package. The file naming
format is important as it defines the build order. The example shown format is important as it defines the build order. The example shown
@ -134,25 +121,36 @@ configuration file which enables/disables the inclusion of personal scripts.
and rename it. and rename it.
2. Populate the variables with the necessary values. 2. Populate the variables with the necessary values.
Variable function is self explanatory except for the inclusion of the Variable function is self explanatory. PATCH variables must be
build cmds. If the package you want to include is found in the BLFS numbered, starting at PATCH1 (up to PATCH10). If the md5 checksum value
book then you only need to copy/paste the cmd strings between the xEOFx is known, it can be added after the URL as in (quotes needed):
pairs, otherwise you will need to define the build cmds yourself. PATCH1="http://patch-host/patch-path xxxxxxx..."
3. Build commands
If the package you want to include is found in the BLFS
book then you only need to copy/paste the commands between the xEOFx
text, otherwise you will need to define the commands yourself.
NOTE::: This script you just created is not usable directly but contains NOTE::: This script you just created is not usable directly but contains
all the information necessary for jhalfs to create a build script all the information necessary for jhalfs to create a build script
and an entry in the jhalfs Makefile. and an entry in the jhalfs Makefile.
3. As mentioned previously the build order is dictated by the 3 digit number 4. As mentioned previously the build order is dictated by the 3 digit number
in the file name. If a package has dependencies it must be numerically in the file name. If a package has dependencies it must be numerically
larger than the dependency files. larger than the dependency files.
i.e. The package mc has glib as a dependency and build order is e.g. The package mc has glib as a dependency, so the build order is:
950-glib 950-glib
951-mc 951-mc
4. A config file for BLFS-bootscripts is already created as 999-blfs_bootscripts. 5. A config file for BLFS-bootscripts is already created as 999-blfs_bootscripts.
If a package requires a bootscript to be installed add the cmd to this If a package requires a bootscript to be installed add the cmd to this
file and NOT in the package script. The gpm script is included as an file and NOT in the package script. The gpm script is included as an
example of multiple patch files and the need for a blfs bootscript. example of patch file and the need for a blfs bootscript.
EXAMPLES
Other examples can be found in custom/examples. They are dated and
unmaintained, but can be useful for creating your own scripts.
#--------- GLIB example ----------- #--------- GLIB example -----------
@ -175,7 +173,6 @@ for i in PATCH{1..10}; do
done done
# Patches are named PATCH[1..10] # Patches are named PATCH[1..10]
# This information is used to download the patch only # This information is used to download the patch only
# If you do not have the MD5SUM the download will proceed with a warning.
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba" PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
@ -200,14 +197,12 @@ xEOFx
PKG="gpm" PKG="gpm"
PKG_VERSION="1.20.1" PKG_VERSION="1.20.1"
PKG_FILE="gmp-1.20.1.tar.bz2" PKG_FILE="gpm-1.20.1.tar.bz2"
URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2" URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2"
MD5="2c63e827d755527950d9d13fe3d87692" MD5="2c63e827d755527950d9d13fe3d87692"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done
# MD5SUM is not absolutely necessary but JHALFS whines and complains
# Add the MD5SUM if you can
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch" PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch"
PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch" PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch"
@ -265,4 +260,3 @@ echo "JUST A USELESS TRACE"
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -1,11 +0,0 @@
$Id$
::::NOTICE::::
Hardened Linux From Scratch is a highly volatile project. Extreme design
changes can occur and the build could be broken for extended periods of
time.
As of July 26.2007, the Glibc-based systems builds should work.
uClibc-based system still fail due book issues.

View file

@ -5,24 +5,48 @@ BY : Pierre Labastie (work in progress)
There are several hints discussing package management for LFS, but There are several hints discussing package management for LFS, but
nothing under jhalfs. There used to be a patch for PACO that I cannot nothing under jhalfs. There used to be a patch for PACO that I cannot
find now. This is a modification, which allows to use a package manager find now. So there was a need for such a tool, and an infrastructure,
inside jhalfs. I hope it is flexible enough to support several package which allows using a package manager inside jhalfs, has been developped.
managers. My implementation uses dpkg, from Debian, in a very crude way. I hope it is flexible enough to support several package managers, at least
Debian has a sophisticated package management system, which I have not among those who use DESTDIR install and/or LD_PRELOAD during install.
tried to use here. For example, it should be usable with Pacman from It has been tested with dpkg from Debian, pacman from Arch Linux,
Arch Linux (http://www.archlinux.org), as far as I remember from my old and porg. Sample configuration files are given for those three packages.
days with DIYL. I am sorry to say I have (almost) no experience with I am sorry to say I have (almost) no experience with rpm, so I cannot
rpm, so I cannot tell whether it would fit. tell whether it would fit.
2. OVERVIEW OF THE SYSTEM: 2. OVERVIEW OF THE SYSTEM:
For now, package management is only available for LFS. I plan to For now, package management is only available for LFS. The `porg style'
upgrade BLFS tools, but nothing usable right now. I have not attempted (see below) package management has been ported to BLFS, but not the distro
to adapt this tool for the other flavours of LFS. style one (the book layout makes it rather difficult).
This system performs basically a "DESTDIR install" for all pages
in chapter 6, 7 and 8 of the book. The name of the DESTDIR directory is the This tool comes in two flavours:
same as the one of the executed script. The path to this directory is - for distros package managers (e.g dpkg or pacman), it basically performs
available to the scriplets through the PKG_DEST variable. a "DESTDIR install" for all pages in chapter 8, 9 and 10 of the book. The
name of the DESTDIR directory is the same as the one of the executed
script. The path to this directory is available to the scriplets through
the PKG_DEST variable. The details of the DESTDIR part are given below.
After the package is installed in $PKG_DEST, a function "packInstall" is
called, which is supposed to create a binary package (e.g. make a .deb
file), store it to a repository and install it to the system.
- for porg style package manager, the install instructions are wrapped
between pairs of single quotes ('). This allows passing those instructions
to a function ("wrapInstall"), which may itself call porg or another
(e.g. fakeroot, not tested) instruction wrapper. Note that if the
instructions contain single quote charaters, they are changed to '\'',
which pass them literally. At the end of the installation, a function
"packInstall" is called, with a slighly different aim compared to the
DESTDIR one: it is used to make a tarball of the installed files (e.g.
using "porgball") and store them into some repository. But there is no
need to install them to the system, since this has already been done.
Note that with carefully crafted "packInstall" and "wrapInstall"
functions, a combination of the two methods could be used, for example for
DESTDIR installs using fakeroot. This is work in progress and not fully
implemented yet (well... Closer to a wish list actually).
3. DETAILS:
The XSL stylesheet used for generating the scriptlets, automatically The XSL stylesheet used for generating the scriptlets, automatically
adds DESTDIR install instructions when "package management" is selected. adds DESTDIR install instructions when "package management" is selected.
Also all the paths beginning with " /" or ">/" (absolute paths) are prepended Also all the paths beginning with " /" or ">/" (absolute paths) are prepended
@ -34,26 +58,30 @@ BY : Pierre Labastie (work in progress)
creates a reasonable subset of the FHS hierarchy into the destination creates a reasonable subset of the FHS hierarchy into the destination
directory. Empty directories are then removed before packing the directory. Empty directories are then removed before packing the
binary package. binary package.
In order to use the package manager, it has to be installed at the end of In order to use the package manager, it has to be installed at the end of
chapter 5 (temporary installation in /tools) and chapter 6 (final install). chapter 7 (temporary installation) and chapter 8 (final install).
Furthermore, the administrative files and directories have to be created Furthermore, the administrative files and directories have to be created
during the `Creating Directories' and `Creating Essential Files' stages. during the `Creating Directories' and `Creating Essential Files' stages.
For all this, the user has to supply a file in docbook XML format, with For all this, the user has to supply a file in docbook XML format, with
the necessary instructions and enough information to download the tarball. the necessary instructions and enough information to download the tarball.
This file should reside in the `pkgmngt' directory and be named This file should reside in the `pkgmngt' directory and be named
`packageManager.xml'. A template named `packageManager.xml.template' is `packageManager.xml'. A template named `packageManager.xml.template' is
provided in the `pkgmngt' subdirectory. There are also two XML files for provided in the `pkgmngt' subdirectory. There are also three XML files for
dpkg and pacman, respectively `packageManager.xml.dpkg' and dpkg, pacman, and porg, respectively `packageManager.xml.dpkg',
`packageManager.xml.pacman', that you can copy to `packageManager.xml'. `packageManager.xml.pacman', and `packageManager.xml.porg', that you can
copy to `packageManager.xml' and modify to suit your needs.
They are not updated often, so the versions used can be rather old. They are not updated often, so the versions used can be rather old.
The last thing to do is to tell how to use the package manager. When
the binary package is ready, the scriptlets call a shell function named The last thing to do is to tell how to use the package manager. The user
`packInstall', which should pack the binary package and install it on the has to provide two functions, "wrapInstall" and "packInstall", as described
system. Note that nothing has been done to manage configuration files, above. Please note that nothing has been done to manage configuration files,
which are ususally treated specially by package managers: depending on which are ususally treated specially by package managers: depending on
the book layout, it is sometimes possible to create those files afterwards, the book layout, it is sometimes possible to create those files afterwards,
and sometimes not, which means that you have to check them after each and sometimes not, which means that you have to check them after each
upgrade. The user has to write his own `packInstall' function. The shell upgrade. Both functions should be defined in a file named `packInstall.sh',
function should be defined in a file named `packInstall.sh', residing in residing in the `pkgmngt' directory. A template is provided (actually a copy
the `pkgmngt' directory. A template is provided, as well as two example of the file for dpkg), as well as three example scripts for dpkg, pacman,
scripts for dpkg and pacman. and porg. Pacman Note: due to the way pacman checks the available space on
disk, the root directory in chroot must be a mount point, otherwise the
installation of packages fails.

19
TODO
View file

@ -1,23 +1,6 @@
jhalfs TODO jhalfs TODO
--------------- ---------------
Remove RUN_ICA (it is redundant with COMPARE)
MASTER SCRIPT
-------------
- Add a way to choose the network configuration (ip, gateway, etc).
- [CLFS] Add a switch to choose between static or DHCP network configuration
for CLFS.
xLFS MODULES
------------
- Add a way to choose the network configuration (ip, gateway, etc).
- [CLFS] Add a switch to choose between static or DHCP network configuration
for CLFS.
BLFS MODULE (See BLFS/TODO) BLFS MODULE (See BLFS/TODO)
----------- -----------

View file

@ -1,20 +1,21 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id$ -->
<xsl:stylesheet <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl" extension-element-prefixes="exsl"
version="1.0"> version="1.0">
<xsl:param name="jobs_2" select="1"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="//sect1"/> <xsl:apply-templates select="//sect1"/>
</xsl:template> </xsl:template>
<xsl:template match="sect1"> <xsl:template match="sect1">
<xsl:if <xsl:if
test="descendant::screen/userinput[starts-with(string(),'chroot')]"> test="descendant::screen/userinput[contains(string(),'&#xA;chroot') or
starts-with(string(),'chroot')]">
<!-- The file names --> <!-- The file names -->
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/> <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/> <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
@ -39,14 +40,58 @@
<!-- Creating dirs and files --> <!-- Creating dirs and files -->
<exsl:document href="{$order}-{$filename}" method="text"> <exsl:document href="{$order}-{$filename}" method="text">
<xsl:text>#!/bin/bash&#xA;</xsl:text> <xsl:text>#!/bin/bash&#xA;</xsl:text>
<xsl:apply-templates select=".//userinput[starts-with(string(),'chroot')]"/> <xsl:apply-templates
select=".//userinput[contains(string(),'&#xA;chroot') or
starts-with(string(),'chroot')]"/>
<xsl:text>exit&#xA;</xsl:text> <xsl:text>exit&#xA;</xsl:text>
</exsl:document> </exsl:document>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="userinput"> <xsl:template match="userinput">
<xsl:apply-templates/> <xsl:call-template name="extract-chroot">
<xsl:text>&#xA;</xsl:text> <xsl:with-param name="instructions" select="string()"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="extract-chroot">
<xsl:param name="instructions" select="''"/>
<xsl:choose>
<xsl:when test="contains($instructions, '$(nproc || echo 1)')">
<xsl:call-template name="extract-chroot">
<xsl:with-param
name="instructions"
select="concat(substring-before($instructions, '$(nproc || echo 1)'), $jobs_2, substring-after($instructions, '$(nproc || echo 1)'))"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="not(starts-with($instructions,'&#xA;chroot')) and
contains($instructions, '&#xA;chroot')">
<xsl:call-template name="extract-chroot">
<xsl:with-param name="instructions"
select="substring(substring-after($instructions,
substring-before($instructions,
'&#xA;chroot')),2)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($instructions,'\&#xA;')">
<xsl:copy-of select="substring-before($instructions,'\&#xA;')"/>
<xsl:text>\
</xsl:text>
<xsl:call-template name="extract-chroot">
<xsl:with-param name="instructions"
select="substring-after($instructions,'\&#xA;')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($instructions,'&#xA;')">
<xsl:copy-of select="substring-before($instructions,'&#xA;')"/>
<xsl:text>
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$instructions"/>
<xsl:text>
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# $Id$
set -e set -e
@ -34,10 +32,12 @@ run_make() { #
exit 1 exit 1
fi fi
# Build the system # Build the system
if [ -e $MKFILE ] ; then if [ -e "$MKFILE" ] ; then
echo -ne "Building the system...\n" echo -ne "Building the system...\n"
cd $JHALFSDIR && make # if { echo try tty; tty; }; then
cd "$JHALFSDIR" && make -j1
echo -ne "done\n" echo -ne "done\n"
# else echo there is no terminal!!; fi
fi fi
fi fi
} }
@ -49,7 +49,7 @@ clean_builddir() { #
# Test if the clean must be done. # Test if the clean must be done.
if [ "${CLEAN}" = "y" ]; then if [ "${CLEAN}" = "y" ]; then
# If empty (i.e. could contain lost+found), do not do anything # If empty (i.e. could contain lost+found), do not do anything
if $(ls -d $BUILDDIR/* > /dev/null 2>&1) && if ls -d $BUILDDIR/* > /dev/null 2>&1 &&
[ "$(ls $BUILDDIR)" != "lost+found" ]; then [ "$(ls $BUILDDIR)" != "lost+found" ]; then
# Test to make sure that the build directory was populated by jhalfs # Test to make sure that the build directory was populated by jhalfs
if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
@ -60,9 +60,17 @@ if [ "${CLEAN}" = "y" ]; then
echo "Looks like kernel filesystems are still mounted on $BUILDDIR." echo "Looks like kernel filesystems are still mounted on $BUILDDIR."
exit 1 exit 1
else else
if [ $JHALFSDIR/*gcc-pass1 != $JHALFSDIR/'*gcc-pass1' ]; then
echo -n "$BUILDDIR contains already built packages. Clean anyway? yes/no (yes): "
read ANSWER
if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
echo "${nl_}Rerun and change the option in the menu.${nl_}"
exit 1
fi
fi
# Clean the build directory # Clean the build directory
echo -n "Cleaning $BUILDDIR ..." echo -n "Cleaning $BUILDDIR ..."
# First delete proc and sys directories, if exist. # First delete proc and sys directories, if they exist.
# Both should be empty. If not, we exit, and the rmdir command # Both should be empty. If not, we exit, and the rmdir command
# has generated an error message # has generated an error message
if [ -d $BUILDDIR/proc ] ; then if [ -d $BUILDDIR/proc ] ; then
@ -71,10 +79,10 @@ if [ "${CLEAN}" = "y" ]; then
if [ -d $BUILDDIR/sys ] ; then if [ -d $BUILDDIR/sys ] ; then
sudo rmdir $BUILDDIR/sys || exit 1 sudo rmdir $BUILDDIR/sys || exit 1
fi fi
sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib{,64},media,mnt,run} sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib{,64,32,x32},media,mnt,run}
sudo rm -rf $BUILDDIR/{opt,root,sbin,srv,tmp,tools,cross-tools,usr,var} sudo rm -rf $BUILDDIR/{opt,root,sbin,srv,tmp,tools,cross-tools,usr,var}
echo "done" echo "done"
if [[ "${BLFS_TOOL}" = "y" ]] ; then if [[ "${BLFS_TOOL}" = "y" ]] ; then
echo -n "Cleaning $BUILDDIR/$BLFS_ROOT ..." echo -n "Cleaning $BUILDDIR/$BLFS_ROOT ..."
sudo rm -rf $BUILDDIR/$BLFS_ROOT sudo rm -rf $BUILDDIR/$BLFS_ROOT
echo "done" echo "done"
@ -85,31 +93,10 @@ if [ "${CLEAN}" = "y" ]; then
echo -n "Cleaning remaining extracted sources in $BUILDDIR/sources ..." echo -n "Cleaning remaining extracted sources in $BUILDDIR/sources ..."
sudo rm -rf `find $BUILDDIR/sources -maxdepth 1 -mindepth 1 -type d` sudo rm -rf `find $BUILDDIR/sources -maxdepth 1 -mindepth 1 -type d`
echo "done" echo "done"
echo -n "Removing dangling symlinks in / ..."
sudo rm -f /tools /cross-tools
echo "done"
fi fi
fi fi
fi fi
} }
VERBOSITY2=$VERBOSITY
[[ $VERBOSITY2 > 0 ]] && echo ""
[[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_book_parser>..."
source $COMMON_DIR/libs/func_book_parser
[[ $? > 0 ]] && echo "file libs/func_book_parser did not load.." && exit 1
[[ $VERBOSITY2 > 0 ]] && echo "OK"
[[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_download_pkgs>..."
source $COMMON_DIR/libs/func_download_pkgs
[[ $? > 0 ]] && echo "file libs/func_download_pkgs did not load.." && exit 1
[[ $VERBOSITY2 > 0 ]] && echo "OK"
[[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_wrt_Makefile>..."
source $COMMON_DIR/libs/func_wrt_Makefile
[[ $? > 0 ]] && echo "file libs/func_wrt_Makefile did not load.." && exit 1
[[ $VERBOSITY2 > 0 ]] && echo "OK"
[[ $VERBOSITY2 > 0 ]] && echo -n " ..."

View file

@ -1,33 +1,38 @@
#!/bin/bash #!/bin/bash
#$Id$
set -e set -e
LOGSDIR=$1 LOGSDIR=$1
VERSION=$2 VERSION=$2
DATE=$3
LINE="================================================================================" LINE="================================================================================"
# Make sure that we have a directory as first argument # Make sure that we have a directory as first argument
[[ ! -d "$LOGSDIR" ]] && \ [ ! -d "$LOGSDIR" ] && \
echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version]\n" && exit echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version] [date]\n" && exit
# Make sure that the first argument is a jhalfs logs directory # Make sure that the first argument is a jhalfs logs directory
[[ ! -f "$LOGSDIR"/000-masterscript.log ]] && \ [ ! -f "$LOGSDIR"/000-masterscript.log ] && \
echo -e "\nLooks like $LOGSDIR isn't a jhalfs logs directory.\n" && exit echo -e "\nLooks like $LOGSDIR isn't a jhalfs logs directory.\n" && exit
# Make sure something has been built otherwise no need for report :)
[ ! -f "$LOGSDIR"/???-binutils-pass1* ] && \
echo -e "\nLooks like nothing has been built yet. Aborting report.\n" && exit
# If this script is run manually, the book version may be unknown # If this script is run manually, the book version may be unknown
[[ -z "$VERSION" ]] && VERSION=unknown [ -z "$VERSION" ] && VERSION=unknown
[ -z "$DATE" ] && DATE=$(date --iso-8601)
# If there is iteration logs directories, copy the logs inside iteration-1 # If there is iteration logs directories, copy the logs inside iteration-1
# to the top level dir # to the top level dir
[[ -d "$LOGSDIR"/build_1 ]] && \ [ -d "$LOGSDIR"/build_1 ] && \
cp $LOGSDIR/build_1/* $LOGSDIR cp $LOGSDIR/build_1/* $LOGSDIR
# Set the report file # Set the report file
REPORT="$VERSION"-SBU_DU-$(date --iso-8601).report REPORT="$VERSION"-SBU_DU-"$DATE".report
[ -f $REPORT ] && : >$REPORT [ -f "$REPORT" ] && : >$REPORT
# Dump generation time stamp and book version # Dump generation time stamp and book version
echo -e "\n`date`\n" > "$REPORT" echo -e "\n`date`\n" > "$REPORT"
@ -43,20 +48,30 @@ fi
# Dump CPU and memory info # Dump CPU and memory info
echo -e "\n\n\t\tCPU type:\n" >> "$REPORT" echo -e "\n\n\t\tCPU type:\n" >> "$REPORT"
cat /proc/cpuinfo >> "$REPORT" lscpu >> "$REPORT"
echo -e "\n\t\tMemory info:\n" >> "$REPORT" echo -e "\n\t\tMemory info:\n" >> "$REPORT"
free >> "$REPORT" free >> "$REPORT"
# Parse only that logs that have time data # Parse only that logs that have time data
BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`" pushd ${LOGSDIR}
BUILDLOGS="`grep -l "^Totalseconds:" * | sort -n`"
# Match the first timed log to extract the SBU unit value from it # Match the first timed log to extract the SBU unit value from it
FIRSTLOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1` FIRSTLOG=`grep -l "^Totalseconds:" * | sort -n | head -n1`
BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/???-binutils* | head -n1` BASELOG=`grep -l "^Totalseconds:" ???-binutils* | head -n1`
echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value." echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG` SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" popd
echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT" # Get the -j value of the SBU
if [ "$(sed -n '/REALSBU/s/.*\([yn]\).*/\1/p' "$REPORT")" = y ]; then
J_VALUE="1"
else
J_VALUE=$(sed -n '/N_PARALLEL/s/.*<\([^>]*\).*/\1/p' "$REPORT")
fi
# if jhalfs.config does not exist, or OPTIMIZE is 0, then J_VALUE is
# still empty. Assume 1 in that case
echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds at -j${J_VALUE:=1}.\n"
echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds at -j$J_VALUE.\n" >> "$REPORT"
# Set the first value to 0 for grand totals calculation # Set the first value to 0 for grand totals calculation
SBU2=0 SBU2=0
@ -71,7 +86,7 @@ for log in $BUILDLOGS ; do
# Start SBU calculation # Start SBU calculation
# Build time # Build time
TIME=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $log` TIME=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' ${LOGSDIR}/$log`
SECS=`perl -e 'print ('$TIME' % '60')';` SECS=`perl -e 'print ('$TIME' % '60')';`
MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';` MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';`
SBU=`perl -e 'printf "%.1f" , ('$TIME' / '$SBU_UNIT')';` SBU=`perl -e 'printf "%.1f" , ('$TIME' / '$SBU_UNIT')';`
@ -81,10 +96,10 @@ for log in $BUILDLOGS ; do
# Start disk usage calculation # Start disk usage calculation
# Disk usage before unpacking the package # Disk usage before unpacking the package
DU1=`grep "^KB: " $log | head -n1 | cut -f1 | sed -e 's/KB: //'` DU1=`grep "^KB: " ${LOGSDIR}/$log | head -n1 | cut -f1 | sed -e 's/KB: //'`
DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';` DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';`
# Disk usage before deleting the source and build dirs # Disk usage before deleting the source and build dirs
DU2=`grep "^KB: " $log | tail -n1 | cut -f1 | sed -e 's/KB: //'` DU2=`grep "^KB: " ${LOGSDIR}/$log | tail -n1 | cut -f1 | sed -e 's/KB: //'`
DU2MB=`perl -e 'printf "%.3f" , ('$DU2' / '1024')';` DU2MB=`perl -e 'printf "%.3f" , ('$DU2' / '1024')';`
# Calculate disk space required to do the build # Calculate disk space required to do the build
REQUIRED1=`perl -e 'print ('$DU2' - '$DU1')';` REQUIRED1=`perl -e 'print ('$DU2' - '$DU1')';`
@ -119,7 +134,7 @@ done
# For printing the last 'Installed files disk usage', we need to 'du' the # For printing the last 'Installed files disk usage', we need to 'du' the
# root dir, excluding the jhalfs directory (and lost+found). We assume # root dir, excluding the jhalfs directory (and lost+found). We assume
# that the rootdir is $LOGSDIR/../.. # that the rootdir is $LOGSDIR/../..
DU1=`du -skx --exclude=jhalfs --exclude=lost+found $LOGSDIR/../.. | cut -f1` DU1=`du -skx --exclude=jhalfs --exclude=lost+found --exclude var/lib $LOGSDIR/../.. | cut -f1`
DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';` DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';`
INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';` INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';` INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id:$ -->
<!-- Extracts minimal versions from LFS book host requirements, <!-- Extracts minimal versions from LFS book host requirements,
and generates a script containing statements of the and generates a script containing statements of the
form MIN_prog_VERSION=xx.yy.zz. form MIN_prog_VERSION=xx.yy.zz.
@ -19,7 +18,7 @@
<xsl:template match="emphasis"> <xsl:template match="emphasis">
<!-- We assume that what is emphasized is in the form: <!-- We assume that what is emphasized is in the form:
aa...aa-dccsaaa (a anything except @, - "dash", d digit, aa...aa-dccsaaa (a anything except @, - "dash", d digit,
c anything except space, s space) c anything except space, s space)
or or
aa...aasdccsaaa aa...aasdccsaaa
This means we have to replace digits with @, and look for '-@' This means we have to replace digits with @, and look for '-@'

84
common/kernfs.xsl Normal file
View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>#!/bin/bash
</xsl:text>
<xsl:apply-templates select="//userinput[contains(string(),'--bind') or
contains(string(),'/proc') or
contains(string(),'readlink') or
contains(string(),'-Rv')]"/>
</xsl:template>
<xsl:template match="userinput">
<xsl:call-template name="check-mount">
<xsl:with-param name="mytext" select="string()"/>
</xsl:call-template>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="check-mount">
<xsl:param name="mytext" select="''"/>
<xsl:choose>
<xsl:when test="contains($mytext,'&#xA;')">
<xsl:call-template name="check-mount">
<xsl:with-param name="mytext"
select="substring-before($mytext,'&#xA;')"/>
</xsl:call-template>
<xsl:text>&#xA;</xsl:text>
<xsl:call-template name="check-mount">
<xsl:with-param name="mytext"
select="substring-after($mytext,'&#xA;')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="starts-with(normalize-space($mytext),'mountpoint')">
<xsl:copy-of select="$mytext"/>
</xsl:when>
<xsl:when test="starts-with(normalize-space($mytext),'mount')">
<xsl:variable name="mountpoint">
<xsl:call-template name="last-arg">
<xsl:with-param name="myline" select="$mytext"/>
</xsl:call-template>
</xsl:variable>
<xsl:text>mountpoint -q </xsl:text>
<xsl:copy-of select="$mountpoint"/>
<xsl:text> || </xsl:text>
<xsl:copy-of select="$mytext"/>
</xsl:when>
<xsl:when test="starts-with(normalize-space($mytext),'umount')">
<xsl:variable name="mountpoint">
<xsl:call-template name="last-arg">
<xsl:with-param name="myline" select="$mytext"/>
</xsl:call-template>
</xsl:variable>
<xsl:text>mountpoint -q </xsl:text>
<xsl:copy-of select="$mountpoint"/>
<xsl:text> &amp;&amp; </xsl:text>
<xsl:copy-of select="$mytext"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$mytext"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="last-arg">
<xsl:param name="myline" select="''"/>
<xsl:choose>
<xsl:when test="contains($myline,' ')">
<xsl:call-template name="last-arg">
<xsl:with-param name="myline" select="substring-after($myline,' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$myline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,53 +1,41 @@
#!/bin/bash #!/bin/bash
# $Id$
#----------------------------# #----------------------------#
get_book() { # get_book() { #
#----------------------------# #----------------------------#
cd $JHALFSDIR cd $JHALFSDIR
if [ -z $WORKING_COPY ] ; then if [ -z "$WORKING_COPY" ] ; then
# Check for Subversion instead of just letting the script hit 'svn' and fail. # Check for Subversion or git instead of just letting the script fail.
test `type -p svn` || eval "echo \"This feature requires Subversion.\" test `type -p git` || eval "echo \"This feature requires Git.\"
exit 1" exit 1"
echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
case $PROGNAME in echo -n "Downloading the lfs document, branch/tag/commit: $COMMIT... "
lfs) svn_root="LFS" ;;
hlfs) svn_root="HLFS" ;;
clfs*) ;;
*) echo "BOOK not defined in function <get_book>"
exit 1 ;;
esac
# Grab a fresh book if it's missing, otherwise, update it from the # Grab a fresh book if it's missing, otherwise, update it from the
# repo. If we've already extracted the commands, move on to getting the # repo. If we've already extracted the commands, move on to getting the
# sources. # sources.
if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then if [ ! -d "$BOOK"/.git ]; then
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 git clone "$REPO" "$BOOK" >>"$LOGDIR/$LOG" 2>&1
elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] || [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then if [ "$COMMIT" != trunk ]; then
echo $TREE pushd "$BOOK" >/dev/null
git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 echo "Checking out $COMMIT at $PWD"
if [ ! $TREE == "development" ]; then git checkout "$COMMIT" >>"$LOGDIR/$LOG" 2>&1
cd ${PROGNAME}-$LFSVRS popd >/dev/null
echo "Checking out $LFSVRS at $PWD in $TREE"
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
fi fi
else else
cd ${PROGNAME}-$LFSVRS cd "$BOOK"
case $PROGNAME in # If the repo is in "detached head" state, git pull fails, so get
clfs*) git pull >>$LOGDIR/$LOG 2>&1 # back first to trunk:
if [ ! $TREE == "development" ]; then git checkout trunk >>"$LOGDIR/$LOG" 2>&1
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1 git pull >>"$LOGDIR/$LOG" 2>&1
fi if [ "$COMMIT" != "trunk" ]; then
;; git checkout "$COMMIT" >>"$LOGDIR/$LOG" 2>&1
lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;; fi
*) ;;
esac
fi fi
echo -ne "done\n" echo -ne "done\n"
else else # Working copy
echo -ne "Using $BOOK as book's sources ...\n" echo -ne "Using $BOOK as book's sources ...\n"
fi fi
} }
@ -57,170 +45,136 @@ extract_commands() { #
#----------------------------# #----------------------------#
cd $JHALFSDIR cd $JHALFSDIR
case $PROGNAME in
clfs*)
VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
*)
VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
esac
# Clean # Clean
rm -rf ${PROGNAME}-commands rm -rf "$COMMANDS"
# Extract the commands # Extract the commands
echo -n "Extracting commands for" echo -n "Extracting commands for"
case ${PROGNAME} in echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
clfs) # The scripts pages are xincluded by the book, so must
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " # be generated for running xsltproc
xsltproc --nonet \ pushd $BOOK > /dev/null
--xinclude \ if [ -f process-scripts.sh ]; then
--stringparam method $METHOD \ bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
--stringparam testsuite $TEST \ fi
--stringparam bomb-testsuite $BOMB_TEST \ # Recent git versions need version.ent to be generated
--stringparam vim-lang $VIMLANG \ if [ -f git-version.sh ]; then
--stringparam timezone $TIMEZONE \ bash git-version.sh "$INITSYS" >> $LOGDIR/$LOG 2>&1
--stringparam page $PAGE \ fi
--stringparam lang $LANG \ popd > /dev/null
--stringparam sparc $SPARC64_PROC \
--stringparam x86 $TARGET \
--stringparam mips $TARGET \
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;;
clfs2) if [ "$ALL_CORES" = "y" ]; then
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " JOBS="\$(nproc)"
xsltproc --nonet \ else
--xinclude \ JOBS="$N_PARALLEL"
--stringparam vim-lang $VIMLANG \ fi
--stringparam timezone $TIMEZONE \ if [ "$REALSBU" = y ]; then JOBSBP1=1; else JOBSBP1="$JOBS"; fi
--stringparam page $PAGE \
--stringparam lang $LANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
;;
clfs3) # First profile the book, for revision and arch. Note that
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " # MULTIBLIB is set to "default" if pure 64 bit book. In this case,
xsltproc --nonet \ # profiling on arch is useless, but does not hurt either.
--xinclude \ xsltproc --nonet \
--stringparam endian x$ENDIAN \ --xinclude \
--stringparam timezone $TIMEZONE \ --stringparam profile.revision "$INITSYS" \
--stringparam page $PAGE \ --stringparam profile.arch "$MULTILIB" \
--stringparam lang $LANG \ --output prbook.xml \
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 $BOOK/stylesheets/lfs-xsl/profile.xsl \
;; $BOOK/index.xml >> $LOGDIR/$LOG 2>&1
hlfs)
echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
xsltproc --nonet \
--xinclude \
--stringparam model $MODEL \
--stringparam kernel $KERNEL \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
--stringparam grsecurity_host $GRSECURITY_HOST \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;;
lfs)
echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
pushd $BOOK > /dev/null
if [ -f process-scripts.sh ]; then
bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
fi
popd > /dev/null
xsltproc --nonet \
--xinclude \
--stringparam testsuite $TEST \
--stringparam bomb-testsuite $BOMB_TEST \
--stringparam vim-lang $VIMLANG \
--stringparam full-locale $FULL_LOCALE \
--stringparam timezone $TIMEZONE \
--stringparam page $PAGE \
--stringparam lang $LANG \
--stringparam pkgmngt $PKGMNGT \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;;
*) echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
exit 1 ;;
esac
# Use the profiled book for generating the scriptlets
xsltproc --nonet \
--stringparam testsuite "$TEST" \
--stringparam ncurses5 "$NCURSES5" \
--stringparam strip "$STRIP" \
--stringparam del-la-files "$DEL_LA_FILES" \
--stringparam full-locale "$FULL_LOCALE" \
--stringparam timezone "$TIMEZONE" \
--stringparam page "$PAGE" \
--stringparam lang "$LANG" \
--stringparam pkgmngt "$PKGMNGT" \
--stringparam wrap-install "$WRAP_INSTALL" \
--stringparam hostname "$HOSTNAME" \
--stringparam interface "$INTERFACE" \
--stringparam ip "$IP_ADDR" \
--stringparam gateway "$GATEWAY" \
--stringparam prefix "$PREFIX" \
--stringparam broadcast "$BROADCAST" \
--stringparam domain "$DOMAIN" \
--stringparam nameserver1 "$DNS1" \
--stringparam nameserver2 "$DNS2" \
--stringparam font "$FONT" \
--stringparam fontmap "$FONTMAP" \
--stringparam unicode "$UNICODE" \
--stringparam keymap "$KEYMAP" \
--stringparam local "$LOCAL" \
--stringparam log-level "$LOG_LEVEL" \
--stringparam script-root "$SCRIPT_ROOT" \
--stringparam jobs "$JOBS" \
--stringparam jobs-bp1 "$JOBSBP1" \
--output "./${COMMANDS}/" \
$XSL \
prbook.xml >> $LOGDIR/$LOG 2>&1
# Remove flags requesting user action in some cases. Much easier here than
# in the stylesheet...
sed -i 's/-iv /-v /' "./${COMMANDS}/"chapter??/*kernel*
# If doing a destdir install (PM without wrap), the gcc instructions
# fail for two reasons: a missing dir, and gcc -dumpmachine returns a
# wrong string.
if [ "$PKGMNGT" = y ] && [ "$WRAP_INSTALL" = n ]; then
sed -e 's|(gcc|&/xgcc|' \
-e '/lto_plug/imkdir -pv $PKG_DEST/usr/lib/bfd-plugins' \
-i ./${COMMANDS}/chapter08/*gcc
fi
echo "done" echo "done"
# Make the scripts executable. # Make the scripts executable.
chmod -R +x $JHALFSDIR/${PROGNAME}-commands chmod -R +x "$JHALFSDIR/${COMMANDS}"
# Create the packages file. We need it for proper Makefile creation
create_package_list
create_chroot_scripts create_chroot_scripts
create_kernfs_scripts
# we create the VERSION variable here. Should maybe go into its own
# function. But at this point we can use the profiled xml to get
# version from lfs-release in the lfs case.
VERSION=$(grep 'echo.*lfs-release' prbook.xml | sed 's/.*echo[ ]*\([^ ]*\).*/\1/')
# Done. Moving on... # Done. Moving on...
get_sources get_sources
} }
#----------------------------# #----------------------------#
create_package_list() { # create_chroot_scripts() { #
#----------------------------# #----------------------------#
# Create the packages file. We need it for proper Makefile creation rm -rf chroot-scripts
rm -f pkg_tarball_list
echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
echo -n "... "
case ${PROGNAME} in
clfs*)
xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
$BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
;;
hlfs)
xsltproc --nonet --xinclude \
--stringparam model $MODEL \
--stringparam kernel $KERNEL \
-o pkg_tarball_list packages.xsl \
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
;;
lfs)
xsltproc --nonet --xinclude \
--stringparam pkgmngt $PKGMNGT \
-o pkg_tarball_list packages.xsl \
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
;;
*)
esac
echo "done"
}
#----------------------------#
create_chroot_scripts() { #
#----------------------------#
rm -rf chroot_scripts
echo -n "Creating chroot commands scripts from $BOOK" echo -n "Creating chroot commands scripts from $BOOK"
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
echo -n "... " echo -n "... "
case ${PROGNAME} in xsltproc --nonet --xinclude \
clfs*) --stringparam jobs_2 "$JOBS_2" \
xsltproc --nonet --xinclude \ -o chroot-scripts/ chroot.xsl \
-o chroot-scripts/ chroot.xsl \ $BOOK/chapter0?/*chroot*.xml >> $LOGDIR/$LOG 2>&1
$BOOK/BOOK/${ARCH}-index.xml >> $LOGDIR/$LOG 2>&1 echo "done"
;;
hlfs) }
xsltproc --nonet --xinclude \
-o chroot-scripts/ chroot.xsl \ #----------------------------#
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1 create_kernfs_scripts() { #
;; #----------------------------#
lfs)
xsltproc --nonet --xinclude \ rm -rf kernfs-scripts
-o chroot-scripts/ chroot.xsl \ mkdir kernfs-scripts
$BOOK/chapter06/chapter06.xml >> $LOGDIR/$LOG 2>&1 echo -n "Creating virtual kernel FS commands scripts from $BOOK"
;; if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
*) echo -n "... "
esac xsltproc --nonet \
-o kernfs-scripts/devices.sh kernfs.xsl \
$BOOK/*/kernfs.xml >> $LOGDIR/$LOG 2>&1
chmod +x kernfs-scripts/devices.sh
xsltproc --nonet \
-o kernfs-scripts/teardown.sh kernfs.xsl \
$BOOK/chapter??/reboot.xml >> $LOGDIR/$LOG 2>&1
chmod +x kernfs-scripts/teardown.sh
echo "done" echo "done"
} }

View file

@ -1,5 +1,3 @@
# $Id$
check_version() { check_version() {
: <<inline_doc : <<inline_doc
Tests for a minimum version level. Compares to version numbers and forces an Tests for a minimum version level. Compares to version numbers and forces an
@ -22,7 +20,8 @@ inline_doc
declare -i major minor revision change declare -i major minor revision change
declare -i ref_major ref_minor ref_revision ref_change declare -i ref_major ref_minor ref_revision ref_change
declare -r spaceSTR=" " declare -r spaceSTR=" "
declare -r spaceSTR1=" "
shopt -s extglob #needed for ${x##*(0)} below shopt -s extglob #needed for ${x##*(0)} below
@ -51,10 +50,12 @@ inline_doc
fi fi
} }
echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}" echo -ne "${TXT}${spaceSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
# echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates).
IFS=".-(pab" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates) # Also strip trailing "+" which appears for kernel built from a Git
# repository where HEAD is not a tag.
IFS=".-(pab+"
set -- $ref_version # set positional parameters to minimum ver values set -- $ref_version # set positional parameters to minimum ver values
ref_major=$1; ref_minor=$2; ref_revision=$3 ref_major=$1; ref_minor=$2; ref_revision=$3
# #
@ -66,39 +67,35 @@ inline_doc
# #
# Compare against minimum acceptable version.. # Compare against minimum acceptable version..
(( major > ref_major )) && (( major > ref_major )) &&
echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF} (Min version: ${ref_version})" && echo " ${spaceSTR1:${#tst_version}}${GREEN}OK${OFF} (Min version: ${ref_version})" &&
return return
(( major < ref_major )) && write_error_and_die (( major < ref_major )) && write_error_and_die
# major=ref_major # major=ref_major
(( minor < ref_minor )) && write_error_and_die (( minor < ref_minor )) && write_error_and_die
(( minor > ref_minor )) && (( minor > ref_minor )) &&
echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF} (Min version: ${ref_version})" && echo " ${spaceSTR1:${#tst_version}}${GREEN}OK${OFF} (Min version: ${ref_version})" &&
return return
# minor=ref_minor # minor=ref_minor
(( revision >= ref_revision )) && (( revision >= ref_revision )) &&
echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF} (Min version: ${ref_version})" && echo " ${spaceSTR1:${#tst_version}}${GREEN}OK${OFF} (Min version: ${ref_version})" &&
return return
# oops.. write error msg and die # oops.. write error msg and die
write_error_and_die write_error_and_die
} }
# local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
#----------------------------# #----------------------------#
check_prerequisites() { # check_prerequisites() { #
#----------------------------# #----------------------------#
case $PROGNAME in HOSTREQS=$(find $BOOK -name hostreqs.xml)
clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;;
*) HOSTREQS="prologue/hostreqs.xml" ;;
esac
eval $(xsltproc $COMMON_DIR/hostreqs.xsl $BOOK/$HOSTREQS) eval $(xsltproc $COMMON_DIR/hostreqs.xsl $HOSTREQS)
# Avoid translation of version strings # Avoid translation of version strings
local LC_ALL=C local LC_ALL=C
export LC_ALL export LC_ALL
# LFS/HLFS/CLFS prerequisites # LFS prerequisites
if [ -n "$MIN_Linux_VER" ]; then if [ -n "$MIN_Linux_VER" ]; then
check_version "$MIN_Linux_VER" "`uname -r`" "KERNEL" check_version "$MIN_Linux_VER" "`uname -r`" "KERNEL"
fi fi
@ -106,10 +103,10 @@ check_prerequisites() { #
check_version "$MIN_Bash_VER" "$BASH_VERSION" "BASH" check_version "$MIN_Bash_VER" "$BASH_VERSION" "BASH"
fi fi
if [ ! -z $MIN_GCC_VER ]; then if [ ! -z $MIN_GCC_VER ]; then
check_version "$MIN_GCC_VER" "`gcc -dumpversion`" "GCC" check_version "$MIN_GCC_VER" "`gcc -dumpfullversion -dumpversion`" "GCC"
check_version "$MIN_GCC_VER" "`g++ -dumpversion`" "G++" check_version "$MIN_GCC_VER" "`g++ -dumpfullversion -dumpversion`" "G++"
elif [ ! -z $MIN_Gcc_VER ]; then elif [ ! -z $MIN_Gcc_VER ]; then
check_version "$MIN_Gcc_VER" "`gcc -dumpversion`" "GCC" check_version "$MIN_Gcc_VER" "`gcc -dumpfullversion -dumpversion`" "GCC"
fi fi
if [ -n "$MIN_Glibc_VER" ]; then if [ -n "$MIN_Glibc_VER" ]; then
check_version "$MIN_Glibc_VER" "$(ldd --version | head -n1 | awk '{print $NF}')" "GLIBC" check_version "$MIN_Glibc_VER" "$(ldd --version | head -n1 | awk '{print $NF}')" "GLIBC"
@ -166,6 +163,9 @@ check_prerequisites() { #
if [ -n "$MIN_Xz_VER" ]; then if [ -n "$MIN_Xz_VER" ]; then
check_version "$MIN_Xz_VER" "$(xz --version | head -n1 | cut -d" " -f4)" "XZ" check_version "$MIN_Xz_VER" "$(xz --version | head -n1 | cut -d" " -f4)" "XZ"
fi fi
if [ -n "$MIN_Python_VER" ]; then
check_version "$MIN_Python_VER" "3.$(python3 -c"import sys; print(sys.version_info.minor,'.',sys.version_info.micro,sep='')")" "PYTHON"
fi
} }
#----------------------------# #----------------------------#
@ -209,7 +209,7 @@ inline_doc
XMLLINT_LOC="$(whereis -b xmllint | cut -d" " -f2)" XMLLINT_LOC="$(whereis -b xmllint | cut -d" " -f2)"
XSLTPROC_LOC="$(whereis -b xsltproc | cut -d" " -f2)" XSLTPROC_LOC="$(whereis -b xsltproc | cut -d" " -f2)"
if [ ! -x $XMLLINT_LOC ]; then if [ ! -x $XMLLINT_LOC ]; then
echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run" echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
exit 1 exit 1
@ -225,31 +225,17 @@ inline_doc
# Version numbers are packed strings not xx.yy.zz format. # Version numbers are packed strings not xx.yy.zz format.
check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2" check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT" check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
else else
echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run" echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
exit 1 exit 1
fi fi
}
#----------------------------#
check_blfs_tools() { #
#----------------------------#
: << inline_doc
In addition to the tools needed for the LFS part, tidy and docbook-xml
are needed for installing the BLFS tools
inline_doc
# Avoid translation of version strings
local LC_ALL=C
export LC_ALL
tidyVer=$(tidy -V | cut -d " " -f9)
check_version "2004" "${tidyVer}" "TIDY"
# Now that we do profiling, we need the docbook DTD, and the docbook XSL
# stylesheets.
# Minimal docbook-xml code for testing # Minimal docbook-xml code for testing
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?> XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?> <?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl'?>
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN' <!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'> 'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'>
<article> <article>
@ -260,10 +246,17 @@ inline_doc
</sect1> </sect1>
</article>" </article>"
if `echo $XML_FILE | xmllint -nonet -noout -postvalid - 2>/dev/null` ; then if echo $XML_FILE | xmllint -nonet -noout -postvalid - 2>/dev/null ; then
check_version "4.5" "4.5" "DocBook XML DTD" check_version "4.5" "4.5" "DocBook XML DTD"
else else
echo "Error: you need the Docbook XML DTD for installing BLFS tools" echo "Error: you need the Docbook XML DTD for running jhalfs"
exit 2 exit 1
fi
if echo $XML_FILE | xsltproc -nonet -noout - 2>/dev/null ; then
check_version "current" "current" "DocBook XSL stylesheets"
else
echo "Error: you need the Docbook XSL stylesheets for running jhalfs"
exit 1
fi fi
} }

View file

@ -1,5 +1,3 @@
# $Id$
#----------------------------------# #----------------------------------#
wrt_compare_targets() { # wrt_compare_targets() { #
#----------------------------------# #----------------------------------#
@ -8,8 +6,9 @@ wrt_compare_targets() { #
# and "ITERATIONS" with no "$". # and "ITERATIONS" with no "$".
ITERATION=iteration-$N ITERATION=iteration-$N
if [ "$N" != "1" ] ; then if [ "$N" != "1" ] ; then
wrt_system_build "$N" "$PREV_IT" wrt_system_build "$1" "$N" "$PREV_IT"
fi fi
# add needed Makefile target
this_script=$ITERATION this_script=$ITERATION
CHROOT_wrt_target "$ITERATION" "$PREV" CHROOT_wrt_target "$ITERATION" "$PREV"
wrt_compare_work "$ITERATION" "$PREV_IT" wrt_compare_work "$ITERATION" "$PREV_IT"
@ -18,32 +17,33 @@ wrt_compare_targets() { #
PREV_IT=$ITERATION PREV_IT=$ITERATION
PREV=$ITERATION PREV=$ITERATION
done done
# We need to prevent "userdel" in all iterations but the last
# We need to access the scriptlets in "dir"
local dir
printf -v dir chapter%02d "$1"
REVISED=cleanup
if ls $dir/*revised* 2>/dev/null; then REVISED=revised; fi
sed -i '/userdel/d' $dir/*$REVISED*
for (( N = 2; N < ITERATIONS; N++ )); do
sed -i '/userdel/d' $dir-build_$N/*$REVISED*
done
} }
#----------------------------------# #----------------------------------#
wrt_system_build() { # wrt_system_build() { #
#----------------------------------# #----------------------------------#
local RUN=$1 local CHAP=$1
local PREV_IT=$2 local RUN=$2
local PREV_IT=$3
if [[ "$PROGNAME" = "clfs" ]] ; then chapter_targets $CHAP $RUN
final_system_Makefiles $RUN
else
chapter6_Makefiles $RUN
fi
if [[ "$PROGNAME" = "clfs" ]] ; then CHROOT_TGT="$CHROOT_TGT $PREV_IT $system_build"
basicsystem="$basicsystem $PREV_IT $system_build"
else
chapter6="$chapter6 $PREV_IT $system_build"
fi
if [[ "$RUN" = "$ITERATIONS" ]] ; then if [[ "$RUN" = "$ITERATIONS" ]] ; then
if [[ "$PROGNAME" = "clfs" ]] ; then CHROOT_TGT="$CHROOT_TGT iteration-$RUN"
basicsystem="$basicsystem iteration-$RUN"
else
chapter6="$chapter6 iteration-$RUN"
fi
fi fi
} }
@ -53,18 +53,19 @@ wrt_compare_work() { #
local ITERATION=$1 local ITERATION=$1
local PREV_IT=$2 local PREV_IT=$2
local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \ local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
/sources /root /srv /sys /tmp /tools /usr/local /usr/src" /sources /root /run /srv /sys /tmp /tools /usr/local /usr/src /var"
local ROOT_DIR=/ local ROOT_DIR=/
local DEST_TOPDIR=/${SCRIPT_ROOT} local DEST_TOPDIR=/${SCRIPT_ROOT}
local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
if [[ "$RUN_ICA" = "y" ]] ; then if [[ "$RUN_ICA" = "y" ]] ; then
local DEST_ICA=$DEST_TOPDIR/ICA && \ local DEST_ICA=$DEST_TOPDIR/ICA && \
# the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
( (
cat << EOF cat << EOF
@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\ @PRUNEPATH="$PRUNEPATH \$\$(find /usr/lib -name __pycache__)"; \\
extras/do_copy_files "\$\$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
@ -72,19 +73,6 @@ EOF
wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA" wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
fi fi
fi fi
if [[ "$RUN_FARCE" = "y" ]] ; then
local DEST_FARCE=$DEST_TOPDIR/farce && \
(
cat << EOF
@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/\$@ 2>&1 && \\
extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/\$@ 2>&1
EOF
) >> $MKFILE.tmp
if [[ "$ITERATION" != "iteration-1" ]] ; then
wrt_do_farce_work "$PREV_IT" "$ITERATION" "$DEST_FARCE"
fi
fi
} }
#----------------------------------# #----------------------------------#
@ -93,17 +81,6 @@ wrt_do_ica_work() { #
echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
} }
#----------------------------------#
wrt_do_farce_work() { #
#----------------------------------#
local OUTPUT=$FARCELOGDIR/${1}_V_${2}
local PREDIR=$3/$1
local PREFILE=$3/filelist-$1
local ITEDIR=$3/$2
local ITEFILE=$3/filelist-$2
echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/\$@ 2>&1" >> $MKFILE.tmp
}
#----------------------------------# #----------------------------------#
wrt_logs() { # wrt_logs() { #
#----------------------------------# #----------------------------------#
@ -120,12 +97,12 @@ wrt_logs() { #
for file in \`ls .\` ; do \\ for file in \`ls .\` ; do \\
mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\ mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
done ; \\ done ; \\
fi ; fi
@cd /\$(SCRIPT_ROOT) @cd /\$(SCRIPT_ROOT)
@if [ -d test-logs ] ; then \\ @if [ -d test-logs ] ; then \\
cd test-logs && \\ cd test-logs && \\
mkdir $build && \\ mkdir $build && \\
mv -f ${system_build} $build && \\ mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
if [ ! $build = build_1 ] ; then \\ if [ ! $build = build_1 ] ; then \\
cd $build && \\ cd $build && \\
for file in \`ls .\` ; do \\ for file in \`ls .\` ; do \\

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# $Id$
#----------------------------------# #----------------------------------#
wrt_CustomTools_target() { # Add any users supplied scripts wrt_CustomTools_target() { # Add any users supplied scripts
#----------------------------------# #----------------------------------#
@ -24,16 +22,8 @@ wrt_CustomTools_target() { # Add any users supplied scripts
if [[ "x${PKG}" = "x" ]]; then if [[ "x${PKG}" = "x" ]]; then
# Create an entry for a self contained cmd script that does not # Create an entry for a self contained cmd script that does not
# reference a package tarball # reference a package tarball
case $PROGNAME in CHROOT_wrt_target "${this_script}" "$PREV"
clfs2 | clfs3 ) CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
LUSER_wrt_target "${this_script}" "$PREV"
LUSER_wrt_RunAsUser "custom-tools/${this_script}"
;;
*)
CHROOT_wrt_target "${this_script}" "$PREV"
CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
;;
esac
wrt_touch wrt_touch
# Create the build script file # Create the build script file
@ -48,22 +38,11 @@ xEOFx
else else
# Create an entry for package # Create an entry for package
case $PROGNAME in CHROOT_wrt_target "${this_script}" "$PREV"
clfs2 | clfs3 ) CHROOT_Unpack "${PKG_FILE}"
LUSER_wrt_target "${this_script}" "$PREV" CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
LUSER_wrt_unpack "${PKG_FILE}" CHROOT_wrt_RemoveBuildDirs "${PKG}"
LUSER_wrt_RunAsUser "custom-tools/${this_script}" echo -e "\t@touch $TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp
LUSER_RemoveBuildDirs "${PKG}"
echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp
;;
*)
CHROOT_wrt_target "${this_script}" "$PREV"
CHROOT_Unpack "${PKG_FILE}"
CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
CHROOT_wrt_RemoveBuildDirs "${PKG}"
echo -e "\t@touch $TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp
;;
esac
wrt_touch wrt_touch
# Create the build script file # Create the build script file
@ -93,7 +72,6 @@ xEOFx
#----------------------------------# #----------------------------------#
add_CustomToolsURLS() { # Add any users supplied scripts URL information add_CustomToolsURLS() { # Add any users supplied scripts URL information
#----------------------------------# #----------------------------------#
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
local this_script local this_script
local URL PKG PKG_VERSION PKG_FILE MD5 local URL PKG PKG_VERSION PKG_FILE MD5
@ -107,10 +85,10 @@ add_CustomToolsURLS() { # Add any users supplied scripts URL informat
# A cmd only script had no PKG defined # A cmd only script had no PKG defined
[[ "x${PKG}" = "x" ]] && continue [[ "x${PKG}" = "x" ]] && continue
echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp echo "${URL} ${MD5}" >> urls.lst.tmp
# Add any patches.. # Add any patches..
for PATCH in PATCH{1..10}; do for PATCH in PATCH{1..10}; do
[[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp [[ -n ${!PATCH} ]] && echo "${!PATCH} CUSTOM-PATCH-MD5SUM" >> urls.lst.tmp
done done
done done
cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst

View file

@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
# $Id$
#----------------------------# #----------------------------#
get_sources() { # Download file, write name to MISSING_FILES.DMP if an error get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
#----------------------------# #----------------------------#
local saveIFS=$IFS
local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE WGETPARAM # Test if the packages must be downloaded
[ "$GETPKG" = y ] || return 0
local URL FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE WGETPARAM MAYBEMORE
WGETPARAM="" WGETPARAM=""
if [[ "${RETRYSRCDOWNLOAD}" = "y" ]] ; then if [[ "${RETRYSRCDOWNLOAD}" = "y" ]] ; then
@ -16,9 +16,6 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
WGETPARAM+=" --tries ${RETRYDOWNLOADCNT}" WGETPARAM+=" --tries ${RETRYDOWNLOADCNT}"
WGETPARAM+=" --timeout ${DOWNLOADTIMEOUT}" WGETPARAM+=" --timeout ${DOWNLOADTIMEOUT}"
# Test if the packages must be downloaded
[ ! "$GETPKG" = "y" ] && return
gs_wrt_message(){ gs_wrt_message(){
echo "${RED}$1${OFF}" echo "${RED}$1${OFF}"
echo "$1" >> MISSING_FILES.DMP echo "$1" >> MISSING_FILES.DMP
@ -26,59 +23,44 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
# Housekeeping # Housekeeping
[[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
cd $BUILDDIR/sources cd $BUILDDIR/sources
# If using CLFS, /sources is writable by all, but with sticky bit,
# and user does not hold MD5SUMS nor the other files, so use sudo
[[ -f MD5SUMS ]] && sudo rm MD5SUMS
[[ -f MISSING_FILES.DMP ]] && sudo rm MISSING_FILES.DMP
[[ -f urls.lst ]] && sudo rm urls.lst
# Generate URLs file # Generate URLs file
create_urls create_urls
IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only # Clean up leftovers from preceding attempts
for line in `cat urls.lst`; do >MISSING_FILES.DMP
IFS=$saveIFS # Restore the system defaults
# Skip some packages if they aren't needed # Normally, urls.lst contains lines with two fields:
case $line in # <package url> <book md5>, but
*/tree* | */gcc-testsuite* ) #unneeded now? # if a custom patch has an md5, there is a third field
[[ "$TEST" = "0" ]] && continue # on the line, due to the way add_CustomToolsURLS works.
;; cat urls.lst | while read URL BOOKMD5 MAYBEMORE; do
*/vim-*-lang* ) FILE=$(basename "$URL") # File name
[[ "$VIMLANG" = "0" ]] && continue
;;
esac
# Locations
URL1=`echo $line | cut -d" " -f2` # Preferred URL
URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
FILE=`basename $URL1` # File name
BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
# Validation pair # Validation pair
MD5="$BOOKMD5 $FILE" MD5="$BOOKMD5 $FILE"
HAVEMD5=1 HAVEMD5=1
set -e set -e
# If the file exists in the archive copy it to the # If the file exists in the archive, copy it to the
# $BUILDDIR/sources dir. MD5SUM will be validated later. # $BUILDDIR/sources dir. MD5SUM will be validated later.
if [ ! -z ${SRC_ARCHIVE} ] && if [ -n "${SRC_ARCHIVE}" ] &&
[ -d ${SRC_ARCHIVE} ] && [ -d "${SRC_ARCHIVE}" ] &&
[ -f ${SRC_ARCHIVE}/$FILE ]; then [ -f "${SRC_ARCHIVE}/$FILE" ]; then
cp ${SRC_ARCHIVE}/$FILE . cp "${SRC_ARCHIVE}/$FILE" .
echo "$FILE: -- copied from $SRC_ARCHIVE" echo "$FILE: -- copied from $SRC_ARCHIVE"
fromARCHIVE=1 fromARCHIVE=1
else else
fromARCHIVE=0 fromARCHIVE=0
# If the file does not exist yet in /sources download a fresh one # If the file does not exist yet in /sources, download a fresh one
if [ ! -f $FILE ] ; then if [ ! -f "$FILE" ] ; then
if [[ ! ("$SRC_ARCHIVE" = "") ]] ; then if [ -n "$SRC_ARCHIVE" ] ; then
echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} or ${BUILDDIR}/sources${OFF}" echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} nor in ${BUILDDIR}/sources${OFF}"
else else
echo "${BOLD}${YELLOW}$FILE: not found in ${BUILDDIR}/sources${OFF}" echo "${BOLD}${YELLOW}$FILE: not found in ${BUILDDIR}/sources${OFF}"
fi fi
if ! wget $URL1 $WGETPARAM && ! wget $URL2 $WGETPARAM ; then if ! wget "$URL" $WGETPARAM; then
gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING" gs_wrt_message "$FILE not found on any server..SKIPPING"
continue continue
fi fi
else else
@ -86,22 +68,22 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
fi fi
fi fi
# Deal with udev and bootscripts m5sum issue # Deal with bootscripts md5sum issue,
[[ $BOOKMD5 = "BOOTSCRIPTS-MD5SUM" ]] && continue # or skip if it is a custom patch without md5
[[ $BOOKMD5 = "UDEV-MD5SUM" ]] && continue [ $BOOKMD5 = "BOOTSCRIPTS-MD5SUM" ] && continue
[[ $BOOKMD5 = "LFS-NETSCRIPTS-MD5SUM" ]] && continue [ $BOOKMD5 = "CUSTOM-PATCH-MD5SUM" ] && continue
# IF the md5sum does not match the existing files # IF the md5sum does not match
if ! echo "$MD5" | md5sum -c - >/dev/null ; then if ! echo "$MD5" | md5sum -c - >/dev/null ; then
[[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}" [ "$fromARCHIVE" = 1 ] && echo "${BOLD}${YELLOW}MD5SUM did not match $SRC_ARCHIVE copy${OFF}"
[[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}" [ "$fromARCHIVE" = 0 ] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
# Remove the old file and download a new one # Remove the old file and download a new one
rm -fv $FILE rm -fv "$FILE"
# Force storage in SRC_ARCHIVE # Force storage in SRC_ARCHIVE
fromARCHIVE=0; fromARCHIVE=0;
# Try to retrieve again the file. Servers in reverse order. # Try to retrieve again the file.
if ! wget $URL2 $WGETPARAM && ! wget $URL1 $WGETPARAM ; then if ! wget "$URL" $WGETPARAM; then
gs_wrt_message "$FILE not found on the servers.. SKIPPING" gs_wrt_message "$FILE not found on the server... SKIPPING"
continue continue
fi fi
fi fi
@ -114,7 +96,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
fi fi
# Generate a fresh MD5SUM for this file # Generate a fresh MD5SUM for this file
if [[ "$HAVEMD5" = "0" ]] ; then if [ "$HAVEMD5" = "0" ] ; then
echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE" echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
fi fi
@ -124,12 +106,13 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
# Copy the freshly downloaded file # Copy the freshly downloaded file
# to the source archive. # to the source archive.
if [ ! -z ${SRC_ARCHIVE} ] && if [ -n "${SRC_ARCHIVE}" ] &&
[ -d ${SRC_ARCHIVE} ] && [ -d "${SRC_ARCHIVE}" ] &&
[ -w ${SRC_ARCHIVE} ] && [ -w "${SRC_ARCHIVE}" ] &&
[ "$fromARCHIVE" = "0" ] ; then [ ! -f "${SRC_ARCHIVE}/$FILE" ] &&
[ "$fromARCHIVE" = 0 ] ; then
echo "Storing file:<$FILE> in the package archive" echo "Storing file:<$FILE> in the package archive"
cp -f $FILE ${SRC_ARCHIVE} cp -f "$FILE" "${SRC_ARCHIVE}"
fi fi
done done
@ -147,38 +130,14 @@ create_urls() { #
#----------------------------# #----------------------------#
cd $JHALFSDIR cd $JHALFSDIR
case ${PROGNAME} in echo -n "Creating URLs file... "
clfs*) xsltproc --nonet --xinclude \
echo -n "Creating CLFS <${ARCH}> specific URLs file" --stringparam pkgmngt "$PKGMNGT" \
xsltproc --nonet --xinclude \ --stringparam revision "$INITSYS" \
--stringparam server $SERVER \ --output ../sources/urls.lst \
--stringparam family clfs \ urls.xsl \
-o $BUILDDIR/sources/urls.lst urls.xsl \ $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
$BOOK/BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 echo "OK"
echo " ...OK"
;;
hlfs)
echo -n "Creating HLFS <${MODEL}> + <${KERNEL}> specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam family lfs \
--stringparam model $MODEL \
--stringparam kernel $KERNEL \
-o $BUILDDIR/sources/urls.lst urls.xsl \
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
lfs)
echo -n "Creating LFS specific URLs file"
xsltproc --nonet --xinclude \
--stringparam server $SERVER \
--stringparam family lfs \
--stringparam pkgmngt $PKGMNGT \
-o ../sources/urls.lst urls.xsl \
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
esac
cd $BUILDDIR/sources cd $BUILDDIR/sources

View file

@ -1,30 +1,27 @@
#!/bin/bash #!/bin/bash
# $Id$
#----------------------------# Prepare BLFS_ROOT and extract #----------------------------# Prepare BLFS_ROOT and extract
install_blfs_tools() { # the scriptlets to build install_blfs_tools() { # the scriptlets to build
#----------------------------# the dependency tools #----------------------------# the dependency tools
set -e set -e
# Install the files # Install the files
[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT} [[ ! -d "${BUILDDIR}${BLFS_ROOT}" ]] && {
sudo mkdir -pv "${BUILDDIR}${BLFS_ROOT}"
sudo chown "$USER" "${BUILDDIR}${BLFS_ROOT}"
}
cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT} cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
cp -r menu ${BUILDDIR}${BLFS_ROOT} cp -r menu ${BUILDDIR}${BLFS_ROOT}
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT} cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
cp README.BLFS ${BUILDDIR}${BLFS_ROOT} cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
if [ "$WRAP_INSTALL" = y ]; then
# Clean-up sed -e 's/PKGDIR/JH_UNPACKDIR/' \
make -C ${BUILDDIR}${BLFS_ROOT}/menu clean -e 's/PKG_DEST/JH_PKG_DIR/' \
rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn $PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn fi
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
# Set some harcoded envars to their proper values # Set some harcoded envars to their proper values
sed -i s@tracking-dir@$TRACKING_DIR@ \ sed -i s@tracking-dir@$TRACKING_DIR@ \
${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh} ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh,gen_pkg_book.sh}
sed -i s@trunk/BOOK@$BLFS_TREE@ \
${BUILDDIR}${BLFS_ROOT}/Makefile
# If we have a working copy, copy it: # If we have a working copy, copy it:
if [[ "$BLFS_WORKING_COPY" = "y" ]]; then if [[ "$BLFS_WORKING_COPY" = "y" ]]; then
@ -33,15 +30,45 @@ echo "copying the local BLFS working copy (may take some time)"
# of blfs-xml, if blfs-xml already exists; --preserve=timestamps: if the local # of blfs-xml, if blfs-xml already exists; --preserve=timestamps: if the local
# book has already been validated, tmp is posterior to the others, and # book has already been validated, tmp is posterior to the others, and
# validation will not be done again. # validation will not be done again.
cp -ruT --preserve=timestamps $BLFS_WC_LOCATION \ # sudo is needed because make (below) may already have been run and
${BUILDDIR}${BLFS_ROOT}/blfs-xml # may have put some files owned by root
sudo cp -ruT --preserve=timestamps $BLFS_WC_LOCATION \
${BUILDDIR}${BLFS_ROOT}/$BLFS_XML
fi fi
# Copy the LFS book. Note that now, the book is downloaded before running
# the BLFS tools.
sudo cp -ruT --preserve=timestamps $BOOK \
${BUILDDIR}${BLFS_ROOT}/$LFS_XML
# Downloads the book if necessary, initialize the tracking file and the # Downloads the book if necessary, initialize the tracking file and the
# package database. # package database.
# updating first is needed if the xml sources have already been cloned
# and we want to set the branches.
# Note that if LFS-BRANCH or BLFS-BRANCH is empty, which may happen
# if using a working copy, then the corresponding update is not
# performed by make (see BLFS/Makefile).
# sudo is needed if $BUILDDIR/var/lib is owned by root and /var/lib/jhalfs # sudo is needed if $BUILDDIR/var/lib is owned by root and /var/lib/jhalfs
# has to be created # has to be created
sudo make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$BUILDDIR$TRACKING_DIR \ sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
$BUILDDIR$BLFS_ROOT/packages.xml REV=$INITSYS \
LFS-BRANCH=${COMMIT} \
BLFS-BRANCH=${BLFS_COMMIT} \
update
sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
REV=$INITSYS \
TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
LFS_XML=$BUILDDIR$BLFS_ROOT/$LFS_XML \
LFS-BRANCH="${COMMIT}" \
BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
BLFS-BRANCH=${BLFS_COMMIT} \
$BUILDDIR$BLFS_ROOT/packages.xml
# But then $BUILDDIR/var/lib/ is owned by root if just created, which
# prevents $LUSER to create "nss_db". The problem is that $LUSER
# May not have been created yet. So do not change ownership here
# and do it in master.sh for chapter 4.
#sudo chown $LUSER:$LGROUP $BUILDDIR/var/lib
# Because the BLFS Makefile is supposed to be used in chroot (or booted) # Because the BLFS Makefile is supposed to be used in chroot (or booted)
# mode, the tracking file has wrong path for DTD. Change it: # mode, the tracking file has wrong path for DTD. Change it:
@ -58,11 +85,6 @@ if [ "$DEP_LIBXSLT" = y ]; then
else else
LINE_LIBXSLT='#CONFIG_libxslt is not set' LINE_LIBXSLT='#CONFIG_libxslt is not set'
fi fi
if [ "$DEP_TIDY" = y ]; then
LINE_TIDY='CONFIG_html-tidy=y'
else
LINE_TIDY='#CONFIG_html-tidy is not set'
fi
# DocBook is a rec dep of libxslt # DocBook is a rec dep of libxslt
# if [ "$DEP_DBXML" = y ]; then # if [ "$DEP_DBXML" = y ]; then
# LINE_DBXML='CONFIG_DocBook=y' # LINE_DBXML='CONFIG_DocBook=y'
@ -89,58 +111,67 @@ if [ "$DEP_GPM" = y ]; then
else else
LINE_GPM='#CONFIG_gpm is not set' LINE_GPM='#CONFIG_gpm is not set'
fi fi
if [ "$DEP_SVN" = y ]; then if [ "$DEP_GIT" = y ]; then
LINE_SVN='CONFIG_subversion=y' LINE_GIT='CONFIG_git=y'
else else
LINE_SVN='#CONFIG_subversion is not set' LINE_GIT='#CONFIG_git is not set'
fi
if [ "$DEP_OPENSSL" = y ]; then
LINE_OPENSSL='CONFIG_openssl=y'
else
LINE_OPENSSL='#CONFIG_openssl is not set'
fi
if [ "$DEP_PYTHON" = y ]; then
LINE_PYTHON='CONFIG_python2=y'
else
LINE_PYTHON='#CONFIG_python2 is not set'
fi fi
cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
$LINE_OPENSSL
$LINE_PYTHON
$LINE_LIBXML $LINE_LIBXML
$LINE_LIBXSLT $LINE_LIBXSLT
$LINE_TIDY
$LINE_WGET $LINE_WGET
$LINE_SVN $LINE_GIT
$LINE_GPM $LINE_GPM
$LINE_LYNX $LINE_LYNX
$LINE_SUDO $LINE_SUDO
MAIL_SERVER=sendmail MAIL_SERVER=sendmail
optDependency=2 optDependency=2
SUDO=n SUDO=n
LANGUAGE=$LANG
WRAP_INSTALL=$WRAP_INSTALL
PACK_INSTALL=/blfs_root/packInstall.sh
DEL_LA_FILES=$DEL_LA_FILES
STATS=n
SRC_ARCHIVE=/sources
BUILD_ROOT=/sources
BUILD_SUBDIRS=y
JOBS=$(if [ "$ALL_CORES" = y ]; then echo 0; else echo $N_PARALLEL; fi)
EOF EOF
# The 0 value above is for using all cores
for OPT_VAR in CFLAGS CXXFLAGS LDFLAGS; do
eval optVal=\$${OPT_VAR}_$DEF_OPT_MODE
if [ -n "$optVal" ] && [ "$optVal" != unset ]; then
echo "CFG_$OPT_VAR"=\"$optVal\" >> $BUILDDIR$BLFS_ROOT/configuration
else
echo "CFG_$OPT_VAR"=EMPTY >> $BUILDDIR$BLFS_ROOT/configuration
fi
done
# Generates the scripts for the blfs tools dependencies (in ./scripts) # Generates the scripts for the blfs tools dependencies (in ./scripts)
yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh \
$BUILDDIR$TRACKING_DIR/instpkg.xml \
$BUILDDIR$BLFS_ROOT
# Move the scriptlets where they should be # Move the scriptlets where they should be
sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts
mv scripts $BUILDDIR$BLFS_ROOT mv scripts $BUILDDIR$BLFS_ROOT
# The book instructions for CA certificates contains downloading
# instructions, which should not be used here, so:
if test -f $BUILDDIR$BLFS_ROOT/scripts/*cacerts; then
sed -i '/URL=/,/^wget/d' $BUILDDIR$BLFS_ROOT/scripts/*cacerts
fi
# Generates a list containing download and copying instructions for tarballs # Generates a list containing download and copying instructions for tarballs
echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
sed -n -e '/PACKAGE=/,/^fi/p' \ sed -n -e '/PACKAGE=/,/^fi/{/^fi/a\
[ ! -f "$JH_SRC_ARCHIVE/$PACKAGE" ] && cp $PACKAGE $JH_SRC_ARCHIVE
p}' \
-e '/|[ ]*md5sum/p' \ -e '/|[ ]*md5sum/p' \
-e '/PACKAGE1=/,/^fi/p' \ -e '/PACKAGE1=/,/^fi/{/^fi/a\
-e '/PATCH=/,/^fi/p' \ [ ! -f "$JH_SRC_ARCHIVE/$PACKAGE1" ] && cp $PACKAGE1 $JH_SRC_ARCHIVE
-e '/URL=/,/^fi/p' \ p}' \
-e '/PATCH=/,/^fi/{/^fi/a\
[ ! -f "$JH_SRC_ARCHIVE/$PATCH" ] && cp $PATCH $JH_SRC_ARCHIVE
p}' \
-e '/URL=/,/^fi/{/^fi/a\
[ ! -f "$JH_SRC_ARCHIVE/$BOOTPACKG" ] && cp $BOOTPACKG $JH_SRC_ARCHIVE
p}' \
$BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
chmod u+x $BUILDDIR$BLFS_ROOT/download_script chmod u+x $BUILDDIR$BLFS_ROOT/download_script
@ -148,7 +179,12 @@ chmod u+x $BUILDDIR$BLFS_ROOT/download_script
pushd $BUILDDIR/sources pushd $BUILDDIR/sources
# Remove `unpacked' files if some have been left # Remove `unpacked' files if some have been left
sudo find . -name unpacked -exec rm \{\} \; sudo find . -name unpacked -exec rm \{\} \;
FTP_SERVER=$SERVER/pub/blfs/ SRC_ARCHIVE=$SRC_ARCHIVE $BUILDDIR$BLFS_ROOT/download_script if [ "$GETPKG" = "y" ]; then
JH_SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \
$BUILDDIR$BLFS_ROOT/download_script
else # Save the download script in case the user wants to run it later
cp $BUILDDIR$BLFS_ROOT/download_script .
fi
popd popd
rm -v $BUILDDIR$BLFS_ROOT/download_script rm -v $BUILDDIR$BLFS_ROOT/download_script
@ -160,7 +196,7 @@ if [ "$DEP_LIBXSLT" = y ]; then
# line (without '&&'). I have not found a simple way to delete lines # line (without '&&'). I have not found a simple way to delete lines
# between 2 addresses, excluding either the first or the last one. So use # between 2 addresses, excluding either the first or the last one. So use
# a loop for accumulating lines and deleting at the end. # a loop for accumulating lines and deleting at the end.
# Sorry for sed synthax. # Sorry for sed syntax.
sed -i '\@^[[:space:]]*/etc/xml/catalog$@{ sed -i '\@^[[:space:]]*/etc/xml/catalog$@{
n n
:a :a
@ -174,16 +210,6 @@ fi
if [ "$DEP_SUDO" = y ]; then if [ "$DEP_SUDO" = y ]; then
sed -i '/cat.*pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo sed -i '/cat.*pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
fi fi
if [ "$DEP_SVN" = y ]; then
sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
fi
if [ "$DEP_LYNX" = y ]; then
if [ "$DEP_OPENSSL" = y -o "$DEP_WGET" = y ]; then
sed -i -e 's/configure/& --with-ssl/' \
-e '/make$/i echo "#define USE_OPENSSL_INCL 1" >> lynx_cfg.h &&' \
$BUILDDIR$BLFS_ROOT/scripts/*lynx
fi
fi
# At last generates the build Makefile # At last generates the build Makefile
mkdir -p $BUILDDIR$BLFS_ROOT/work mkdir -p $BUILDDIR$BLFS_ROOT/work
pushd $BUILDDIR$BLFS_ROOT/work pushd $BUILDDIR$BLFS_ROOT/work
@ -192,19 +218,50 @@ pushd $BUILDDIR$BLFS_ROOT/work
# installation, using libxslt, which is not installed yet. So move # installation, using libxslt, which is not installed yet. So move
# updating to the end of the process, adding an 'update' target # updating to the end of the process, adding an 'update' target
sed -i -e '/xsltproc/,+6d' \ sed -i -e '/xsltproc/,+6d' \
-e '/^all/s@$@ update@' \ -e '/^all/i update:' \
-e 's/touch/@touch/' Makefile -e 's/touch/@touch/' Makefile
cat >> Makefile << EOF cat >> Makefile << EOF
update: update: all
@echo Updating the tracking file @echo Updating the tracking file
@for file in *-*; do \\ @for pack in \$\$(grep '<productname' ../$LFS_XML/tmp/lfs-full.xml | \\
sed 's/.*>\([^<]*\)<.*/\1/' | \\
sort | uniq); do \\
case "x\$\$pack" in \\
xgcc* | *pass[12] | xvim | \\
xshadow | xPython | xlinux-headers | xdbus | xsystemd )\\
continue ;; \\
esac; \\
VERSION=\$\$(grep -A1 ">\$\$pack</product" \\
../$LFS_XML/tmp/lfs-full.xml | \\
head -n2| \\
sed -n '2s/.*>\([^<]*\)<.*/\1/p'); \\
xsltproc --stringparam packages ../packages.xml \\
--stringparam package \$\$pack \\
--stringparam version \$\$VERSION \\
-o track.tmp \\
../xsl/bump.xsl \$(TRACKING_FILE); \\
sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
rm track.tmp; \\
done; \\
VERSION=\$\$(grep 'echo.*lfs-release' ../$LFS_XML/tmp/lfs-full.xml | \\
sed 's/.*echo[ ]*\([^ ]*\).*/\1/'); \\
xsltproc --stringparam packages ../packages.xml \\ xsltproc --stringparam packages ../packages.xml \\
--stringparam package \$\${file##*z-} \\ --stringparam package LFS-Release \\
-o track.tmp \\ --stringparam version \$\$VERSION \\
../xsl/bump.xsl \$(TRACKING_FILE); \\ -o track.tmp \\
../xsl/bump.xsl \$(TRACKING_FILE); \\
sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\ sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\ xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
rm track.tmp; \\ rm track.tmp; \\
for file in *-*; do \\
xsltproc --stringparam packages ../packages.xml \\
--stringparam package \$\${file##*z-} \\
-o track.tmp \\
../xsl/bump.xsl \$(TRACKING_FILE); \\
sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
rm track.tmp; \\
done done
@touch \$@ @touch \$@
@echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK

83
common/libs/func_save.sh Normal file
View file

@ -0,0 +1,83 @@
#----------------------------------#
wrt_save_target() { #
#----------------------------------#
local target
case $1 in
SUDO_TGT ) target=SUDO ;;
CHROOT_TGT ) target=CHROOT ;;
esac
CHROOT_wrt_target save-ch5 "$PREV";
wrt_save_work $target
wrt_touch
PREV=save-ch5
eval $1=\"\$$1 save-ch5\"
}
#----------------------------------#
wrt_save_work() { #
#----------------------------------#
local ROOT_DIR
case x"$1" in
xSUDO ) ROOT_DIR="$BUILDDIR/" ;;
xCHROOT) ROOT_DIR=/ ;;
esac
local PRUNEPATH="./dev ./home ./lost+found ./media ./mnt ./opt ./proc ./root ./run ./srv ./sys ./tmp ./var"
local DEST_TOPDIR="${ROOT_DIR}${SCRIPT_ROOT}"
(
cat << EOF
@mkdir -p /tmp >>logs/\$@ 2>&1 && \\
TARNAME=chapter5-\$\$(date +%Y-%m-%d-T-%Hh%M).tar && \\
TMPFILE=\$\$(mktemp -p /tmp) && \\
TMPLOG=\$\$(mktemp -p /tmp) && \\
for F in $PRUNEPATH; do echo \$\$F >> \$\$TMPFILE; done && \\
tar -X \$\$TMPFILE -cvf /tmp/\$\$TARNAME -C ${ROOT_DIR} . >>\$\$TMPLOG 2>>logs/\$@ && \\
cat \$\$TMPLOG >>logs/\$@ 2>&1 && \\
mv /tmp/\$\$TARNAME $DEST_TOPDIR >>logs/\$@ 2>&1 && \\
rm \$\$TMPFILE \$\$TMPLOG
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_do_ica_work() { #
#----------------------------------#
echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
}
#----------------------------------#
wrt_logs() { #
#----------------------------------#
local build=build_$1
local file
(
cat << EOF
@cd logs && \\
mkdir $build && \\
mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
if [ ! $build = build_1 ] ; then \\
cd $build && \\
for file in \`ls .\` ; do \\
mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
done ; \\
fi
@cd /\$(SCRIPT_ROOT)
@if [ -d test-logs ] ; then \\
cd test-logs && \\
mkdir $build && \\
mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
if [ ! $build = build_1 ] ; then \\
cd $build && \\
for file in \`ls .\` ; do \\
mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
done ; \\
fi ; \\
cd /\$(SCRIPT_ROOT) ; \\
fi ;
EOF
) >> $MKFILE.tmp
}

View file

@ -1,5 +1,3 @@
# $Id$
declare -r dotSTR=".................." declare -r dotSTR=".................."
@ -7,12 +5,10 @@ declare -r dotSTR=".................."
validate_config() { # Are the config values sane (within reason) validate_config() { # Are the config values sane (within reason)
#----------------------------# #----------------------------#
: <<inline_doc : <<inline_doc
Validates the configuration parameters. The global var PROGNAME selects the Validates the configuration parameters.
parameter list.
input vars: none input vars: none
externals: color constants externals: color constants
PROGNAME (lfs,hlfs,clfs,clfs2,clfs3,blfs)
modifies: none modifies: none
returns: nothing returns: nothing
on error: write text to console and dies on error: write text to console and dies
@ -20,46 +16,33 @@ validate_config() { # Are the config values sane (within reason)
inline_doc inline_doc
# Common settings by Config.in sections and books family # Common settings by Config.in sections and books family
local -r BOOK_common="BOOK CUSTOM_TOOLS" local -r BOOK_common="COMMIT BOOK CUSTOM_TOOLS"
local -r BOOK_clfsX="ARCH TARGET"
local -r GENERAL_common="LUSER LGROUP LHOME BUILDDIR CLEAN GETPKG SRC_ARCHIVE \ local -r GENERAL_common="LUSER LGROUP LHOME BUILDDIR CLEAN GETPKG SRC_ARCHIVE \
SERVER RETRYSRCDOWNLOAD RETRYDOWNLOADCNT DOWNLOADTIMEOUT \ RETRYSRCDOWNLOAD RETRYDOWNLOADCNT DOWNLOADTIMEOUT \
RUNMAKE" RUNMAKE"
local -r BUILD_chroot="TEST BOMB_TEST STRIP" local -r BUILD_chroot="TEST STRIP"
local -r BUILD_common="FSTAB CONFIG TIMEZONE PAGE LANG INSTALL_LOG" local -r BUILD_common="FSTAB CONFIG TIMEZONE PAGE LANG INSTALL_LOG"
local -r ADVANCED_chroot="COMPARE RUN_ICA RUN_FARCE ITERATIONS OPTIMIZE" local -r ADVANCED_chroot="COMPARE RUN_ICA ITERATIONS OPTIMIZE"
local -r ADVANCED_common="REPORT REBUILD_MAKEFILE" local -r ADVANCED_common="REPORT REBUILD_MAKEFILE"
# BOOK Settings by book # BOOK Settings by book
local -r LFS_book="$BOOK_common BLFS_TOOL" local -r LFS_book="$BOOK_common INITSYS BLFS_TOOL"
#local -r HLFS_added="SET_SSP SET_ASLR SET_PAX SET_HARDENED_TMP SET_WARNINGS \
# SET_MISC SET_BLOWFISH"
local -r HLFS_added=""
local -r HLFS_book="$BOOK_common BLFS_TOOL MODEL KERNEL GRSECURITY_HOST $HLFS_added"
local -r CLFS_book="$BOOK_common BLFS_TOOL METHOD $BOOK_clfsX TARGET32 BOOT_CONFIG"
local -r CLFS2_book="$BOOK_common BLFS_TOOL $BOOK_clfsX"
local -r CLFS3_book="$BOOK_common $BOOK_clfsX PLATFORM MIPS_LEVEL"
# Build Settings by book # Build Settings by book
local -r LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE" local -r LFS_build="$BUILD_chroot NCURSES5 $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
local -r HLFS_build="$BUILD_chroot $BUILD_common"
local -r CLFS_build="$BUILD_chroot VIMLANG $BUILD_common" # System Settings by book
local -r CLFS2_build="STRIP VIMLANG $BUILD_common" local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT KEYMAP LOCAL LOG_LEVEL"
local -r CLFS3_build=" $BUILD_common"
# Full list of books settings # Full list of books settings
local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $ADVANCED_chroot $ADVANCED_common" local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $LFS_system $ADVANCED_chroot ALL_CORES CPUSET N_PARALLEL REALSBU SAVE_CH5 $ADVANCED_common"
local -r hlfs_PARAM_LIST="$HLFS_book $GENERAL_common $HLFS_build $ADVANCED_chroot $ADVANCED_common"
local -r clfs_PARAM_LIST="$CLFS_book $GENERAL_common $CLFS_build $ADVANCED_chroot $ADVANCED_common"
local -r clfs2_PARAM_LIST="$CLFS2_book $GENERAL_common $CLFS2_build $ADVANCED_common"
local -r clfs3_PARAM_LIST="$CLFS3_book $GENERAL_common $CLFS3_build $ADVANCED_common"
# local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR" # local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
# Additional variables # Additional variables
local -r blfs_tool_PARAM_LIST="\ local -r blfs_tool_PARAM_LIST="\
BLFS_TREE BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR \ BLFS_COMMIT BLFS_ROOT BLFS_XML TRACKING_DIR \
DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_DBXML DEP_LYNX DEP_SUDO DEP_WGET \ DEP_LIBXML DEP_LIBXSLT DEP_DBXML DEP_LYNX DEP_SUDO DEP_WGET \
DEP_SVN DEP_GPM DEP_OPENSSL DEP_PYTHON" DEP_GIT DEP_GPM"
local -r custom_tool_PARAM_LIST="TRACKING_DIR" local -r custom_tool_PARAM_LIST="TRACKING_DIR"
# Internal variables # Internal variables
@ -80,6 +63,15 @@ inline_doc
exit 1 exit 1
} }
# This function is only used when testing package management files.
write_pkg_and_die() {
echo -e "\n${DD_BORDER}"
echo "Package management is requested but" >&2
echo -e $* >&2
echo -e "${DD_BORDER}\n"
exit 1
}
validate_file() { validate_file() {
# For parameters ending with a '+' failure causes a warning message only # For parameters ending with a '+' failure causes a warning message only
echo -n "`eval echo $PARAM_VALS`" echo -n "`eval echo $PARAM_VALS`"
@ -129,21 +121,19 @@ inline_doc
} }
set +e set +e
PARAM_GROUP=${PROGNAME}_PARAM_LIST for config_param in $lfs_PARAM_LIST; do
for config_param in ${!PARAM_GROUP}; do
case $config_param in case $config_param in
# Envvars that depend on other settings to be displayed # Envvars that depend on other settings to be displayed
COMPARE) [[ ! "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; COMPARE) [[ ! "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
RUN_ICA) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; RUN_ICA) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
RUN_FARCE) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
BOMB_TEST) [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
TARGET32) [[ -n "${TARGET32}" ]] && echo -e "`eval echo $PARAM_VALS`" ;; TARGET32) [[ -n "${TARGET32}" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
MIPS_LEVEL) [[ "${ARCH}" = "mips" ]] && echo -e "`eval echo $PARAM_VALS`" ;; MIPS_LEVEL) [[ "${ARCH}" = "mips" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
SERVER) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
RETRYSRCDOWNLOAD) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; RETRYSRCDOWNLOAD) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
RETRYDOWNLOADCNT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; RETRYDOWNLOADCNT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
DOWNLOADTIMEOUT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; DOWNLOADTIMEOUT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
CPUSET) [[ "$HAVE_CGROUP" = "y" ]] && [[ "$ALL_CORES" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
N_PARALLEL) [[ "$ALL_CORES" = "n" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
# Envars that requires some validation # Envars that requires some validation
LUSER) echo -e "`eval echo $PARAM_VALS`" LUSER) echo -e "`eval echo $PARAM_VALS`"
@ -164,7 +154,7 @@ inline_doc
# warning -z+ -w+ # warning -z+ -w+
SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;; SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;;
# The build directory/partition MUST exist and be writable by the user # The build directory/partition MUST exist and be writable by the user
BUILDDIR) validate_dir -z -d -w BUILDDIR) validate_dir -z -d
[[ "xx x/x" =~ x${!config_param}x ]] && write_error_and_die ;; [[ "xx x/x" =~ x${!config_param}x ]] && write_error_and_die ;;
LHOME) validate_dir -z -d ;; LHOME) validate_dir -z -d ;;
@ -176,7 +166,7 @@ inline_doc
BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;; BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;;
# Treatment of LANG parameter # Treatment of LANG parameter
LANG ) # See it the locale value has been set LANG ) # See if the locale value has been set
echo -n "`eval echo $PARAM_VALS`" echo -n "`eval echo $PARAM_VALS`"
[[ -z "${!config_param}" ]] && [[ -z "${!config_param}" ]] &&
echo " -- Variable $config_param cannot be empty!" && echo " -- Variable $config_param cannot be empty!" &&
@ -184,7 +174,36 @@ inline_doc
echo echo
;; ;;
# Display non-validated envars found in ${PROGNAME}_PARAM_LIST # Treatment of HOSTNAME
HOSTNAME) echo -e "`eval echo $PARAM_VALS`"
[[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
;;
# Case of PKGMNGT: two files, packageManager.xml and packInstall.sh
# must exist in $PKGMNGTDIR if PKGMNGT='y':
PKGMNGT) echo -e "`eval echo $PARAM_VALS`"
if [ "$PKGMNGT" = y ]; then
if [ ! -e "$PKGMNGTDIR/packageManager.xml" ]; then
write_pkg_and_die $PKGMNGTDIR/packageManager.xml does not exist
fi
if [ ! -e "$PKGMNGTDIR/packInstall.sh" ]; then
write_pkg_and_die $PKGMNGTDIR/packInstall.sh does not exist
fi
if [ ! -s "$PKGMNGTDIR/packageManager.xml" ]; then
write_pkg_and_die $PKGMNGTDIR/packageManager.xml has zero size
fi
if [ ! -s "$PKGMNGTDIR/packInstall.sh" ]; then
write_pkg_and_die $PKGMNGTDIR/packInstall.sh has zero size
fi
if [ ! -r "$PKGMNGTDIR/packageManager.xml" ]; then
write_pkg_and_die $PKGMNGTDIR/packageManager.xml is not readable
fi
if [ ! -r "$PKGMNGTDIR/packInstall.sh" ]; then
write_pkg_and_die $PKGMNGTDIR/packInstall.sh is not readable
fi
fi
;;
# Display non-validated envars found in lfs_PARAM_LIST
* ) echo -e "`eval echo $PARAM_VALS`" ;; * ) echo -e "`eval echo $PARAM_VALS`" ;;
esac esac

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# $Id$
#=== MAKEFILE HEADER === #=== MAKEFILE HEADER ===
#----------------------------------# #----------------------------------#
@ -27,24 +25,26 @@ SCRIPT_ROOT = $SCRIPT_ROOT
BASEDIR = \$(MOUNT_PT) BASEDIR = \$(MOUNT_PT)
SRCSDIR = \$(BASEDIR)/sources SRCSDIR = \$(BASEDIR)/sources
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$COMMANDS
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands crCMDSDIR = /\$(SCRIPT_ROOT)/$COMMANDS
crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE
crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
SU_LUSER = sudo -u \$(LUSER) -i sh -c SU_LUSER = sudo -H -u \$(LUSER) sh -c
LUSER_HOME = \$(LHOME)/\$(LUSER) LUSER_HOME = \$(LHOME)/\$(LUSER)
PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n" PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n"
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found / \`\n" PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found --exclude /var/lib / \`\n"
ADD_REPORT = $REPORT ADD_REPORT = $REPORT
ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
ADD_BLFS_TOOLS = $BLFS_TOOL ADD_BLFS_TOOLS = $BLFS_TOOL
PKGMNGT = $PKGMNGT PKGMNGT = $PKGMNGT
WRAP_INSTALL = $WRAP_INSTALL
CPUSET = $CPUSET
export PATH := \${PATH}:/usr/sbin export PATH := \${PATH}:/usr/sbin
@ -58,102 +58,6 @@ EOF
#======================= #=======================
#==== PACKAGES NAMES AND VERSIONS ====
#----------------------------------#
get_package_tarball_name() { #
#----------------------------------#
local script_name=`echo ${1} | sed -e 's@^[0-9]\{1\}-@@'`
# The use of 'head' is necessary to limit the return value to the FIRST match..
# hopefully this will not cause problems.
#
case $script_name in
tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
iputils) echo $(grep "^iputils" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
powerpc-utils) echo $(grep "^powerpc-utils" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
uClibc)
if [[ "${PROGNAME}" = "clfs3" ]]; then
echo $(grep "^uClibc-" $JHALFSDIR/pkg_tarball_list | head -n1 )
else
echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
fi
;;
linux-headers)
if [[ "${PROGNAME}" = "lfs" ]] || [[ "${PROGNAME}" = "hlfs" ]] || [[ "${PROGNAME}" = "clfs" ]]; then
# Uses kernel headers directly
echo $(grep "^linux-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
else
# CLFS{2,3} used to use massaged headers package
# echo $(grep "^linux-headers-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
echo $(grep "^linux-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
fi
;;
expect) echo $(grep "^expect" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
e2fsprogs-libs) echo $(grep "^e2fsprogs" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
libcap) echo $(grep "^libcap" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
util-linux-libs | util-linux-pass1) echo $(grep "^util-linux" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
xz-utils) echo $(grep "^xz" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
sqlite) echo $(grep "^sqlite" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
udev) echo $(grep "^systemd" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
xml-parser) echo $(grep "^XML" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
libdbus) echo $(grep "^dbus" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
*) echo $(grep "^$script_name[_-][[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
;;
esac
}
#----------------------------------#
get_package_version() { #
#----------------------------------#
# Those hacks may change depending on the invention of devs for tarball names.
# Normally, we expect -digit to signal the beginning of the version field
# but it may happen that there is no '-' (tcl, expect), that the version
# field is ddd-d (pkg-config-lite-028-1, since sed is greedy, it finds only
# the second dash) or that the first character of the version is not a digit
# (iputils-s20121221)...
case ${1} in
tcl*|expect*|tzdata*|xmlts*|unzip*|lynx*)
echo ${1} | sed -e 's@^[^[:digit:]]*@@' \
-e 's@\(-src\)*\.tar.*@@'
;;
iputils*) echo ${1} | sed -e 's@^.*-@@' \
-e 's@\.tar.*@@'
;;
LVM*) echo ${1} | sed -e 's@^[^.]*\.@@' \
-e 's@\.tgz.*@@'
;;
iproute*) echo ${1} | sed -e 's@^[^-]*-@@' \
-e 's@\.tar.*@@'
;;
pkg*|udev*|Singular*|XML*)
echo ${1} | sed -e 's@^.*[a-z]-\([[:digit:]]\)@\1@' \
-e 's@\.tar.*@@' \
-e 's@\.zip.*@@'
;;
*) echo ${1} | sed -e 's@^.*[-_]\([[:digit:]]\)@\1@' \
-e 's@\.tar.*@@' \
-e 's@\.zip.*@@'
;;
esac
}
#=======================
#==== TARGET HEADER ==== #==== TARGET HEADER ====
#----------------------------------# #----------------------------------#
@ -172,7 +76,7 @@ $i: $PREV
@\$(call echo_message, Building) @\$(call echo_message, Building)
${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID & ${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
@\$(PRT_DU) >>logs/\$@$version @ : > envars
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -193,7 +97,7 @@ $i: $PREV
@\$(call echo_message, Building) @\$(call echo_message, Building)
${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID & ${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
@\$(PRT_DU_CR) >>logs/\$@$version @ : > envars
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -206,8 +110,12 @@ EOF
#----------------------------------# #----------------------------------#
LUSER_wrt_unpack() { # Unpack and set 'ROOT' var LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
#----------------------------------# #----------------------------------#
local FILE=$1 local FILE="$1"
local optSAVE_PREVIOUS=$2 local optSAVE_PREVIOUS="$2"
local version
if [ "$3" != "" ]; then
version=-"$3"
fi
if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
( (
@ -219,6 +127,7 @@ EOF
( (
cat << EOF cat << EOF
@\$(PRT_DU) >>logs/\$@$version
@\$(call unpack,$FILE) @\$(call unpack,$FILE)
@\$(call get_pkg_root_LUSER) @\$(call get_pkg_root_LUSER)
EOF EOF
@ -230,6 +139,10 @@ CHROOT_Unpack() { #
#----------------------------------# #----------------------------------#
local FILE=$1 local FILE=$1
local optSAVE_PREVIOUS=$2 local optSAVE_PREVIOUS=$2
local version
if [ "$3" != "" ]; then
version=-"$3"
fi
if [ "${optSAVE_PREVIOUS}" != "1" ]; then if [ "${optSAVE_PREVIOUS}" != "1" ]; then
( (
@ -238,8 +151,10 @@ cat << EOF
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
fi fi
( (
cat << EOF cat << EOF
@\$(PRT_DU_CR) >>logs/\$@$version
@\$(call unpack2,$FILE) @\$(call unpack2,$FILE)
@\$(call get_pkg_root2) @\$(call get_pkg_root2)
EOF EOF
@ -298,20 +213,10 @@ wrt_RunAsRoot() { # Some scripts must be run as root..
fi fi
local file=$1 local file=$1
case ${PROGNAME} in
lfs ) MOUNT_ENV="LFS" ;;
clfs ) MOUNT_ENV="CLFS" ;;
clfs2 ) MOUNT_ENV="CLFS" ;;
clfs3 ) MOUNT_ENV="CLFS" ;;
hlfs ) MOUNT_ENV="HLFS" ;;
*) echo "undefined progname $PROGNAME"; exit 1 ;;
esac
( (
cat << EOF cat << EOF
@export ${MOUNT_ENV}=\$(MOUNT_PT) && \\ @export LFS=\$(MOUNT_PT) && \\
${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@$version 2>&1 && \\ $COMMANDS/`dirname $file`/\$@ >>logs/\$@$version 2>&1
\$(PRT_DU) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -328,8 +233,7 @@ LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log fil
( (
cat << EOF cat << EOF
@source ~/.bashrc && \\ @source ~/.bashrc && \\
\$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@$version 2>&1 && \\ \$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@$version 2>&1
\$(PRT_DU) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -345,8 +249,7 @@ CHROOT_wrt_RunAsRoot() { #
( (
cat << EOF cat << EOF
@source envars && \\ @source envars && \\
\$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@$version 2>&1 && \\ \$(crCMDSDIR)/`dirname $file`/\$@ >>\$(crLOGDIR)/\$@$version 2>&1
\$(PRT_DU_CR) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
@ -407,10 +310,9 @@ EOF
#----------------------------------# #----------------------------------#
LUSER_wrt_LogNewFiles() { # LUSER_wrt_LogNewFiles() { #
#----------------------------------# #----------------------------------#
local name=`echo ${1} | sed 's/[0-9]-//'`
( (
cat << EOF cat << EOF
@\$(call log_new_files_LUSER,$name) @\$(call log_new_files_LUSER,$1)
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -418,10 +320,9 @@ EOF
#----------------------------------# #----------------------------------#
CHROOT_wrt_LogNewFiles() { # CHROOT_wrt_LogNewFiles() { #
#----------------------------------# #----------------------------------#
local name=`echo ${1} | sed 's/[0-9]-//'`
( (
cat << EOF cat << EOF
@\$(call log_new_files,$name) @\$(call log_new_files,$1)
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }

View file

@ -1,6 +1,3 @@
# $Id$
BOLD = "" BOLD = ""
RED = "" RED = ""
GREEN = "" GREEN = ""
@ -34,21 +31,21 @@ define echo_SU_request
@echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)--------------------------------------------------------------------------------
@echo $(BLUE)$@ @echo $(BLUE)$@
@echo $(WHITE)ROOT privilege is required to perform a number of commands @echo $(WHITE)ROOT privilege is required to perform a number of commands
@echo sudo will request a password in order to execute all high privilege commands @echo sudo may request a password in order to execute all high privilege commands
endef endef
define echo_SULUSER_request define echo_SULUSER_request
@echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)--------------------------------------------------------------------------------
@echo $(BOLD)$(BLUE)$@ @echo $(BOLD)$(BLUE)$@
@echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF) @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
@echo sudo requires a password @echo sudo may require a password
endef endef
define echo_CHROOT_request define echo_CHROOT_request
@echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)--------------------------------------------------------------------------------
@echo $(BOLD)$(BLUE)$@ @echo $(BOLD)$(BLUE)$@
@echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF) @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT)
@echo a password is required @echo a password may be required
endef endef
define echo_message define echo_message
@ -115,6 +112,9 @@ define get_pkg_root2
echo "export PKG_DEST=$(SRC)/$@" >> envars; \ echo "export PKG_DEST=$(SRC)/$@" >> envars; \
echo "source packInstall.sh" >> envars; \ echo "source packInstall.sh" >> envars; \
echo "export -f packInstall" >> envars; \ echo "export -f packInstall" >> envars; \
if [ "$(WRAP_INSTALL)" = "y" ]; then \
echo "export -f wrapInstall" >> envars; \
fi; \
fi; fi;
endef endef
@ -182,7 +182,7 @@ define echo_report
echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \ echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
echo ; \ echo ; \
echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \ echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
echo file to $(BOLD)jhalfs-reports@linuxfromscratch.org$(WHITE) ; \ echo file to $(BOLD)alfs-discuss@lists.linuxfromscratch.org$(WHITE) ; \
echo ; \ echo ; \
echo That will help us to keep more accurate SBU and ; \ echo That will help us to keep more accurate SBU and ; \
echo disk usage values into the book. Thanks. ; \ echo disk usage values into the book. Thanks. ; \
@ -203,21 +203,15 @@ define echo_finished
@echo $(tab_)- Mount the virtual kernel file systems. @echo $(tab_)- Mount the virtual kernel file systems.
@echo @echo
@echo $(tab_)- Enter to the chroot using the command found @echo $(tab_)- Enter to the chroot using the command found
@echo $(tab_)in the section -Entering the Chroot Environment- @echo $(tab_)" in the section -Entering the Chroot Environment-"
@echo $(tab_)except if building CLFS with METHOD=boot. @echo $(tab_)" except if building with METHOD=boot."
@echo @echo
@echo $(tab_)- Set a password for the root user. @echo $(tab_)- Set a password for the root user.
@echo @echo
@echo $(tab_)- Edit or create /etc/fstab, @echo $(tab_)- Edit or create /etc/fstab and any other configuration file
@echo $(tab_) " /etc/hosts," @echo $(tab_)" required to suit your needs."
@echo $(tab_) " /etc/sysconfig/clock,"
@echo $(tab_) " /etc/sysconfig/console,"
@echo $(tab_) " /etc/sysconfig/network,"
@echo $(tab_) " /etc/sysconfig/ifconfig.eth0,"
@echo $(tab_) " /etc/resolv.conf"
@echo $(tab_)and any other configuration file required to suit your needs.
@echo @echo
@echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot. @echo $(tab_)- Set-up the boot loader.
@echo @echo
@echo $(tab_)You can set-up the new boot-loader installed on the new system @echo $(tab_)You can set-up the new boot-loader installed on the new system
@echo $(tab_)or the host bootloader. @echo $(tab_)or the host bootloader.

View file

@ -1,23 +1,20 @@
<?xml version='1.0' encoding='ISO-8859-1'?> <?xml version='1.0' encoding='ISO-8859-1'?>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
<xsl:output method="text"/> <xsl:output method="text"/>
<!-- The libc model used for HLFS --> <!-- Should we include a package manager? -->
<xsl:param name="model" select="glibc"/> <xsl:param name="pkgmngt" select="'n'"/>
<!-- The kernel series used for HLFS --> <!-- The system for LFS: sysv of systemd -->
<xsl:param name="kernel" select="2.6"/> <xsl:param name="revision" select="'sysv'"/>
<!-- Should we include a package manager -->
<xsl:param name="pkgmngt" select="n"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="//para"/> <xsl:apply-templates
select="//varlistentry[(@revision=$revision or not(@revision)) and
//para[contains(string(),'Download:')]"/>
<xsl:if test="$pkgmngt='y'"> <xsl:if test="$pkgmngt='y'">
<xsl:apply-templates <xsl:apply-templates
select="document('packageManager.xml')//sect1[@id='package']//para"/> select="document('packageManager.xml')//sect1[@id='package']//para"/>
@ -25,19 +22,13 @@
</xsl:template> </xsl:template>
<xsl:template match="para"> <xsl:template match="para">
<xsl:if test="contains(string(),'Download:') and
(ancestor::varlistentry[@condition=$model]
or not(ancestor::varlistentry[@condition])) and
(ancestor::varlistentry[@vendor=$kernel]
or not(ancestor::varlistentry[@vendor]))">
<xsl:call-template name="package_name"> <xsl:call-template name="package_name">
<xsl:with-param name="url" select="ulink/@url"/> <xsl:with-param name="url" select="ulink/@url"/>
</xsl:call-template> </xsl:call-template>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template name="package_name"> <xsl:template name="package_name">
<xsl:param name="url" select="foo"/> <xsl:param name="url" select="'foo'"/>
<xsl:variable name="sub-url" select="substring-after($url,'/')"/> <xsl:variable name="sub-url" select="substring-after($url,'/')"/>
<xsl:choose> <xsl:choose>
<xsl:when test="contains($sub-url,'/') and <xsl:when test="contains($sub-url,'/') and

View file

@ -1,5 +1,4 @@
# shellcheck shell=bash
# $Id$
set -e set -e
@ -15,11 +14,9 @@ declare -r ERASE_LINE=${CSI}$'2K'
declare -r FRAME_OPEN=${CSI}$'2G[' declare -r FRAME_OPEN=${CSI}$'2G['
declare -r FRAME_CLOSE=${CSI}$'63G]' declare -r FRAME_CLOSE=${CSI}$'63G]'
declare -r TS_POSITION=${CSI}$'65G' declare -r TS_POSITION=${CSI}$'65G'
declare -r LINE_WRAP_OFF=${CSI}$'?7l' declare -r RESET_LINE=${CURSOR_OFF}${ERASE_LINE}${FRAME_OPEN}${FRAME_CLOSE}
declare -r LINE_WRAP_ON=${CSI}$'?7h'
declare -a RESET_LINE=${CURSOR_OFF}${ERASE_LINE}${FRAME_OPEN}${FRAME_CLOSE}
declare -a GRAPHIC_STR="| / - \\ + " declare -r GRAPHIC_STR="| / - \\ + "
declare -i SEC=0 # Seconds accumulator declare -i SEC=0 # Seconds accumulator
declare -i PREV_SEC=0 declare -i PREV_SEC=0
@ -49,22 +46,22 @@ write_or_exit "${RESET_LINE}${TS_POSITION}0 min. 0 sec"
# loop forever.. # loop forever..
while true ; do while true ; do
# Loop through the animation string # Loop through the animation string
for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do
write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}" write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}"
$SLEEP .12 # This value MUST be less than .2 seconds. $SLEEP .12 # This value MUST be less than .2 seconds.
done done
# A BASH internal variable, the number of seconds the script # A BASH internal variable, the number of seconds the script
# has been running. modulo convert to 0-59 # has been running. modulo convert to 0-59
SEC=$(($SECONDS % 60)) SEC=$((SECONDS % 60))
# Detect rollover of the seconds. # Detect rollover of the seconds.
(( PREV_SEC > SEC )) && write_or_exit "${RESET_LINE}" (( PREV_SEC > SEC )) && write_or_exit "${RESET_LINE}"
PREV_SEC=$SEC PREV_SEC=$SEC
# Display the accumulated time. div minutes.. modulo seconds. # Display the accumulated time. div minutes.. modulo seconds.
write_or_exit "${TS_POSITION}$(($SECONDS / 60)) min. $SEC sec" write_or_exit "${TS_POSITION}$((SECONDS / 60)) min. $SEC sec"
done done
exit exit

36
common/run-in-cgroup.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
if [ -z "$CPUSPEC" ] || [ "$#" -lt 1 ]; then
echo "usage: CPUSPEC=... $0 command"
exit 1
fi
ARGS="$@"
set +e
if type systemd-run >/dev/null 2>&1 ; then # systemd
sudo systemd-run -G --pty -d --uid=$(whoami) \
-p AllowedCPUs="$CPUSPEC" \
--slice "user-$(whoami).slice" \
"$@"
elif type loginctl >/dev/null 2>&1 ; then #elogind
sudo mkdir /sys/fs/cgroup/jhalfs
sudo sh -c "echo +cpuset > /sys/fs/cgroup/cgroup.subtree_control"
(
sudo sh -c "echo $BASHPID > /sys/fs/cgroup/jhalfs/cgroup.procs"
sudo sh -c "
SESS_CGROUP=/sys/fs/cgroup/\$XDG_SESSION_ID
echo $CPUSPEC > \$SESS_CGROUP/cpuset.cpus
( echo \$BASHPID > \$SESS_CGROUP/cgroup.procs &&
exec sudo -u $(whoami) $ARGS )"
)
sudo rmdir /sys/fs/cgroup/jhalfs
else # no session manager
sudo mkdir /sys/fs/cgroup/jhalfs
sudo sh -c "echo +cpuset > /sys/fs/cgroup/cgroup.subtree_control"
sudo sh -c "echo \"$CPUSPEC\" > /sys/fs/cgroup/jhalfs/cpuset.cpus"
(sudo sh -c "echo $BASHPID > /sys/fs/cgroup/jhalfs/cgroup.procs" &&
exec "$@")
sudo rmdir /sys/fs/cgroup/jhalfs
fi

View file

@ -1,29 +1,19 @@
<?xml version='1.0' encoding='ISO-8859-1'?> <?xml version='1.0' encoding='ISO-8859-1'?>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
<xsl:output method="text"/> <xsl:output method="text"/>
<!-- The FTP server used as fallback -->
<xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
<!-- The book family (lfs or clfs). Needed to use the proper FTP path. -->
<xsl:param name="family">lfs</xsl:param>
<!-- The libc model used for HLFS -->
<xsl:param name="model" select="glibc"/>
<!-- The kernel series used for HLFS -->
<xsl:param name="kernel" select="2.6"/>
<!-- Do we use a package manager? --> <!-- Do we use a package manager? -->
<xsl:param name="pkgmngt" select="n"/> <xsl:param name="pkgmngt" select="'n'"/>
<!-- The system for LFS: sysv of systemd -->
<xsl:param name="revision" select="'sysv'"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="//ulink"/> <xsl:apply-templates select="//varlistentry[@revision=$revision
or not(@revision)]//ulink"/>
<xsl:if test="$pkgmngt='y'"> <xsl:if test="$pkgmngt='y'">
<xsl:apply-templates <xsl:apply-templates
select="document('packageManager.xml')//ulink"/> select="document('packageManager.xml')//ulink"/>
@ -34,11 +24,7 @@
<!-- If some package doesn't have the predefined strings in their <!-- If some package doesn't have the predefined strings in their
name, the next test must be fixed to match it also. Skip possible name, the next test must be fixed to match it also. Skip possible
duplicated URLs due that may be splitted for PDF output --> duplicated URLs due that may be splitted for PDF output -->
<xsl:if test="(ancestor::varlistentry[@condition=$model] <xsl:if test="(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
or not(ancestor::varlistentry[@condition])) and
(ancestor::varlistentry[@vendor=$kernel]
or not(ancestor::varlistentry[@vendor])) and
(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
contains(@url, '.tgz') or contains(@url, '.patch') or contains(@url, '.tgz') or contains(@url, '.patch') or
contains(@url, '.xz') or contains(@url, '.lzma')) and contains(@url, '.xz') or contains(@url, '.lzma')) and
not(ancestor-or-self::*/@condition = 'pdf')"> not(ancestor-or-self::*/@condition = 'pdf')">
@ -48,16 +34,6 @@
<xsl:with-param name="url" select="@url"/> <xsl:with-param name="url" select="@url"/>
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
<!-- Extract the directory for that package -->
<xsl:variable name="cut"
select="translate(substring-after($package, '-'),
'0123456789', '0000000000')"/>
<xsl:variable name="package2">
<xsl:value-of select="substring-before($package, '-')"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="$cut"/>
</xsl:variable>
<xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
<!-- Write the upstream URLs, fixing the redirected ones --> <!-- Write the upstream URLs, fixing the redirected ones -->
<xsl:choose> <xsl:choose>
<xsl:when test="contains(@url,'?')"> <xsl:when test="contains(@url,'?')">
@ -67,46 +43,6 @@
<xsl:value-of select="@url"/> <xsl:value-of select="@url"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:text> </xsl:text>
<!-- Write FTP mirror URLs -->
<xsl:value-of select="$server"/>
<xsl:text>/pub/</xsl:text>
<xsl:value-of select="$family"/>
<xsl:text>/conglomeration/</xsl:text>
<xsl:choose>
<!-- Fix some directories. Test against $dirname to be sure that we
are matching the start of a package name, not a string in a patch name
But some packages requires test against $package. -->
<xsl:when test="contains($dirname, 'bash')">
<xsl:text>bash/</xsl:text>
</xsl:when>
<xsl:when test="contains($package, 'dvhtool')">
<xsl:text>dvhtool/</xsl:text>
</xsl:when>
<xsl:when test="contains($dirname, 'gcc')">
<xsl:text>gcc/</xsl:text>
</xsl:when>
<xsl:when test="contains($dirname, 'glibc')">
<xsl:text>glibc/</xsl:text>
</xsl:when>
<xsl:when test="contains($package, 'powerpc-utils')">
<xsl:text>powerpc-utils/</xsl:text>
</xsl:when>
<xsl:when test="contains($package, 'tcl')">
<xsl:text>tcl/</xsl:text>
</xsl:when>
<xsl:when test="contains($package, 'uClibc')">
<xsl:text>uClibc/</xsl:text>
</xsl:when>
<xsl:when test="contains($dirname, 'udev')">
<xsl:text>udev/</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$dirname"/>
<xsl:text>/</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$package"/>
<!-- Write MD5SUM value --> <!-- Write MD5SUM value -->
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<xsl:value-of select="../following-sibling::para/literal"/> <xsl:value-of select="../following-sibling::para/literal"/>

159
configuration Normal file
View file

@ -0,0 +1,159 @@
# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)
#
# BOOK Settings
#
# BOOK_LFS is not set
BOOK_LFS_SYSD=y
# BOOK_BLFS is not set
INITSYS="systemd"
RUN_ME="./jhalfs run"
BRANCH=y
# WORKING_COPY is not set
COMMIT="trunk"
LFS_MULTILIB_NO=y
# LFS_MULTILIB_I686 is not set
# LFS_MULTILIB_X32 is not set
# LFS_MULTILIB_ALL is not set
MULTILIB="default"
BUILD_CHROOT=y
# BUILD_BOOT is not set
METHOD="chroot"
BLFS_TOOL=y
#
# blfs-tool dependencies
#
DEP_LIBXML=y
DEP_LIBXSLT=y
DEP_DBXML=y
DEP_LYNX=y
DEP_SUDO=y
DEP_WGET=y
# DEP_GPM is not set
DEP_GIT=y
# end of blfs-tool dependencies
BLFS_BRANCH=y
# BLFS_WORKING_COPY is not set
BLFS_COMMIT="trunk"
BLFS_ROOT="/blfs_root"
BLFS_XML="blfs-xml"
LFS_XML="lfs-xml"
# CUSTOM_TOOLS is not set
TRACKING_DIR="/var/lib/jhalfs/BLFS"
# end of BOOK Settings
#
# General Settings
#
LUSER="lfs"
LGROUP="lfs"
LHOME="/home"
BUILDDIR="/mnt/build_dir"
GETPKG=y
SRC_ARCHIVE="$SRC_ARCHIVE"
RETRYSRCDOWNLOAD=y
RETRYDOWNLOADCNT=20
DOWNLOADTIMEOUT=30
SERVER="http://ftp.osuosl.org"
RUNMAKE=y
CLEAN=y
# end of General Settings
#
# Build Settings
#
CONFIG_TESTS=y
#
# Test settings
#
# TST_1 is not set
TST_2=y
# end of Test settings
TEST=2
PKGMNGT=y
PKG_PACK=y
# LIB_LOAD is not set
INSTALL_LOG=y
STRIP=y
DEL_LA_FILES=y
# NO_PROGRESS_BAR is not set
# end of Build Settings
#
# System configuration
#
# HAVE_FSTAB is not set
CONFIG_BUILD_KERNEL=y
CONFIG="$(pwd)/mihari-dev-kernel-config"
NCURSES5=y
TIMEZONE="KST"
LANG="ko_KR.UTF-8"
FULL_LOCALE=y
PAGE_LETTER=y
# PAGE_A4 is not set
PAGE="letter"
HOSTNAME="mahiroOS-dev.local"
#
# Network configuration
#
INTERFACE="eth0"
IP_ADDR="10.0.2.9"
GATEWAY="10.0.2.2"
PREFIX="24"
BROADCAST="10.0.2.255"
DOMAIN="local"
DNS1="10.0.2.3"
DNS2="8.8.8.8"
# end of Network configuration
#
# Console configuration
#
FONT="lat0-16"
KEYMAP="us"
# LOCAL is not set
# end of Console configuration
# end of System configuration
#
# Advanced Features
#
REPORT=y
# SAVE_CH5 is not set
# COMPARE is not set
CONFIG_OPTIMIZE=y
#
# Parallelization and Optimization settings
#
N_PARALLEL=12
OPT_1=y
# OPT_2 is not set
# end of Parallelization and Optimization settings
OPTIMIZE=1
#
# Internal Settings (WARNING: for jhalfs developers only)
#
SCRIPT_ROOT="jhalfs"
JHALFSDIR="$BUILDDIR/$SCRIPT_ROOT"
LOGDIRBASE="logs"
LOGDIR="$JHALFSDIR/$LOGDIRBASE"
TESTLOGDIRBASE="test-logs"
TESTLOGDIR="$JHALFSDIR/$TESTLOGDIRBASE"
FILELOGDIRBASE="installed-files"
FILELOGDIR="$JHALFSDIR/$FILELOGDIRBASE"
ICALOGDIR="$LOGDIR/ICA"
MKFILE="$JHALFSDIR/Makefile"
XSL="lfs.xsl"
PKG_LST="unpacked"
# end of Internal Settings (WARNING: for jhalfs developers only)
# end of Advanced Features
# REBUILD_MAKEFILE is not set

159
configuration.old Normal file
View file

@ -0,0 +1,159 @@
# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)
#
# BOOK Settings
#
# BOOK_LFS is not set
BOOK_LFS_SYSD=y
# BOOK_BLFS is not set
INITSYS="systemd"
RUN_ME="./jhalfs run"
BRANCH=y
# WORKING_COPY is not set
COMMIT="trunk"
LFS_MULTILIB_NO=y
# LFS_MULTILIB_I686 is not set
# LFS_MULTILIB_X32 is not set
# LFS_MULTILIB_ALL is not set
MULTILIB="default"
BUILD_CHROOT=y
# BUILD_BOOT is not set
METHOD="chroot"
BLFS_TOOL=y
#
# blfs-tool dependencies
#
DEP_LIBXML=y
DEP_LIBXSLT=y
DEP_DBXML=y
DEP_LYNX=y
DEP_SUDO=y
DEP_WGET=y
# DEP_GPM is not set
DEP_GIT=y
# end of blfs-tool dependencies
BLFS_BRANCH=y
# BLFS_WORKING_COPY is not set
BLFS_COMMIT="trunk"
BLFS_ROOT="/blfs_root"
BLFS_XML="blfs-xml"
LFS_XML="lfs-xml"
# CUSTOM_TOOLS is not set
TRACKING_DIR="/var/lib/jhalfs/BLFS"
# end of BOOK Settings
#
# General Settings
#
LUSER="lfs"
LGROUP="lfs"
LHOME="/home"
BUILDDIR="/mnt/build_dir"
GETPKG=y
SRC_ARCHIVE="$SRC_ARCHIVE"
RETRYSRCDOWNLOAD=y
RETRYDOWNLOADCNT=20
DOWNLOADTIMEOUT=30
SERVER="http://ftp.osuosl.org"
RUNMAKE=y
CLEAN=y
# end of General Settings
#
# Build Settings
#
CONFIG_TESTS=y
#
# Test settings
#
# TST_1 is not set
TST_2=y
# end of Test settings
TEST=2
PKGMNGT=y
PKG_PACK=y
# LIB_LOAD is not set
INSTALL_LOG=y
STRIP=y
DEL_LA_FILES=y
# NO_PROGRESS_BAR is not set
# end of Build Settings
#
# System configuration
#
# HAVE_FSTAB is not set
CONFIG_BUILD_KERNEL=y
CONFIG="$(pwd)/mihari-dev-kernel-config"
NCURSES5=y
TIMEZONE="KST"
LANG="ko_KR.UTF-8"
FULL_LOCALE=y
PAGE_LETTER=y
# PAGE_A4 is not set
PAGE="letter"
HOSTNAME="mahiroOS-dev.local"
#
# Network configuration
#
INTERFACE="eth0"
IP_ADDR="10.0.2.9"
GATEWAY="10.0.2.2"
PREFIX="24"
BROADCAST="10.0.2.255"
DOMAIN="local"
DNS1="10.0.2.3"
DNS2="8.8.8.8"
# end of Network configuration
#
# Console configuration
#
FONT="lat0-16"
KEYMAP="us"
# LOCAL is not set
# end of Console configuration
# end of System configuration
#
# Advanced Features
#
REPORT=y
# SAVE_CH5 is not set
# COMPARE is not set
CONFIG_OPTIMIZE=y
#
# Parallelization and Optimization settings
#
N_PARALLEL=12
OPT_1=y
# OPT_2 is not set
# end of Parallelization and Optimization settings
OPTIMIZE=1
#
# Internal Settings (WARNING: for jhalfs developers only)
#
SCRIPT_ROOT="jhalfs"
JHALFSDIR="$BUILDDIR/$SCRIPT_ROOT"
LOGDIRBASE="logs"
LOGDIR="$JHALFSDIR/$LOGDIRBASE"
TESTLOGDIRBASE="test-logs"
TESTLOGDIR="$JHALFSDIR/$TESTLOGDIRBASE"
FILELOGDIRBASE="installed-files"
FILELOGDIR="$JHALFSDIR/$FILELOGDIRBASE"
ICALOGDIR="$LOGDIR/ICA"
MKFILE="$JHALFSDIR/Makefile"
XSL="lfs.xsl"
PKG_LST="unpacked"
# end of Internal Settings (WARNING: for jhalfs developers only)
# end of Advanced Features
# REBUILD_MAKEFILE is not set

View file

@ -0,0 +1,22 @@
PKG="libffi"
PKG_VERSION="3.2.1"
PKG_FILE="libffi-3.2.1.tar.gz"
URL="http://sourceware.org/pub/libffi/${PKG_FILE}"
MD5="83b89587607e3eb65c70d361f13bab43"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
sed -e '/^includesdir/ s/$(libdir).*$/$(includedir)/' \
-i include/Makefile.in &&
sed -e '/^includedir/ s/=.*$/=@includedir@/' \
-e 's/^Cflags: -I${includedir}/Cflags:/' \
-i libffi.pc.in &&
./configure --prefix=/usr --disable-static &&
make
make install
xEOFx
) > tmp

28
custom/examples/941-pcre Normal file
View file

@ -0,0 +1,28 @@
PKG="pcre"
PKG_VERSION="8.37"
PKG_FILE="pcre-8.37.tar.bz2"
URL="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PKG_FILE}"
MD5="ed91be292cb01d21bc7e526816c26981"
for i in PATCH{1..10}; do
unset $i
done
PATCH1="https://www.linuxfromscratch.org/patches/downloads/pcre/pcre-8.37-upstream_fixes-1.patch 718c4314fba52ed559c75ff7660cc391"
( cat << "xEOFx"
patch -Np1 -i ../pcre-8.37-upstream_fixes-1.patch &&
./configure --prefix=/usr \
--docdir=/usr/share/doc/pcre-8.37 \
--enable-unicode-properties \
--enable-pcre16 \
--enable-pcre32 \
--enable-pcregrep-libz \
--enable-pcregrep-libbz2 \
--enable-pcretest-libreadline \
--disable-static &&
make
make install &&
mv -v /usr/lib/libpcre.so.* /lib &&
ln -sfv ../../lib/$(readlink /usr/lib/libpcre.so) /usr/lib/libpcre.so
xEOFx
) > tmp

View file

@ -0,0 +1,22 @@
PKG="python3"
PKG_VERSION="3.4.3"
PKG_FILE="Python-3.4.3.tar.xz"
URL="https://www.python.org/ftp/python/3.4.3/${PKG_FILE}"
MD5="7d092d1bba6e17f0d9bd21b49e441dd5"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
CXX="/usr/bin/g++" \
./configure --prefix=/usr \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--without-ensurepip &&
make
make install &&
chmod -v 755 /usr/lib/libpython3.4m.so &&
chmod -v 755 /usr/lib/libpython3.so
xEOFx
) > tmp

View file

@ -1,22 +0,0 @@
#
# $Id$
#
PKG="bc"
PKG_VERSION="1.06"
PKG_FILE="bc-1.06.tar.gz"
URL="http://ftp.gnu.org/gnu/bc/${PKG_FILE}"
MD5="d44b5dddebd8a7a7309aea6c36fda117"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
sed -i '/PROTO.*readline/d' bc/scan.l &&
sed -i '/flex -I8/s/8//' configure &&
sed -i '/stdlib/a #include <string.h>' lib/number.c &&
sed -i 's/program.*save/static &/' bc/load.c &&
./configure --prefix=/usr --with-readline &&
make
make install
xEOFx
) > tmp

View file

@ -1,22 +1,15 @@
#
# $Id$
#
PKG="glib" PKG="glib"
PKG_VERSION="1.2.10" PKG_VERSION="2.44.1"
PKG_FILE="glib-1.2.10.tar.gz" PKG_FILE="glib-2.44.1.tar.xz"
URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}" URL="http://ftp.gnome.org/pub/gnome/sources/glib/2.44/${PKG_FILE}"
MD5="6fe30dad87c77b91b632def29dd69ef9" MD5="83efba4722a9674b97437d1d99af79db"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
( cat << "xEOFx" ( cat << "xEOFx"
patch -Np1 -i ../glib-1.2.10-gcc34-1.patch && ./configure --prefix=/usr --with-pcre=system &&
./configure --prefix=/usr &&
make make
make install && make install
chmod -v 755 /usr/lib/libgmodule-1.2.so.0.0.10
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -1,18 +1,19 @@
#
# $Id$
#
PKG="mc" PKG="mc"
PKG_VERSION="4.6.1" PKG_VERSION="4.8.14"
PKG_FILE="mc-4.6.1.tar.gz" PKG_FILE="mc-4.8.14.tar.xz"
URL="http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/${PKG_FILE}" URL="http://ftp.midnight-commander.org/${PKG_FILE}"
MD5="18b20db6e40480a53bac2870c56fc3c4" MD5="fbdaddb9edcf8925dcf3231331a8720b"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done
( cat << "xEOFx" ( cat << "xEOFx"
./configure --prefix=/usr && ./configure --prefix=/usr \
--sysconfdir=/etc \
--with-screen=ncurses \
--enable-charset &&
make make
make install make install
cp -v doc/keybind-migration.txt /usr/share/mc
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -1,16 +1,13 @@
#
# $Id$
#
# The PPP package contains the pppd daemon and the chat program. # The PPP package contains the pppd daemon and the chat program.
# This is used for connecting to other machines; often for connecting # This is used for connecting to other machines; often for connecting
# to the Internet via a dial-up or PPPoE connection to an ISP. # to the Internet via a dial-up or PPPoE connection to an ISP.
# #
PKG="ppp" PKG="ppp"
PKG_VERSION="2.4.4" PKG_VERSION="2.4.7"
PKG_FILE="ppp-${PKG_VERSION}.tar.gz" PKG_FILE="ppp-${PKG_VERSION}.tar.gz"
URL="http://samba.org/ftp/ppp/${PKG_FILE}" URL="http://samba.org/ftp/ppp/${PKG_FILE}"
MD5="183800762e266132218b204dfb428d29" MD5="78818f40e6d33a1d1de68a1551f6595a"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done

View file

@ -1,6 +1,3 @@
#
# $Id$
#
# The OpenSSL package contains management tools and libraries # The OpenSSL package contains management tools and libraries
# relating to cryptography. These are useful for providing # relating to cryptography. These are useful for providing
# cryptography functions to other packages, notably OpenSSH, # cryptography functions to other packages, notably OpenSSH,
@ -8,28 +5,30 @@
# #
PKG="openssl" PKG="openssl"
PKG_VERSION="0.9.8d" PKG_VERSION="1.0.2d"
PKG_FILE="openssl-${PKG_VERSION}.tar.gz" PKG_FILE="openssl-${PKG_VERSION}.tar.gz"
URL="ftp://ftp.openssl.org/source/${PKG_FILE}" URL="ftp://ftp.openssl.org/source/${PKG_FILE}"
MD5="8ed1853538e1d05a1f5ada61ebf8bffa" MD5="38dd619b2e77cbac69b99f52a053d25a"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/openssl-0.9.8d-fix_manpages-1.patch"
( cat << "xEOFx" ( cat << "xEOFx"
sed -i -e 's/mcpu/march/' config ./config --prefix=/usr \
patch -Np1 -i ../openssl-0.9.8d-fix_manpages-1.patch && --openssldir=/etc/ssl \
./config --openssldir=/etc/ssl --prefix=/usr shared && --libdir=lib \
make MANDIR=/usr/share/man shared \
zlib-dynamic &&
make
make MANDIR=/usr/share/man install && #sed -i 's# libcrypto.a##;s# libssl.a##' Makefile
cp -v -r certs /etc/ssl && make MANDIR=/usr/share/man MANSUFFIX=ssl install &&
install -v -d -m755 /usr/share/doc/openssl-0.9.8d && install -dv -m755 /usr/share/doc/openssl-1.0.2d &&
cp -v -r doc/{HOWTO,README,*.{txt,html,gif}} \ cp -vfr doc/* /usr/share/doc/openssl-1.0.2d
/usr/share/doc/openssl-0.9.8d
#
# Note: certificates not installed by this.
#
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -1,28 +1,34 @@
#
# $Id$
#
PKG="gpm" PKG="gpm"
PKG_VERSION="1.20.1" PKG_VERSION="1.20.7"
PKG_FILE="gpm-${PKG_VERSION}.tar.bz2" PKG_FILE="gpm-${PKG_VERSION}.tar.bz2"
URL="ftp://arcana.linux.it/pub/gpm/${PKG_FILE}" URL="https://anduin.linuxfromscratch.org/BLFS/gpm/${PKG_FILE}"
MD5="2c63e827d755527950d9d13fe3d87692" MD5="bf84143905a6a903dbd4d4b911a2a2b8"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch" PATCH1="https://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.7-consolidated-1.patch"
PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch"
( cat << "xEOFx" ( cat << "xEOFx"
patch -Np1 -i ../gpm-1.20.1-segfault-1.patch && patch -Np1 -i ../gpm-1.20.7-consolidated-1.patch &&
patch -Np1 -i ../gpm-1.20.1-silent-1.patch && ./autogen.sh &&
./configure --prefix=/usr --sysconfdir=/etc && ./configure --prefix=/usr --sysconfdir=/etc &&
LDFLAGS="-lm" make make
make install && make install &&
cp -v conf/gpm-root.conf /etc &&
ldconfig install-info --dir-file=/usr/share/info/dir \
/usr/share/info/gpm.info &&
rm -fv /usr/lib/libgpm.a &&
ln -sfv libgpm.so.2.1.0 /usr/lib/libgpm.so &&
install -v -m644 conf/gpm-root.conf /etc &&
install -v -m755 -d /usr/share/doc/gpm-1.20.7/support &&
install -v -m644 doc/support/* \
/usr/share/doc/gpm-1.20.7/support &&
install -v -m644 doc/{FAQ,HACK_GPM,README*} \
/usr/share/doc/gpm-1.20.7
# The normal cmd to install the boot script for gpm # The normal cmd to install the boot script for gpm
# --- PUT THIS CMD INSIDE 999-blfs_bootscripts # --- PUT THIS CMD INSIDE 999-blfs_bootscripts
@ -31,7 +37,7 @@ ldconfig
cat > /etc/sysconfig/mouse << "EOF" cat > /etc/sysconfig/mouse << "EOF"
# Begin /etc/sysconfig/mouse # Begin /etc/sysconfig/mouse
MDEVICE="/dev/psaux" MDEVICE="/dev/input/mice"
PROTOCOL="imps2" PROTOCOL="imps2"
GPMOPTS="" GPMOPTS=""

View file

@ -1,32 +1,32 @@
#
# $Id$
#
# Lynx is a text based web browser. # Lynx is a text based web browser.
# #
PKG="lynx" PKG="lynx"
PKG_VERSION="2.8.6" PKG_VERSION="2.8.8rel.2"
PKG_FILE="lynx${PKG_VERSION}.tar.bz2" PKG_FILE="lynx${PKG_VERSION}.tar.bz2"
URL="ftp://lynx.isc.org/lynx2.8.6/${PKG_FILE}" URL="ftp://lynx.isc.org/${PKG_FILE}"
MD5="dc80497b7dda6a28fd80404684d27548" MD5="b231c2aa34dfe7ca25681ef4e55ee7e8"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done
( cat << "xEOFx" ( cat << "xEOFx"
./configure --prefix=/usr \ ./configure --prefix=/usr \
--sysconfdir=/etc/lynx \ --sysconfdir=/etc/lynx \
--datadir=/usr/share/doc/lynx-2.8.6 \ --datadir=/usr/share/doc/lynx-2.8.8rel.2 \
--with-zlib \ --with-zlib \
--with-bzlib \ --with-bzlib \
--with-screen=ncursesw \ --with-screen=ncursesw \
--enable-locale-charset && --enable-locale-charset &&
make make
make install-full && make install-full &&
chgrp -v -R root /usr/share/doc/lynx-2.8.6/lynx_doc chgrp -v -R root /usr/share/doc/lynx-2.8.8rel.2/lynx_doc
sed -i 's/#\(LOCALE_CHARSET\):FALSE/\1:TRUE/' /etc/lynx/lynx.cfg
sed -i 's/#\(DEFAULT_EDITOR\):/\1:vi/' /etc/lynx/lynx.cfg
sed -i 's/#\(PERSISTENT_COOKIES\):FALSE/\1:TRUE/' /etc/lynx/lynx.cfg
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -0,0 +1,28 @@
# dhcpcd is an implementation of the DHCP client specified in RFC2131.
# This is useful for connecting your computer to a network which uses
# DHCP to assign network addresses.
#
PKG="dhcpcd"
PKG_VERSION="6.9.3"
PKG_FILE="dhcpcd-${PKG_VERSION}.tar.xz"
URL="http://roy.marples.name/downloads/dhcpcd/${PKG_FILE}"
MD5="8357d023c4687d27bc6ea7964236b2a6"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
./configure --libexecdir=/lib/dhcpcd \
--dbdir=/var/lib/dhcpcd &&
make
make install
# Add the following to boot scripts.
#make install-service-dhcpcd
# more configuration?
xEOFx
) > tmp

View file

@ -1,27 +0,0 @@
#
# $Id$
#
# dhcpcd is an implementation of the DHCP client specified in RFC2131.
# This is useful for connecting your computer to a network which uses
# DHCP to assign network addresses.
#
PKG="dhcpcd"
PKG_VERSION="2.0.8"
PKG_FILE="dhcpcd-${PKG_VERSION}.tar.bz2"
URL="ftp://ftp.osuosl.org/pub/gentoo/distfiles/${PKG_FILE}"
MD5="ec91c33b6d9cb46a42f9564e573fd249"
for i in PATCH{1..10}; do
unset $i
done
( cat << "xEOFx"
./configure --prefix="" --mandir=/usr/share/man &&
make
make install &&
chmod -v 754 /etc/dhcpc/dhcpcd.exe
xEOFx
) > tmp

View file

@ -1,25 +0,0 @@
#
# $Id$
#
# Program for ejecting removable media under software control.
# Can also control the auto-eject feature of some drives and
# can be used to switch CDs on an IDE/ATAPI CD changer.
#
PKG="eject"
PKG_VERSION="2.10"
PKG_FILE="eject-${PKG_VERSION}.tar.gz"
URL="ftp://sunsite.unc.edu/pub/Linux/utils/disk-management/${PKG_FILE}"
MD5="82e3a7a4d7e3323018c6938015ff25f7"
PATCH1=""
( cat << "xEOFx"
./configure --prefix=/usr \
--enable-default-device=/dev/cdrom \
--disable-nls
make
make install
xEOFx
) > tmp

View file

@ -1,33 +1,22 @@
#
# $Id$
# NASM (Netwide Assembler) is an 80x86 assembler designed # NASM (Netwide Assembler) is an 80x86 assembler designed
# for portability and modularity. It includes a # for portability and modularity. It includes a
# disassembler as well. # disassembler as well.
PKG="nasm" PKG="nasm"
PKG_VERSION="0.98.39" PKG_VERSION="2.11.08"
PKG_FILE="nasm-${PKG_VERSION}.tar.bz2" PKG_FILE="nasm-${PKG_VERSION}.tar.xz"
URL="http://downloads.sourceforge.net/nasm/${PKG_FILE}" URL="http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/${PKG_FILE}"
MD5="2032ad44c7359f7a9a166a40a633e772" MD5="0d461a085b088a14dd6628c53be1ce28"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/nasm-0.98.39-security_fix-1.patch"
( cat << "xEOFx" ( cat << "xEOFx"
patch -Np1 -i ../nasm-0.98.39-security_fix-1.patch &&
./configure --prefix=/usr && ./configure --prefix=/usr &&
make make
make -C rdoff/doc
make -C rdoff/doc html
make install && make install
make install_rdf &&
install -v -m644 rdoff/doc/rdoff.info /usr/share/info &&
install -v -m755 -d /usr/share/doc/nasm/html &&
install -v -m644 rdoff/doc/v1-v2.txt /usr/share/doc/nasm &&
cp -v -R rdoff/doc/rdoff /usr/share/doc/nasm/html
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -1,17 +1,14 @@
#
# $Id$
#
# SYSLINUX is a collection of boot loaders for the Linux # SYSLINUX is a collection of boot loaders for the Linux
# operating system which operates off Linux ext2/3 # operating system which operates off Linux ext2/3
# filesystems, MS-DOS FAT filesystems, network servers # filesystems, MS-DOS FAT filesystems, network servers
# using PXE firmware, or from CD-ROMs. The FAT # using PXE firmware, or from CD-ROMs. The FAT
# filesystem version can be installed from DOS, NT, or # filesystem version can be installed from DOS, NT, or
# Linux. # Linux.
# #
# It includes a sophisticated API for add-on "COM32" # It includes a sophisticated API for add-on "COM32"
# modules, including a significant subset of the # modules, including a significant subset of the
# standard C library. # standard C library.
# #
# It also includes MEMDISK, a tool to boot legacy # It also includes MEMDISK, a tool to boot legacy
# operating systems from nontraditional media like PXE # operating systems from nontraditional media like PXE
# or CD-ROM. # or CD-ROM.

View file

@ -1,11 +1,8 @@
#
# $Id$
#
PKG="blfs-bootscripts" PKG="blfs-bootscripts"
PKG_VERSION="20060910" PKG_VERSION="20150924"
PKG_FILE="blfs-bootscripts-${PKG_VERSION}.tar.bz2" PKG_FILE="blfs-bootscripts-${PKG_VERSION}.tar.bz2"
URL="http://www.linuxfromscratch.org/blfs/downloads/svn/${PKG_FILE}" URL="http://anduin.linuxfromscratch.org/sources/BLFS/conglomeration/blfs-bootscripts/${PKG_FILE}"
MD5="e1715c58dc694bf474c4468e6bade3ad" MD5="97a371743223ac3815bf491863a39c7d"
for i in PATCH{1..10}; do for i in PATCH{1..10}; do
unset $i unset $i
done done

View file

@ -1,49 +0,0 @@
#
# $Id$
#
# Code taken from CLFS-Embedded
# Chapter 12 Beyond CLFS Embedded
#
# Dropbear is a relatively small SSH 2 server and client.
# Dropbear has a small memory footprint suitable for memory-constrained
# environments, while still having the same features as OpenSSH. It
# does not depend on OpenSSL and it has a MIT style license. Optionally
# it can even be made smaller.
#
PKG="DROPBEAR"
PKG_VERSION="0.48.1"
PKG_FILE="${PKG}-${PKG_VERSION}.tar.gz"
URL="http://matt.ucc.asn.au/dropbear/releases/${PKG_FILE}"
MD5="ca8e53a766faec831882831364568421"
for i in PATCH{1..10}; do
unset $i
done
PATCH1="http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/dropbear-0.48.1-autotool-1.patch"
( cat << "xEOFx"
patch -Np1 -i ../dropbear-0.48.1-autotool-1.patch
cp Makefile.in{,.orig}
sed -e s/@LD@/@CC@/ Makefile.in.orig > Makefile.in
CC="${CC} ${BUILD}" ./configure --prefix=/usr --host=${CLFS_TARGET}
cp -v options.h options.h.backup
sed -e "s@/dev/random@/dev/urandom@" options.h.backup > options.h
make MULTI=1 PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
make MULTI=1 PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install DESTDIR=${CLFS}
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/sbin/dropbear
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dbclient
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dropbearkey
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dropbearconvert
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/scp
install -dv ${CLFS}/etc/ssh
xEOFx
) > tmp

View file

@ -1,42 +0,0 @@
#
# $Id$
#
# Code taken from CLFS-Embedded
# Chapter 12 Beyond CLFS Embedded
#
# iptables is the userspace command line program
# used to configure the Linux firewall.
#
PKG="iptables"
PKG_VERSION="1.3.7"
PKG_FILE="${PKG}-${PKG_VERSION}.tar.bz2"
URL=" http://www.netfilter.org/projects/iptables/files/iptables-1.3.7.tar.bz2"
MD5="077e886a9c90a11bb47f3d7a4fc4a689"
for i in PATCH{1..10}; do
unset $i
done
PATCH1="http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/iptables-1.3.7-do_multi-1.patch"
( cat << "xEOFx"
patch -Np1 -i ../iptables-1.3.7-do_multi-1.patch
make CC="${CC} ${BUILD}" \
COPT_FLAGS="-Os" \
LD=${LD} DO_MULTI=1 \
PREFIX=/usr \
KERNEL_DIR=${CLFS}/lib/modules/2.6.19.2/build \
LIBDIR=/lib \
BINDIR=/sbin
make CC="${CC} ${BUILD}" \
COPT_FLAGS="-Os" \
LD=${LD} DO_MULTI=1 \
PREFIX=/usr \
KERNEL_DIR=${CLFS}/lib/modules/2.6.19.2/build \
LIBDIR=/lib BINDIR=/sbin \
DESTDIR=${CLFS} install
xEOFx
) > tmp

View file

@ -1,6 +1,3 @@
#
# $Id$
#
# Any comments you wish to add # Any comments you wish to add
# #
@ -13,8 +10,16 @@ for i in PATCH{1..10}; do
unset $i unset $i
done done
PATCH1="" PATCH1=""
# Up to 10 patches can be added. The PATCH variable must be numbered
# even if there is only one. If the patch md5 checksum is known, add
# it after the name as in (quotes are required):
# PATCHx="patch-url md5"
( cat << "xEOFx" ( cat << "xEOFx"
# Your script here. Be aware that it is passed
# verbatim, and that none of the above variables
# will be defined when running the script. For example,
# If you want to use ${PKG_VERSION}, you have to
# redefine it here.
xEOFx xEOFx
) > tmp ) > tmp

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# $Id$
set -e set -e
: <<inline_doc : <<inline_doc

View file

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
# $Id$
# Acknowledgment: # Acknowledgment:
# The following code is a modified version of an original work written by # The following code is a modified version of an original work written by
@ -43,9 +42,9 @@ if [ ! -f "$CMP_DIR/icaprep" ]; then
# hackery to allow easy diffing. Essentially, replace each # hackery to allow easy diffing. Essentially, replace each
# archive with a dir of the same name and extract the object # archive with a dir of the same name and extract the object
# files from the archive into this dir. Despite their names, # files from the archive into this dir. Despite their names,
# libieee.a & libmcheck.a are not actual ar archives. # libm.a & libmcheck.a are not actual ar archives.
echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... " echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a') L=$(find $CMP_DIR -name '*.a' ! -name 'libm.a' ! -name 'libmcheck.a')
for F in $L; do for F in $L; do
mv $F ${F}.XX mv $F ${F}.XX
mkdir $F mkdir $F

View file

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
# $Id$
# Acknowledgment: # Acknowledgment:
# The following code is a modified version of an original work written by # The following code is a modified version of an original work written by

View file

@ -1,896 +0,0 @@
#!/bin/bash
# Acknowledgment:
# The following code is a no-modified version (except for this comment
# and the inline_doc fragment) of an original work written by
# Ken Moffat and is included here with his permission.
#
# FARCE: Farce Assists Rebuild Comparison Evaluation ;)
#
# to answer the question "can it rebuild itself?"
#
# We expect four arguments - first directory path, filelist
# containing the files in this directory which we wish to compare,
# second directory path, filelist for second directory.
#
# Yes, we could just compare everything in each tree, but the
# filelist script knows about files it can reasonably ignore,
# and this also allows us to build a sytem, boot it and get a
# list of files, build a full desktop environment, and only then
# build and boot the "can it build itself" test system and get
# _its_ filelist.
#
# What this script aims to do:
# ____________________________
#
# First, report files not in both builds.
#
# Then, confirm symlinks point to same targets.
#
# After that, compare individual files -
# if different, run the file name through 'expected'
# to pick out files that are unlikely to match (logs,
# pids, fstab [assumes '/' is a different device each time],
# count these as 'expected'.
#
# For whatever is left, check the file type - ar archives
# have their members extraced and compared (every member has
# a timestamp), gzipped files are compared beyond their
# timestamp, binaries, at least those using shared libs or
# which are shared objects, are copied and subjected to
# --strip-debug. If files match at this stage, count them as
# 'accepted'.
#
# As a last step for any file that doesn't match, copy it
# through some perl regexps to "process" it (convert any
# date, time, kernel-version information from standard formats
# into tokens, then see if the tokensi match.
#
# For details of the regexps, see the tokenize function.
# Those files that match after this are also counted as
# 'accepted'. Note that I don't always start from the kernel
# version that I'm going to build, so this copes with e.g. perl
# files that hardcode the kernel version.
#
# We now have files that don't match. A few of these seem to be
# common to all builds - some (members of) c++ libraries or ar
# archives, a few programs which perhaps use some sort of c++ code).
# The file name # is passed to the 'failure' function - these
# recognized filenames are labelled as 'predictable FAIL:',
# anything else is labelled as 'unexpected FAIL:'.
#
# output:
# stderr - files only in one of the builds, failure messages,
# and totals.
#
# farce-results - more details, including which files were treated
# as expected differences, files where neither copy could be read,
# files treated as accepted, with the reason (and member for ar
# archives). This data is typically up to 100 characters wide -
# sometimes it's a bit more, but it doesn't wrap too badly in a
# 100 character xterm.
#
# farce-extras - diffs for the files, or members, that didn't
# match. This file is to establish new regexps for picking up
# date/time/kernel-version formats.
#
# farce-identical - the names of the files which are identical
#
# farce-substitutions - whenever using tokenizeanddiff results in a
# difference being accepted, for both versions diff the before and
# after versions to show what got changed. If the file is a binary,
# the output may still be hard to read. Note that I _know_ glibc
# version strings pass one of the regexps looking for a kernel version
# - since I expect you to use the same version of glibc for each
# build, this is not a problem.
#
# farce-differ - the names of the files which could not be treated
# as matching (whether or not I regard the failure as predictable)
# for possible input to ICA processing.
#
# Copyright (C) 2005, 2006 Ken Moffat <ken@linuxfromscratch.org>
#
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
# NON INFRINGEMENT. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
: <<inline_doc
desc: do farce analisys and report
usage: farce -directory $FARCELOGDIR/dir path1 list1 path2 list2
input vars: $1 farce log dir for this comparation
$2 full path to previous iteration
$3 full path to filelist for previos iteration
$4 full path to current iteration
$5 full path to filelist for current iteration
externals: --
modifies: --
returns: --
on error:
on success:
inline_doc
VERSION="002"
# variables for output files
RESULT=farce-results
EXTRAS=farce-extras
IDENTICAL=farce-identical
SUBS=farce-substitutions
DIFFER=farce-differ
# documenting the variables
# C1, C2 temp files to hold disassembled code
# D1, D2 temp directories for extracting member of ar archive
# DIFF temp file for diffing the filelists
# F1, F2 temp files for tokenizeanddiff
# FTYPE obsolete, commented out
# M1, M2 temp files to hold members of an ar archive
# MEMBERS temp file to list members of ar archive
# OP1, OP2 the original $PWD, needed when extracting members of ar
# archives
# P1, P2 paths to first and second build
# S1, S2 temp files for shared objects
# functions
function dohelp() {
echo "`basename $0`: compare trees of files from a build"
echo "and lists of the files they contained"
echo ""
echo "`basename $0` [ -help | -version ] || path1 list1 path2 list2"
}
function emessage() {
# write a string to both stderr and $RESULT
echo "$@" >&2
echo "$@" >&5
}
function expected() {
# if we expect it to differ because of its name,
# allow it and report, return true ; else return false
case $1 in
/boot/grub/menu.lst)
# just in case somebody puts this into the main filesystem
true;;
/etc/aliases.db)
# some sort of database for postfix, not parsable
true;;
/etc/blkid.tab)
# includes dev name for rootfs
true;;
/etc/fstab)
# fstab, e.g. ' / ' will differ
true;;
/etc/group*)
true;;
/etc/hosts)
# with dhcp client, I add current ip address to this in a hook
true;;
/etc/ld.so.*)
# .conf and .cache can vary,
# particularly if one system has a full build when I run this
true;;
/etc/lilo.conf|/etc/yaboot.conf)
# bootloader control, I assume grub will all be on a separate
true;;
/etc/mtab)
# at a minimum, different '/'
true;;
/etc/ntp.drift)
true;;
/etc/passwd*)
true;;
/etc/shadow*)
true;;
/etc/ssh/*key|/etc/ssh/*pub)
# openssh keys
true;;
/misc/*)
# where I put buildscripts (which mostly won't change)
# and stamps containing name/time/space which will differ in the times
true;;
/root/*)
# expect .bash_history etc to differ - if we can read them
true;;
/usr/bin/lynx)
# part of my inital builds, I guess this uses anonymous namespaces
true;;
/usr/include/c++/*/*/bits/stdc++.h.gch/*)
# precompiled headers
true;;
/usr/lib*/libstdc++.a|/usr/lib*/libstdc++.so*|/usr/lib*/libsupc++.a)
# probably, anonymous namespaces
# libstdc++.a, libstdc++.so.n.n.n, libsupc++.a
true;;
/usr/share/info/dir)
# if one system has had extra stuff built, this will likely be bigger
true;;
/usr/share/man/whatis)
# if one system has had extra stuff built, this will likely be bigger
true;;
/var/lib/locate/locatedb)
# if one system has had extra stuff built, this will likely be bigger
true;;
/var/lib/nfs/*)
# allow nfs bookkeeping
true;;
/var/log/*)
true;;
/var/run/utmp)
true;;
/var/spool/fcron*)
true;;
/var/state/*)
# allow dhcp leases
true;;
/var/tmp/random-seed)
true;;
# following start with wildcards
*Image*|*.PPCBoot*|*vmlinuz*|*lfskernel*)
# compressed kernels, sometimes just building at a different
# date/time is enough to change the length of them, because the
# long format date and time is part of the compressed data
true;;
*pid*)
# pids, including e.g. /var/spool/postfix/pid/*
true;;
*)
# nothing else is expected to be different
false;;
esac
if [ $? -eq 0 ]; then
message "expected difference in $1"
let expected=$expected+1
case $TYPE in
AR)
let EXPAR=$EXPAR+1
;;
ELF)
let EXPELF=$EXPELF+1
;;
UNK)
let EXPUNK=$EXPUNK+1
;;
# so far, no other valid types, so don't accumulate them
*)
emessage "internal error, expected difference for $1 of type $TYPE not allowed"
exit 2
;;
esac
true
else
false
fi
}
function failure() {
# first parm is filename or token
# second parm is the error message
# update the appropriate total
# and write to both stderr and the results
# by using emessage
let different=$different+1
case $TYPE in
AR)
let DIFAR=$DIFAR+1
;;
ELF)
let DIFELF=$DIFELF+1
;;
GZ)
let DIFGZ=$DIFGZ+1
;;
SYM)
let DIFSYM=$DIFSYM+1
;;
UNK)
let DIFUNK=$DIFUNK+1
;;
*)
emessage "internal error in failure() for TYPE $TYPE"
exit 2
;;
esac
test -f ${P1}$1 && echo $1 >&9
emessage "FAIL: $2"
}
function fatal() {
# unrecoverable error
echo $*
exit 1
}
function filetype() {
TYPE=`file ${P1}${FILE}`
case $TYPE in
*'current ar archive'*)
let TOTAR=$TOTAR+1
TYPE=AR
;;
*' ELF '*)
let TOTELF=$TOTELF+1
TYPE=ELF
;;
*'gzip compressed data'*)
let TOTGZ=$TOTGZ+1
TYPE=GZ
;;
*)
let TOTUNK=$TOTUNK+1
TYPE=UNK
;;
esac
}
function message() {
# write a string to $RESULT
echo $* >&5
}
function onlyone() {
#report files only in one build
# text should go to both stderr and the results,
# but blank lines only go to the results
if [ $1 == '<' ]; then
emessage "File(s) only in the first build"
else
emessage "File(s) only in the second build"
fi
message ""
FILES=`cat $DIFF | grep "^$1" | cut -d ' ' -f 2`
for F in $FILES; do
emessage $F
let only=$only+1
done
message ""
}
# 'test' functions are called with three arguments:
# the two pathes and the filename
# - we know the file is of this type, so see if we
# can get it to match by reasonalbe means.
# if not, treat it as different.
#
# NB if pathes are absolute, we need to prefix them
# with the original $PWD to access the .a files
#
function testar() {
# ar archives include timestamps for the members,
# but diff doesn't show file timestamps unless the data differs
# put out a message to help locate which archive any messages
# about the members refer to.
# try just stripping them U1,2 undebuggable
U1=`mktemp` || fatal "cannot create a temporary file"
U2=`mktemp` || fatal "cannot create a temporary file"
cp ${1}${3} $U1
cp ${2}${3} $U2
strip --strip-debug $U1
strip --strip-debug $U2
cmp -s $U1 $U2
rm $U1 $U2
if [ $? -eq 0 ]; then
let accepted=$accepted+1
let ACCAR=$ACCAR+1
message "archive $3 matches after strip --strip-debug"
return
fi
# rest of this function retained primarily for pathologically bad builds
# put out a message in the log to help identify which archive has issues.
message "examining ar archive $3"
D1=`mktemp -d` || fatal "cannot create a temporary directory"
D2=`mktemp -d` || fatal "cannot create a temporary directory"
cd $D1
ar -x ${OP1}${1}${3}
cd $D2
ar -x ${OP2}${2}${3}
cd
# diff the members - true means they match
diff -Na $D1 $D2 >/dev/null
if [ $? -eq 0 ]; then
message "accept: $3 after diffing the members"
let accepted=$accepted+1
let ACCAR=$ACCAR+1
else
# process individual members to eliminate date/time/kernel-version
# first, check the members are the same
M1=`mktemp` || fatal "cannot create a temporary file"
M2=`mktemp` || fatal "cannot create a temporary file"
cd $D1
MEMBERS=
for F in *; do
MEMBERS="$MEMBERS $F"
done
cd
echo $MEMBERS | sort >$M1
cd $D2
MEMBERS=
for F in *; do
MEMBERS="$MEMBERS $F"
done
cd
echo $MEMBERS | sort >$M2
cmp -s $M1 $M2
if [ $? -ne 0 ]; then
# oh dear, different members
echo "list of members differs for archive $3" >&6
diff $M1 $M2 >&6
failure $3 "$3 list of members differs"
else
# members (names) are same,
# process each one
STATUS=0
for M in $MEMBERS; do
#avoid firing up perl on matching members
cmp -s $D1/$M $D2/$M
if [ $? -ne 0 ]; then
tokenizeanddiff $D1/$M $D2/$M $FILE:$M
if [ $? -eq 0 ]; then
message "member $M matches after processing"
else
message "member $M DIFFERS after processing"
STATUS=1
fi
fi
done
if [ $STATUS -eq 0 ]; then
let accepted=$accepted+1
let ACCAR=$ACCAR+1
else
let different=$different+1
let DIFAR=$DIFAR+1
echo $3 >&9
emessage "FAIL: in $3"
fi
fi
rm $M1 $M2
fi
rm -rf $D1 $D2
}
function testgzip() {
# bytes 4,5,6,7 are the timestamp, so ignore these
cmp -s -i 8 ${1}${3} ${2}${3}
if [ $? -eq 0 ]; then
message "accept: $3 after ignoring gzip timestamp"
let accepted=$accepted+1
let ACCGZ=$ACCGZ+1
else
failure $3 " $3 even after ignoring gzip timestamp"
fi
}
function testso() {
# shared object - first try stripping it
# in fact, this now handles ALL ELF files
S1=`mktemp` || fatal "cannot create a temporary file"
S2=`mktemp` || fatal "cannot create a temporary file"
cp ${1}${3} $S1
strip --strip-debug $S1
cp ${2}${3} $S2
strip --strip-debug $S2
cmp -s $S1 $S2
if [ $? -eq 0 ]; then
message "accept: $3 after --strip-debug"
let accepted=$accepted+1
let ACCELF=$ACCELF+1
else
tokenizeanddiff $S1 $S2 $3
if [ $? -ne 0 ]; then
failure $3 " $3 differs after stripping and processing"
else
message "accept: $3 after --strip-debug and processing"
let accepted=$accepted+1
let ACCELF=$ACCELF+1
fi
fi
rm $S1 $S2
}
function tokenize() {
# use regexes to replace date/time/kernel-version text
# with tokens which may allow files to match even though
# they have hardcoded date/time/kernel-version.
# arguments are file to process, and where to put it.
# these regexes are somewhat long, and the order they
# are applied in is important (to stop short ones being
# used when a longer version would match).
# KV00 linux version date (e.g. as in the kernel itself)
# allow 2 or 3 groups of three alphas here - optional smp, with day, mon
# KV01 kernel version, including possible cpu details (that is for cdda2wav)
# KV02 just the version, in quotes e.g. "2.6.12.6" or '2.6.13', for perl stuff
# except that "|' gives me grif, so try a boundary
# also, it might need local version on the end, I really want
# quote2.\d+.\d+.{0,32}quote - it is the quotes that don't work.
# DT00 Day Mon .d+ hh:mm:ss TZN CCYY variations include non-caps and 'mon d'
# DT01 Mon .d+ CCYY hh:mm:ss
# DT02 hh:mm:ss Mon .d CCYY
# DT03 Mon .d CCYY
# DT04 Day Mon { ,d}d hh:mm:ss CCYY - for groff example postscript files
# (somewhat similar to DT00, but ' d' or ' dd' for day of month and no TZN )
# DT05 hh:mm:ss
# DT06 ISO date using space as separator
# DT07 ISO date using dash as separator
# DT08 ISO date using slash as separator
# DT09 fullmonth (capitalised), day number, comma, 4-digit year (groff 1.18.1 ps)
# DT10 dd, fullmonth (capitalised), 4-digit year (groff 1.18.1 manpages)
# DT11 '(xample comma space digit(s) backslash ) in groff memef.ps which is
# quite clearly the day of the month when it was compiled, preceded by 'example'
# with something weird between the e and the x.
if [ $# -ne 2 ]; then
fatal "tokenizing called with $# arguments : $*"
fi
cat $1 | perl -p \
-e 's/(L|l)inux.*\d\.\d\.\d+.* \#\d+( [A-Za-z][a-z]{2}){2,3} \d+ \d\d:\d\d:\d\d [A-Za-z]{3} \d{4}\b/%KV00%/g;' \
-e 's/(L|l)inux( (\w|_)+)?(-| |_)\d\.\d(\.\d+){1,2}((-|_)?(\w|_)+)?( |\000)*/%KV01%/g;' \
-e 's/\W2(\.\d+){2,3}(-|_)?((\w|_)+)?\s*\W/%KV02%/g;' \
-e 's/\b([A-Za-z][a-z]{2} ){2}( |\d)?\d \d\d:\d\d:\d\d [A-Za-z]{3} \d{4}\b/%DT00%/g;' \
-e 's/\b[A-Z][a-z]{2} ( |\d)\d \d{4} \d\d:\d\d:\d\d\b/%DT01%/g;' \
-e 's/\b\d\d:\d\d:\d\d [A-Z][a-z]{2} ( |\d)\d \d{4}\b/%DT02%/g;' \
-e 's/\b[A-Z][a-z]{2} ( |\d)\d \d{4}\b/%DT03%/g;' \
-e 's/\b([A-Z][a-z]{2} ){2}( |\d)\d \d\d:\d\d:\d\d \d{4}/%DT04%/g;' \
-e 's/\b\d\d:\d\d:\d\d\b/%DT05%/g;' \
-e 's/\b\d{4} \d\d \d\d\b/%DT06%/g;' \
-e 's/\b\d{4}-\d\d-\d\d\b/%DT07%/g;' \
-e 's/\b\d{4}\/\d\d\/\d\d\b/%DT08%/g;' \
-e 's/\b[A-Z][a-z]{2,} \d{1,2}, \d{4}/%DT09%/g;' \
-e 's/\b\d\d [A-Z][a-z]{2,} \d{4}/%DT10%/g;' \
-e 's/\(xample, \d{1,2}\\\)/%DT11%/g;' \
>$2
}
function tokenizeanddiff() {
# Call tokenize for the inputs, then compare the results
# Input arguments are path/filename for old and new versions
# third parm is readable name (filename, or archivename:member)
# to help understand what is in the extras output.
# - sometimes called for files, but other times called for
# members of ar archives extracted into temporary directories
#message tokenizeanddiff called for $1 $2 $3
F1=`mktemp` || fatal "cannot create a temporary file"
F2=`mktemp` || fatal "cannot create a temporary file"
tokenize $1 $F1
tokenize $2 $F2
# actually, cmp is probably more efficient
# but for picking up the pieces it will be better to
# use diff to see what got through.
cmp -s $F1 $F2
TOKENRESULT=$?
if [ $TOKENRESULT -ne 0 ]; then
echo "failure in $3..." >&6
diff -a $F1 $F2 >&6
rm $F1 $F2
false
else
# show what we did
echo "substitutions for $3" >&8
echo "build one" >&8
diff -a $1 $F1 >&8
echo "build two" >&8
diff -a $2 $F2 >&8
rm $F1 $F2
true
fi
}
function validateargs() {
# validate the arguments
BAD=0
if ! [ -d $1 ]; then
echo "Error: first argument is not a directory" >&2
let BAD=$BAD+1
fi
NAME=`basename ${2%%-*}`
if [ $NAME != filelist ]; then
echo "Error: second argument is not a recognized filelist" >&2
let BAD=$BAD+1
fi
if ! [ -d $3 ]; then
echo "Error: third argument is not a directory" >&2
let BAD=$BAD+1
fi
NAME=`basename ${4%%-*}`
if [ $NAME != filelist ]; then
echo "Error: fourth argument is not a recognized filelist" >&2
let BAD=$BAD+1
fi
for I in $1 $2 $3 $4; do
if ! [ -r $I ]; then
echo "Error: cannot read $I" >&2
let BAD=$BAD+1
fi
done
if [ $1 == $3 ]; then
echo "Error: directory pathes are identical" >&2
let BAD=$BAD+1
fi
if [ $2 == $4 ]; then
echo "Error: filelist names are identical" >&2
let BAD=$BAD+1
fi
if [ $BAD -eq 0 ]; then
ARGS=valid
fi
}
# Mainline
ARGS=unproven
OUTDIR=
if [ $# -eq 1 ]; then
case $1 in
-version|--version)
echo "`basename $0` version $VERSION"
exit 0
;;
-help|--help)
dohelp
exit 0
;;
esac
fi
if [ $1 = "--directory" ]; then
OUTDIR=$2
shift 2
grep '/$' $OUTDIR >/dev/null 2>&1 || OUTDIR=`echo $OUTDIR | sed 's%$%/%'`
echo "creating directory $OUTDIR"
mkdir -p $OUTDIR
if [ $? -ne 0 ]; then
echo "cannot mkdir $OUTDIR"
exit 1
fi
fi
if [ $# -eq 4 ]; then
validateargs $*
fi
if ! [ $ARGS == valid ]; then
dohelp
fatal "`basename $0`: error in arguments"
fi
# ok, we're happy, lets hit these files
exec 5>${OUTDIR}$RESULT
exec 6>${OUTDIR}$EXTRAS
exec 7>${OUTDIR}$IDENTICAL
exec 8>${OUTDIR}$SUBS
exec 9>${OUTDIR}$DIFFER
>${OUTDIR}$RESULT
if [ $? -ne 0 ]; then
fatal "cannot write to ${OUTDIR}$RESULT"
fi
emessage "will compare:"
emessage " first build at $1 with files listed in $2"
emessage "second build at $3 with files listed in $4"
let accepted=0
let different=0
let expected=0
let matched=0
let only=0
let predictable=0
let unreadable=0
let total=0
# break down the accepted
let ACCAR=0
let ACCELF=0
let ACCGZ=0
let ACCUNK=0
# break down definitely different
let DIFAR=0
let DIFELF=0
let DIFGZ=0
let DIFSYM=0
let DIFUNK=0
# break down the expected differences
let EXPAR=0
let EXPELF=0
let EXPGZ=0
let EXPUNK=0
# break down the identical files
let MATAR=0
let MATELF=0
let MATGZ=0
let MATSYM=0
let MATUNK=0
# break down how many of each type
let TOTAR=0
let TOTELF=0
let TOTGZ=0
let TOTSYM=0
let TOTUNK=0
# now identify differences between the two trees
DIFF=`mktemp` || fatal "cannot create a temporary file"
diff $2 $4 >$DIFF
for RUN in '<' '>' ; do
grep -q "$RUN" $DIFF && onlyone "$RUN"
done
rm $DIFF
# and compare them
message "Results of file comparison:"
message ""
# Strip any trailing slash from the path for tidyness,
# because the filenames all start with a slash. Unfortunately,
# unfortunately, '/' becomes empty, which breaks subroutines,
# so special case it.
# also, to process ar archives we need to extract them in temp
# directories - that means that after cd'ing we've broken any
# relative path, so save original pwd as necessary.
P1=`echo $1 | sed 's%/$%%'`
echo $1 | grep '^/' >/dev/null
if [ $? -ne 0 ]; then
# relative path
OP1=${PWD}/
#echo "setting OP1 to $OP1"
else
OP1=
#echo "$1 is an absolute path"
fi
test -z "$P1" && P1='/'
P2=`echo $3 | sed 's%/$%%'`
echo $3 | grep '^/' >/dev/null
if [ $? -ne 0 ]; then
# relative path
OP2=${PWD}/
#echo "setting OP2 to $OP2"
else
OP2=
#echo "$3 is an absolute path"
fi
test -z "$P2" && P2='/'
echo "about to read $2"
while read FILE ; do
#echo "process $FILE"
#echo "test existence of ${P2}${FILE}"
# confirm it exists in second build
# we have already reported files only in one build
if [ -f ${P2}"${FILE}" ]; then
let total=$total+1
# check we can read both of them
# or count as unreadable - I used to separate only-one-unreadable,
# but if you compre '/' and a _copy_ of /mnt/lfs that assumption
# breaks, so be less picky.
if ! [ -r "${P1}${FILE}" ] || ! [ -r "${P2}${FILE}" ]; then
message "cannot read one or both versions of $FILE"
let unreadable=$unreadable+1
continue
fi
if [ -h "${P1}${FILE}" ]; then
# for symlink, look at what it points to
# exceptionally, do not call filetype
TYPE=SYM
let TOTSYM=$TOTSYM+1
SL1=`ls -l "${P1}${FILE}" | awk '{ print $11 }'`
SL2=`ls -l "${P2}${FILE}" | awk '{ print $11 }'`
if [ "$SL1" = "$SL2" ]; then
echo "symlink $FILE matches for $SL1" >&5
let matched=$matched+1
let MATSYM=$MATSYM+1
else
failure TARGET " symlink $FILE points to $SL1 and $SL2"
echo $FILE >&9
fi
else
# regular file, start by typing it for accounting,
# then compare it
filetype ${P1}${FILE}
cmp -s "${P1}${FILE}" "${P2}${FILE}"
if [ $? -eq 0 ]; then
let matched=$matched+1
case $TYPE in
AR)
let MATAR=$MATAR+1
;;
ELF)
let MATELF=$MATELF+1
;;
GZ)
let MATGZ=$MATGZ+1
;;
UNK)
let MATUNK=$MATUNK+1
;;
*)
echo "unexpected TYPE of $TYPE for $FILE" >&2
exit 2
;;
esac
echo ${FILE} >&7
else
# seems different, can we do better ?
# test if we expect it to differ
expected $FILE
if [ $? -ne 0 ]; then
case $TYPE in
GZ)
testgzip $P1 $P2 $FILE ;;
AR)
testar $P1 $P2 $FILE ;;
ELF)
testso $P1 $P2 $FILE ;;
*)
# long-stop - strip dates from text files
tokenizeanddiff "${P1}${FILE}" "${P2}${FILE}" "$FILE"
if [ $? -eq 0 ]; then
message "accepted $FILE after processing"
let accepted=$accepted+1
let ACCUNK=$ACCUNK+1
else
failure "$FILE" " $FILE is different"
fi
;;
esac
fi
fi
fi
fi
done < $2
message ""
# write totals to stderr as well as the results file
emessage "$only files in only one of the builds"
emessage "$total files compared, of which"
emessage "$unreadable files could not be read, skipped"
emessage "$matched files are identical"
emessage "$expected files differed as expected"
emessage "$accepted files had allowable differences"
#emessage "$predictable files differed as they normally do"
emessage "$different files differed"
# totals of different file types
emessage ""
emessage "$TOTAR ar archives"
emessage " of which $MATAR are identical"
emessage " of which $ACCAR are accepted after strip-debug or extracting, diffing, tokenizing"
emessage " of which $EXPAR differed as expected"
emessage " of which $DIFAR differed"
emessage "$TOTELF ELF executables or shared libraries"
emessage " of which $MATELF are identical"
emessage " of which $ACCELF are accepted after stripping and tokenizing"
emessage " of which $EXPELF differed as expected"
emessage " of which $DIFELF differed"
emessage "$TOTGZ gzipped files"
emessage " of which $MATGZ are identical"
emessage " of which $ACCGZ are accepted after comparing beyond timestamp"
emessage " of which $DIFGZ are different"
emessage "$TOTSYM symbolic links"
emessage " of which $MATSYM are identical"
emessage " of which $DIFSYM have different targets"
emessage "$TOTUNK other files"
emessage " of which $MATUNK are identical"
emessage " of which $ACCUNK are accepted after tokenizing"
emessage " of which $EXPUNK differed as expected"
emessage " of which $DIFUNK differed"

View file

@ -1,60 +0,0 @@
#!/bin/bash
#$Id$
# Acknowledgment:
# The following code is a modified version of an original work written by
# Ken Moffat for their "farce" project and is included here with his
# permission.
#
set -e
: <<inline_doc
desc: creates farce file lists
usage: filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist
input vars: $1 directory where files from current iteration are stored
$2 name of the file list to be created
externals: --
modifies: --
returns: --
on error:
on success:
inline_doc
if [ $# -eq 2 ]; then
OUTFILE=$2
if [ -e $2 ]; then
echo -e "\nOutput $2 already exists\n"
exit
fi
else
echo -e "\nMissing argument\n"
exit 2
fi
if [ "$1" == "/" ]; then
LOC=$1
else
# ensure the path or mountpoint ends with a slash
# because of the seds after the 'find'
LOC=`echo $1 | sed 's%[^/]$%&/%'`
fi
echo -en "\nCreating file list for farce amalysis in $OUTFILE ..."
if [ -f $OUTFILE ]; then
echo "refusing to overwrite $OUTFILE"
exit 1
fi
# check we can indeed do this
>$OUTFILE
if [ $? -ne 0 ]; then
echo "error, cannot write to $OUTFILE"
exit 1
fi
find $LOC -xdev -xtype f | sed "s%^${LOC}%/%" | sort >$OUTFILE
echo -e "done.\n"
exit

View file

@ -1,23 +1,29 @@
#!/bin/bash #!/bin/bash
# $Id$
set -e set -e
: << inline_doc : << inline_doc
Installs a set-up to build BLFS packages. Installs a set-up to build BLFS packages.
You can set these variables: You can set these variables:
TRACKING_DIR : where the installed package file is kept. TRACKING_DIR : where the installed package file is kept.
(default /var/lib/jhalfs/BLFS) (default /var/lib/jhalfs/BLFS)
INITSYS : which books do you want? 'sysv' or 'systemd' (default sysv)
BLFS_ROOT : where the installed tools will be installed, relative to $HOME. BLFS_ROOT : where the installed tools will be installed, relative to $HOME.
Must start with a '/' (default /blfs_root) Must start with a '/' (default /blfs_root)
BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag) BLFS_COMMIT : any commit (branch/tag/sha)
(default development) (default trunk)
LFS_COMMIT : any commit (branch/tag/sha)
(default trunk)
Examples: Examples:
1 - If you plan to use the tools to build BLFS on top of LFS, but you did not 1 - If you plan to use the tools to build BLFS on top of LFS, but you did not
use jhalfs, or forgot to include the jhalfs-blfs tools: use jhalfs, or forgot to include the jhalfs-blfs tools:
(as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs (as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs
(as user) ./install-blfs-tools.sh (as user) INITSYS=<your system> ./install-blfs-tools.sh
2 - To install with only user privileges: 2 - To install with only user privileges (default to sysv):
TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh
This script can also be called automatically after running make in this
directory. The parameters will then be taken from the configuration file.
inline_doc inline_doc
@ -44,66 +50,105 @@ declare -r nl_=$'\n'
declare -r DD_BORDER="${BOLD}==============================================================================${OFF}" declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}" declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}" declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
declare -r dotSTR=".................." # Format display of parameters and versions
# bold yellow > < pair # bold yellow > < pair
declare -r R_arrow=$'\e[1;33m>\e[0m' declare -r R_arrow=$'\e[1;33m>\e[0m'
declare -r L_arrow=$'\e[1;33m<\e[0m' declare -r L_arrow=$'\e[1;33m<\e[0m'
VERBOSITY=1 VERBOSITY=1
# Take parameters from "configuration" if $1="auto"
if [ "$1" = auto ]; then
[[ $VERBOSITY > 0 ]] && echo -n "Loading configuration ... "
source configuration
[[ $? > 0 ]] && echo -e "\nconfiguration could not be loaded" && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
fi
if [ "$BOOK_BLFS" = y ]; then
## Read variables and sanity checks
[[ "$BRANCH" = y ]] && BLFS_COMMIT=$COMMIT
[[ "$WORKING_COPY" = y ]] && BLFS_BOOK=$BOOK
[[ "$BOOK" = "**EDIT ME**" ]] &&
echo You have not set the BLFS working copy location && exit 1
[[ "$LFS_BRANCH" = y ]] && LFS_COMMIT=$BLFS_LFS_COMMIT
[[ "$LFS_WORKING_COPY" = y ]] && LFS_BOOK=$BLFS_LFS_BOOK
[[ "$LFS_BOOK" = "**EDIT ME**" ]] &&
echo You have not set the LFS working copy location && exit 1
fi
COMMON_DIR="common" COMMON_DIR="common"
# blfs-tool envars
BLFS_TOOL='y' BLFS_TOOL='y'
BUILDDIR=$(cd ~;pwd) BUILDDIR=$(cd ~;pwd)
BLFS_ROOT="${BLFS_ROOT:=/blfs_root}" BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}" TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
INITSYS="${INITSYS:=sysv}"
BLFS_COMMIT=${BLFS_COMMIT:=trunk}
LFS_COMMIT=${LFS_COMMIT:=trunk}
BLFS_XML=${BLFS_XML:=blfs-xml}
LFS_XML=${LFS_XML:=lfs-xml}
# Validate the configuration:
PARAMS="BLFS_ROOT TRACKING_DIR INITSYS BLFS_XML LFS_XML"
if [ "$WORKING_COPY" = y ]; then
PARAMS="$PARAMS WORKING_COPY BLFS_BOOK"
else
PARAMS="$PARAMS BLFS_COMMIT"
fi
if [ "$LFS_WORKING_COPY" = y ]; then
PARAMS="$PARAMS LFS_WORKING_COPY LFS_BOOK"
else
PARAMS="$PARAMS LFS_COMMIT"
fi
# Format for displaying parameters:
declare -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
for config_param in $PARAMS; do
echo -e "`eval echo $PARAM_VALS`"
done
echo "${SD_BORDER}${nl_}"
echo -n "Are you happy with these settings? yes/no (no): "
read ANSWER
if [ x$ANSWER != "xyes" ] ; then
echo "${nl_}Rerun make and fix your settings.${nl_}"
exit
fi
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
#*******************************************************************# #*******************************************************************#
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..." [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh> ..."
source $COMMON_DIR/libs/func_check_version.sh source $COMMON_DIR/libs/func_check_version.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo " OK"
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
# blfs-tool envars
BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
case $BLFS_BRANCH_ID in
development ) BLFS_TREE=trunk/BOOK ;;
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
esac
# Check for build prerequisites. # Check for build prerequisites.
declare -r dotSTR=".................." # needed for proper display of versions
echo echo
check_alfs_tools check_alfs_tools
check_blfs_tools
echo "${SD_BORDER}${nl_}" echo "${SD_BORDER}${nl_}"
# Install the files # Install the files
[[ $VERBOSITY > 0 ]] && echo -n Populating the ${BUILDDIR}${BLFS_ROOT} directory [[ $VERBOSITY > 0 ]] && echo -n "Populating the ${BUILDDIR}${BLFS_ROOT} directory "
[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT} [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
rm -rf ${BUILDDIR}${BLFS_ROOT}/*
cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT} cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
cp -r menu ${BUILDDIR}${BLFS_ROOT} cp -r menu ${BUILDDIR}${BLFS_ROOT}
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT} cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
cp README.BLFS ${BUILDDIR}${BLFS_ROOT} cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
[[ $VERBOSITY > 0 ]] && echo "... OK" [[ $VERBOSITY > 0 ]] && echo "... OK"
[[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
# Clean-up # Clean-up
make -C ${BUILDDIR}${BLFS_ROOT}/menu clean [[ $VERBOSITY > 0 ]] && echo -n "Cleaning the ${BUILDDIR}${BLFS_ROOT} directory "
rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
# We do not want to keep an old version of the book: # We do not want to keep an old version of the book:
rm -rf ${BUILDDIR}${BLFS_ROOT}/blfs-xml rm -rf ${BUILDDIR}${BLFS_ROOT}/$BLFS_XML
rm -rf ${BUILDDIR}${BLFS_ROOT}/$LFS_XML
# Set some harcoded envars to their proper values # Set some harcoded envars to their proper values
sed -i s@tracking-dir@$TRACKING_DIR@ \ sed -i s@tracking-dir@$TRACKING_DIR@ \
${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh} ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh,gen_pkg_book.sh}
# Ensures the tracking directory exists. # Ensures the tracking directory exists.
# Throws an error if it does not exist and the user does not # Throws an error if it does not exist and the user does not
@ -112,10 +157,28 @@ sed -i s@tracking-dir@$TRACKING_DIR@ \
mkdir -p $TRACKING_DIR mkdir -p $TRACKING_DIR
[[ $VERBOSITY > 0 ]] && echo "... OK" [[ $VERBOSITY > 0 ]] && echo "... OK"
[[ $VERBOSITY > 0 ]] && echo -n "Downloading and validating the book (may take some time)" [[ -z "$BLFS_BOOK" ]] ||
[[ $BLFS_BOOK = $BUILDDIR$BLFS_ROOT/$BLFS_XML ]] || {
[[ $VERBOSITY > 0 ]] && echo -n "Retrieving BLFS working copy (may take some time) "
cp -a $BLFS_BOOK $BUILDDIR$BLFS_ROOT/$BLFS_XML
[[ $VERBOSITY > 0 ]] && echo "... OK"
}
[[ -z "$LFS_BOOK" ]] ||
[[ $LFS_BOOK = $BUILDDIR$BLFS_ROOT/$LFS_XML ]] || {
[[ $VERBOSITY > 0 ]] && echo -n "Retrieving the LFS working copy (may take some time) "
cp -a $LFS_BOOK $BUILDDIR$BLFS_ROOT/$LFS_XML
[[ $VERBOSITY > 0 ]] && echo "... OK"
}
[[ $VERBOSITY > 0 ]] && echo "Initializing the BLFS tool directory "
make -j1 -C $BUILDDIR$BLFS_ROOT \ make -j1 -C $BUILDDIR$BLFS_ROOT \
TRACKING_DIR=$TRACKING_DIR \ TRACKING_DIR=$TRACKING_DIR \
SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \ REV=$INITSYS \
LFS_XML=$BUILDDIR$BLFS_ROOT/$LFS_XML \
LFS-BRANCH=${LFS_COMMIT} \
BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
BLFS-BRANCH=${BLFS_COMMIT} \
$BUILDDIR$BLFS_ROOT/packages.xml $BUILDDIR$BLFS_ROOT/packages.xml
[[ $VERBOSITY > 0 ]] && echo "... OK" [[ $VERBOSITY > 0 ]] && echo "... OK"

483
jhalfs
View file

@ -1,31 +1,25 @@
#!/bin/bash #!/bin/bash
# $Id$
set -e set -e
# Pass trap handlers to functions # Pass trap handlers to functions
set -E set -E
# VT100 colors # VT100 colors
declare -r BLACK=$'\e[1;30m'
declare -r DK_GRAY=$'\e[0;30m'
declare -r RED=$'\e[31m' declare -r RED=$'\e[31m'
declare -r GREEN=$'\e[32m' declare -r GREEN=$'\e[32m'
declare -r YELLOW=$'\e[33m' declare -r YELLOW=$'\e[33m'
declare -r BLUE=$'\e[34m'
declare -r MAGENTA=$'\e[35m'
declare -r CYAN=$'\e[36m'
declare -r WHITE=$'\e[37m'
# shellcheck disable=SC2034
declare -r BLUE=$'\e[34m'
declare -r OFF=$'\e[0m' declare -r OFF=$'\e[0m'
declare -r BOLD=$'\e[1m' declare -r BOLD=$'\e[1m'
declare -r REVERSE=$'\e[7m'
declare -r HIDDEN=$'\e[8m'
declare -r tab_=$'\t' declare -r tab_=$'\t'
declare -r nl_=$'\n' declare -r nl_=$'\n'
# shellcheck disable=SC2034
declare -r DD_BORDER="${BOLD}==============================================================================${OFF}" declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
# shellcheck disable=SC2034
declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}" declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
# shellcheck disable=SC2034
declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}" declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
# bold yellow > < pair # bold yellow > < pair
@ -37,20 +31,14 @@ declare -r L_arrow=$'\e[1;33m<\e[0m'
#-----------------------# #-----------------------#
simple_error() { # Basic error trap.... JUST DIE simple_error() { # Basic error trap.... JUST DIE
#-----------------------# #-----------------------#
# If +e then disable text output LASTLINE="$1"
if [[ "$-" =~ e ]]; then LASTERR="$2"
LASTLINE="$1" LASTSOURCE="$4"
LASTERR="$2" error_message "${GREEN} Error $LASTERR at $LASTSOURCE line ${LASTLINE}!"
LASTFUNC="$3"
LASTSOURCE="$4"
# echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
echo -e "\n${RED}ERROR:${GREEN} Error $LASTERR at $LASTSOURCE line ${LASTLINE}!${OFF}\n" >&2
fi
exit $LASTERR
} }
see_ya() { see_ya() {
echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n" printf '\n%b%bjhalfs%b exit%b\n' "$L_arrow" "$BOLD" "$R_arrow" "$OFF"
} }
##### Simple error TRAPS ##### Simple error TRAPS
# ctrl-c SIGINT # ctrl-c SIGINT
@ -66,50 +54,95 @@ see_ya() {
set -e set -e
trap see_ya 0 trap see_ya 0
trap 'simple_error "${LINENO}" "$?" "${FUNCNAME}" "${BASH_SOURCE}"' ERR trap 'simple_error "${LINENO}" "$?" "${FUNCNAME}" "${BASH_SOURCE}"' ERR
trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23 trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' \
HUP INT QUIT TERM # STOP stops tterminal output and does not seem to
# execute the handler
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
simple_message() {
# Prevents having to check $VERBOSITY everywhere
if [ "$VERBOSITY" -ne 0 ] ; then
# shellcheck disable=SC2059
printf "$*"
fi
}
warning_message() {
simple_message "${YELLOW}\\nWARNING:${OFF} $*\\n\\n"
}
error_message() {
# Prints an error message and exits with LASTERR or 1
if [ -n "$LASTERR" ] ; then
LASTERR=$(printf '%d' "$LASTERR")
else
LASTERR=1
fi
# If +e then disable text output
if [[ "$-" =~ e ]]; then
printf '\n\n%bERROR:%b %s\n' "$RED" "$OFF" "$*" >&2
fi
exit "$LASTERR"
}
load_file() {
# source files in a consistent way with an optional message
file="$1"
shift
msg="Loading file ${file}..."
[ -z "$*" ] || msg="$*..."
simple_message "$msg"
# shellcheck disable=SC1090
source "$file" 2>/dev/null || error_message "$file did not load"
simple_message "OK\\n"
}
git_commit=$(git log -1 --format=format:"%h %ad")
version=" version="
${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$ ${BOLD} \"jhalfs\"${OFF} builder tool (development) $git_commit
\$Date$
Written by George Boudreau and Manuel Canales Esparcia, Copyright (C) 2005-2023, the jhalfs team:
plus several contributions. Jeremy Huntwork
George Boudreau
Manuel Canales Esparcia
Thomas Pegg
Matthew Burgess
Pierre Labastie
Based on an idea from Jeremy Huntwork Unless specified, all the files in this directory and its sub-directories
are subjected to the ${BOLD}MIT license${OFF}. See the ${BOLD}LICENSE${OFF} file.
This set of files are published under the The files in the ${BOLD}menu${OFF} directory are subjected to the ${BOLD}ISC License${OFF}.
${BOLD}Gnu General Public License, Version 2.${OFF} See ${BOLD}LICENSE.txt${OFF} and ${BOLD}README${OFF} in that directory.
" "
usage="${nl_}${tab_}${BOLD}${RED}This script cannot be called directly${OFF}
${tab_}Type ${BOLD}make${OFF} to run the tool, or
${tab_}Type ${BOLD}./jhalfs -v${OFF} to display version information."
case $1 in case $1 in
-v ) echo "$version" && exit 1 ;; -v ) echo "$version" && exit ;;
run ) : ;; run ) : ;;
* ) * ) echo "$usage" && exit 1 ;;
echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
exit 1
;;
esac esac
# If the user has not saved his configuration file, let's ask # If the user has not saved his configuration file, let's ask
# if he or she really wants to run this stuff # if he or she really wants to run this stuff
if [ $(ls -l --time-style='+%Y%m%d%H%M%S' configuration.old | cut -d' ' -f 6) \ time_current=$(stat -c '%Y' configuration 2>/dev/null || date +%s)
-ge $(ls -l --time-style='+%Y%m%d%H%M%S' configuration | cut -d' ' -f 6) ] time_old=$(stat -c '%Y' configuration.old 2>/dev/null || printf '%s' "$time_current")
then echo -n "Do you want to run jhalfs? yes/no (yes): " if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ] ; then
read ANSWER printf 'Do you want to run jhalfs? yes/no (yes): '
if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then read -r ANSWER
echo "${nl_}Exiting gracefully.${nl_}" case ${ANSWER:0:1} in
exit n|N) printf "\nExiting gracefully.\n"; exit ;;
fi esac
fi fi
# Change this to 0 to suppress almost all messages # Change this to 0 to suppress almost all messages
VERBOSITY=1 VERBOSITY=1
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..." load_file configuration "Loading config params from <configuration>"
source configuration
[[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
[[ $VERBOSITY > 0 ]] && echo "OK"
# These are boolean vars generated from Config.in. # These are boolean vars generated from Config.in.
# ISSUE: If a boolean parameter is not set to y(es) there # ISSUE: If a boolean parameter is not set to y(es) there
@ -120,13 +153,13 @@ source configuration
RUNMAKE=${RUNMAKE:-n} RUNMAKE=${RUNMAKE:-n}
GETPKG=${GETPKG:-n} GETPKG=${GETPKG:-n}
COMPARE=${COMPARE:-n} COMPARE=${COMPARE:-n}
RUN_FARCE=${RUN_FARCE:-n}
RUN_ICA=${RUN_ICA:-n} RUN_ICA=${RUN_ICA:-n}
PKGMNGT=${PKGMNGT:-n} PKGMNGT=${PKGMNGT:-n}
BOMB_TEST=${BOMB_TEST:-n} WRAP_INSTALL=${WRAP_INSTALL:-n}
STRIP=${STRIP:=n} STRIP=${STRIP:=n}
REPORT=${REPORT:=n} REPORT=${REPORT:=n}
VIMLANG=${VIMLANG:-n} NCURSES5=${NCURSES5:-n}
DEL_LA_FILES=${DEL_LA_FILES:-n}
FULL_LOCALE=${FULL_LOCALE:-n} FULL_LOCALE=${FULL_LOCALE:-n}
GRSECURITY_HOST=${GRSECURITY_HOST:-n} GRSECURITY_HOST=${GRSECURITY_HOST:-n}
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n} CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
@ -140,168 +173,85 @@ SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
SET_WARNINGS=${SET_WARNINGS:=n} SET_WARNINGS=${SET_WARNINGS:=n}
SET_MISC=${SET_MISC:=n} SET_MISC=${SET_MISC:=n}
SET_BLOWFISH=${SET_BLOWFISH:=n} SET_BLOWFISH=${SET_BLOWFISH:=n}
UNICODE=${UNICODE:=n}
LOCAL=${LOCAL:=n}
ALL_CORES=${ALL_CORES:=n}
REALSBU=${REALSBU:=n}
SAVE_CH5=${SAVE_CH5:=n}
if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
NO_PROGRESS="#" # shellcheck disable=SC2034
NO_PROGRESS="#"
fi fi
# Sanity check on the location of $BUILDDIR / $JHALFSDIR # Sanity check on the location of $BUILDDIR / $JHALFSDIR
CWD=$(cd `dirname $0` && pwd) CWD="$(cd "$(dirname "$0")" && pwd)"
if [[ $JHALFSDIR == $CWD ]]; then if [[ $JHALFSDIR == "$CWD" ]]; then
echo " The jhalfs source directory conflicts with the jhalfs build directory." echo " The jhalfs source directory conflicts with the jhalfs build directory."
echo " Please move the source directory or change the build directory." echo " Please move the source directory or change the build directory."
exit 2 exit 2
fi fi
# Book sources envars
BRANCH_ID=${BRANCH_ID:=development}
case $BRANCH_ID in
development )
case $PROGNAME in
clfs* ) TREE="" ;;
* ) TREE=trunk/BOOK ;;
esac
LFSVRS=development
;;
*EDIT* ) echo " You forgot to set the branch or stable book version."
echo " Please rerun make and fix the configuration."
exit 2 ;;
branch-* )
case $PROGNAME in
lfs )
LFSVRS=${BRANCH_ID}
TREE=branches/${BRANCH_ID#branch-}
if [ ${BRANCH_ID#branch-} = 6 ]; then
TREE=${TREE}/BOOK
fi
;;
clfs* )
LFSVRS=${BRANCH_ID}
TREE=${BRANCH_ID#branch-}
;;
esac
;;
* )
case $PROGNAME in
lfs )
LFSVRS=${BRANCH_ID}
TREE=tags/${BRANCH_ID}
if (( ${BRANCH_ID:0:1} < 7 )) ; then
TREE=${TREE}/BOOK
fi
;;
hlfs )
LFSVRS=${BRANCH_ID}
TREE=tags/${BRANCH_ID}/BOOK
;;
clfs* )
LFSVRS=${BRANCH_ID}
TREE=clfs-${BRANCH_ID}
;;
* )
esac
;;
esac
# Set the document location... # Set the document location...
BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS} BOOK=${BOOK:=$JHALFSDIR/book-source}
#--- Envars not sourced from configuration #--- Envars not sourced from configuration
case $PROGNAME in # shellcheck disable=SC2034
clfs ) declare -r GIT="git://git.clfs.org/cross-lfs" ;; declare -r REPO=https://git.linuxfromscratch.org/lfs.git
clfs2 ) declare -r GIT="git://git.clfs.org/clfs-sysroot" ;;
clfs3 ) declare -r GIT="git://git.clfs.org/clfs-embedded" ;;
*) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
esac
declare -r LOG=000-masterscript.log declare -r LOG=000-masterscript.log
# Needed for fetching BLFS book sources when building CLFS declare -r COMMANDS=lfs-commands
declare -r SVN_2="svn://svn.linuxfromscratch.org"
# Set true internal variables # Set true internal variables
COMMON_DIR="common" COMMON_DIR="common"
PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]') PACKAGE_DIR=LFS
MODULE=$PACKAGE_DIR/master.sh MODULE=$PACKAGE_DIR/master.sh
PKGMNGTDIR="pkgmngt" PKGMNGTDIR="pkgmngt"
# The name packageManager.xml is hardcoded in *.xsl, so no variable. # The name packageManager.xml is hardcoded in *.xsl, so no variable.
[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..." for file in \
source $COMMON_DIR/common-functions "$COMMON_DIR/common-functions" \
[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit "$COMMON_DIR/libs/func_book_parser" \
[[ $VERBOSITY > 0 ]] && echo "OK" "$COMMON_DIR/libs/func_download_pkgs" \
[[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..." "$COMMON_DIR/libs/func_wrt_Makefile" \
source $MODULE "$MODULE" ; do
[[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2 load_file "$file"
[[ $VERBOSITY > 0 ]] && echo "OK" done
#
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" simple_message "${SD_BORDER}${nl_}"
#*******************************************************************# #*******************************************************************#
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..." LASTERR=2
source $COMMON_DIR/libs/func_check_version.sh for file in \
[[ $? > 0 ]] && echo " function module did not load.." && exit 2 "$COMMON_DIR/libs/func_check_version.sh" \
[[ $VERBOSITY > 0 ]] && echo "OK" "$COMMON_DIR/libs/func_validate_configs.sh" \
"$COMMON_DIR/libs/func_custom_pkgs" ; do
load_file "$file"
done
unset LASTERR
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..." simple_message "${SD_BORDER}${nl_}"
source $COMMON_DIR/libs/func_validate_configs.sh simple_message "Checking tools required for jhalfs${nl_}"
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
source $COMMON_DIR/libs/func_custom_pkgs
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
[[ $VERBOSITY > 0 ]] && echo Checking tools required for jhalfs
check_alfs_tools check_alfs_tools
simple_message "${SD_BORDER}${nl_}"
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
# blfs-tool envars # blfs-tool envars
BLFS_TOOL=${BLFS_TOOL:-n} BLFS_TOOL=${BLFS_TOOL:-n}
if [[ "${BLFS_TOOL}" = "y" ]] ; then if [[ "${BLFS_TOOL}" = "y" ]] ; then
[[ $VERBOSITY > 0 ]] && echo Checking supplementary tools for installing BLFS #not needed now that the check is in alfs_tools
check_blfs_tools # simple_message 'Checking supplementary tools for installing BLFS'
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" # check_blfs_tools
BLFS_SVN=${BLFS_SVN:-n} simple_message "${SD_BORDER}${nl_}"
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
BLFS_BRANCH=${BLFS_BRANCH:-n} BLFS_BRANCH=${BLFS_BRANCH:-n}
if [[ "${BLFS_SVN}" = "y" ]]; then BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
BLFS_BRANCH_ID=development if [[ "${BLFS_WORKING_COPY}" = "y" ]] &&
BLFS_TREE=trunk/BOOK [[ ! -d "$BLFS_WC_LOCATION/postlfs" ]] ; then
elif [[ "${BLFS_WORKING_COPY}" = "y" ]]; then
[[ -d "$BLFS_WC_LOCATION" ]] &&
[[ -d "$BLFS_WC_LOCATION/postlfs" ]] || {
echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION." echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION."
echo " Please rerun make and fix the configuration." echo " Please rerun make and fix the configuration."
exit 2 exit 2
}
BLFS_TREE=$(cd $BLFS_WC_LOCATION; svn info | grep '^URL' | sed 's@.*BLFS/@@')
BLFS_BRANCH_ID=$(echo $BLFS_TREE | sed -e 's@trunk/BOOK@development@' \
-e 's@branches/@branch-@' \
-e 's@tags/@@' \
-e 's@/BOOK@@')
elif [[ "${BLFS_BRANCH}" = "y" ]] ; then
case $BLFS_BRANCH_ID in
*EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
echo " Please rerun make and fix the configuration."
exit 2 ;;
branch-systemd ) BLFS_TREE=branches/systemd ;;
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;;
6.2* | 7.* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;;
esac
fi fi
[[ $VERBOSITY > 0 ]] && echo -n "Loading blfs tools installation function..." load_file "${COMMON_DIR}/libs/func_install_blfs"
source $COMMON_DIR/libs/func_install_blfs
[[ $? > 0 ]] && echo "function module did not load.." && exit 1
[[ $VERBOSITY > 0 ]] && echo "OK"
fi fi
################################### ###################################
@ -312,8 +262,8 @@ fi
validate_config validate_config
echo "${SD_BORDER}${nl_}" echo "${SD_BORDER}${nl_}"
echo -n "Are you happy with these settings? yes/no (no): " echo -n "Are you happy with these settings? yes/no (no): "
read ANSWER read -r ANSWER
if [ x$ANSWER != "xyes" ] ; then if [ "x$ANSWER" != "xyes" ] ; then
echo "${nl_}Rerun make to fix the configuration options.${nl_}" echo "${nl_}Rerun make to fix the configuration options.${nl_}"
exit exit
fi fi
@ -322,127 +272,134 @@ echo "${nl_}${SD_BORDER}${nl_}"
# Load additional modules or configuration files based on global settings # Load additional modules or configuration files based on global settings
# compare module # compare module
if [[ "$COMPARE" = "y" ]]; then if [[ "$COMPARE" = "y" ]]; then
[[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..." load_file "${COMMON_DIR}/libs/func_compare.sh" 'Loading compare module'
source $COMMON_DIR/libs/func_compare.sh fi
[[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit #
[[ $VERBOSITY > 0 ]] && echo "OK" # save module
if [[ "$SAVE_CH5" = "y" ]]; then
load_file "${COMMON_DIR}/libs/func_save.sh" 'Loading save module'
fi fi
# #
# optimize module # optimize module
# the optimize_functions file is needed for wrt_makeflags even
# if optimize=0, because we need to pass NINJAJOBS=1
load_file optimize/optimize_functions 'Loading optimization module'
if [[ "$OPTIMIZE" != "0" ]]; then if [[ "$OPTIMIZE" != "0" ]]; then
[[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
source optimize/optimize_functions
[[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
[[ $VERBOSITY > 0 ]] && echo "OK"
# #
# optimize configurations # optimize configurations
[[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..." load_file optimize/opt_config 'Loading optimization config'
source optimize/opt_config
[[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
[[ $VERBOSITY > 0 ]] && echo "OK"
# The number of parallel jobs is taken from configuration now
MAKEFLAGS="-j${N_PARALLEL}"
# Validate optimize settings, if required # Validate optimize settings, if required
validate_opt_settings validate_opt_settings
fi fi
# Parallelization is outside optimization, because it is now in the book
if [[ "$ALL_CORES" = "n" ]]; then
# shellcheck disable=SC2034
JH_MAKEFLAGS="-j${N_PARALLEL}"
fi
# #
if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
# If requested, clean the build directory # If requested, clean the build directory
clean_builddir clean_builddir
if [[ ! -d $JHALFSDIR ]]; then if [[ ! -d $JHALFSDIR ]]; then
mkdir -p $JHALFSDIR sudo mkdir -p "$JHALFSDIR"
# Do not assume there is a group named as $USER, do not use
# $USER:$USER...
sudo chown "$USER" "$JHALFSDIR"
fi fi
# Create $BUILDDIR/sources even though it could be created by get_sources() # Create $BUILDDIR/sources even though it could be created by get_sources()
if [[ ! -d $BUILDDIR/sources ]]; then if [[ ! -d $BUILDDIR/sources ]]; then
mkdir -p $BUILDDIR/sources sudo mkdir -p "$BUILDDIR/sources"
sudo chmod a+wt "$BUILDDIR/sources"
fi fi
#
# Create the log directory
if [[ ! -d $LOGDIR ]]; then
mkdir $LOGDIR
fi
>$LOGDIR/$LOG
#
# Copy common helper files
cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
# Copy needed stylesheets
cp $COMMON_DIR/{packages.xsl,chroot.xsl} $JHALFSDIR/
#
# Fix the XSL book parser
case $PROGNAME in
clfs* ) sed 's,FAKEDIR,'${BOOK}/BOOK',' ${PACKAGE_DIR}/${XSL} > $JHALFSDIR/${XSL} ;;
lfs | hlfs ) sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} ;;
* ) ;;
esac
export XSL=$JHALFSDIR/${XSL}
#
# Copy packageManager.xml, if needed # Create the log directory
[[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] && if [[ ! -d $LOGDIR ]]; then
cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ && mkdir "$LOGDIR"
cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/ fi
# true >"$LOGDIR/$LOG"
# Copy urls.xsl, if needed
[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ # Copy common helper files
# cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh,run-in-cgroup.sh} "$JHALFSDIR/"
# Create the test-log directory, if needed
[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR # Copy needed stylesheets
# cp "$COMMON_DIR"/{packages.xsl,chroot.xsl,kernfs.xsl} "$JHALFSDIR/"
# Create the installed-files directory, if needed cp "$PACKAGE_DIR/$XSL" "$JHALFSDIR/"
[[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
# export XSL=$JHALFSDIR/${XSL}
# Prepare report creation, if needed
# Copy packageManager.xml, if needed
[[ "$PKGMNGT" = "y" ]] && {
sed s@BOOK@"$BOOK"@ "$PKGMNGTDIR/packageManager.xml" > \
"$JHALFSDIR/"packageManager.xml
cp "$PKGMNGTDIR/packInstall.sh" "$JHALFSDIR/"
}
# Copy urls.xsl, if needed
[[ "$GETPKG" = "y" ]] && cp "$COMMON_DIR/urls.xsl" "$JHALFSDIR/"
# Always create the test-log directory to allow user to "uncomment" test
# instructions
install -d -m 1777 "$TESTLOGDIR"
# Create the installed-files directory, if needed
[[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 "$FILELOGDIR"
# Prepare report creation, if needed
if [[ "$REPORT" = "y" ]]; then if [[ "$REPORT" = "y" ]]; then
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ cp $COMMON_DIR/create-sbu_du-report.sh "$JHALFSDIR/"
# After making sure that all looks sane, dump the settings to a file # After making sure that all looks sane, dump the settings to a file
# This file will be used to create the REPORT header # This file will be used to create the REPORT header
validate_config > $JHALFSDIR/jhalfs.config validate_config >"$JHALFSDIR/jhalfs.config"
fi fi
#
# Copy optimize files, if needed # Copy optimize files, if needed
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override "$JHALFSDIR/"
#
# Copy compare files, if needed # Copy compare files, if needed
if [[ "$COMPARE" = "y" ]]; then if [[ "$COMPARE" = "y" ]]; then
mkdir -p $JHALFSDIR/extras mkdir -p "$JHALFSDIR/extras"
cp extras/* $JHALFSDIR/extras cp extras/* "$JHALFSDIR/extras"
fi fi
#
# Copy custom tools config files, if requested # Copy custom tools config files, if requested
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
echo "Copying custom tool scripts to $JHALFSDIR" echo "Copying custom tool scripts to $JHALFSDIR"
mkdir -p $JHALFSDIR/custom-commands mkdir -p "$JHALFSDIR/custom-commands"
cp -f custom/config/* $JHALFSDIR/custom-commands cp -f custom/config/* "$JHALFSDIR/custom-commands"
fi fi
#
# Install blfs-tool, if requested.
if [[ "${BLFS_TOOL}" = "y" ]] ; then
echo Installing BLFS book and tools
install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
[[ ${PIPESTATUS[0]} != 0 ]] && exit 1
fi
#
# Download or updates the book source # Download or updates the book source
# Note that all customization to $JHALFSDIR have to be done before this.
# But the LFS book is needed for BLFS tools.
get_book get_book
extract_commands extract_commands
echo "${SD_BORDER}${nl_}" echo "${SD_BORDER}${nl_}"
cd "$CWD" # the functions above change directory
# Install blfs-tool, if requested.
if [[ "${BLFS_TOOL}" = "y" ]] ; then
echo Installing BLFS book and tools
install_blfs_tools 2>&1 | tee -a "$LOGDIR/$LOG"
[[ ${PIPESTATUS[0]} != 0 ]] && exit 1
fi
fi fi
# shellcheck disable=SC2034
if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
# Sanity check: users tend to tick "rebuild Makefile"
# without generating one first. Check we have one:
if [ ! -f $MKFILE ]; then
set -e
error_message "You cannot \"rebuild Makefile\" without first building one"
fi
# When regenerating the Makefile, we need to know also the # When regenerating the Makefile, we need to know also the
# canonical book version # canonical book version
if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then VERSION=$(grep 'echo.*lfs-release' "$JHALFSDIR/prbook.xml" | sed 's/.*echo[ ]*\([^ ]*\).*/\1/')
case $PROGNAME in
clfs* )
VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
*)
VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
esac
fi fi
build_Makefile build_Makefile
@ -451,7 +408,7 @@ echo "${SD_BORDER}${nl_}"
# Check for build prerequisites. # Check for build prerequisites.
echo echo
cd $CWD cd "$CWD"
check_prerequisites check_prerequisites
echo "${SD_BORDER}${nl_}" echo "${SD_BORDER}${nl_}"
# All is well, run the build (if requested) # All is well, run the build (if requested)

View file

@ -1,507 +0,0 @@
diff -Npr menu-bb/conf.c menu/conf.c
*** menu-bb/conf.c 2006-03-22 16:16:18.000000000 -0500
--- menu/conf.c 2006-07-26 17:26:45.000000000 -0400
*************** int main(int ac, char **av)
*** 535,554 ****
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
- case set_default:
- if (!defconfig_file)
- defconfig_file = conf_get_default_confname();
- if (conf_read(defconfig_file)) {
- printf("***\n"
- "*** Can't find default configuration \"%s\"!\n"
- "***\n", defconfig_file);
- exit(1);
- }
- break;
case ask_silent:
if (stat(".config", &tmpstat)) {
printf("***\n"
! "*** You have not yet configured BusyBox!\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make config\").\n"
--- 535,544 ----
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
case ask_silent:
if (stat(".config", &tmpstat)) {
printf("***\n"
! "*** You have not yet configured JHALFS!\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make config\").\n"
*************** int main(int ac, char **av)
*** 576,582 ****
check_conf(&rootmenu);
} while (conf_cnt);
if (conf_write(NULL)) {
! fprintf(stderr, "\n*** Error during writing of the BusyBox configuration.\n\n");
return 1;
}
return 0;
--- 566,572 ----
check_conf(&rootmenu);
} while (conf_cnt);
if (conf_write(NULL)) {
! fprintf(stderr, "\n*** Error during writing of the JHALFS configuration.\n\n");
return 1;
}
return 0;
diff -Npr menu-bb/confdata.c menu/confdata.c
*** menu-bb/confdata.c 2006-03-22 16:16:18.000000000 -0500
--- menu/confdata.c 2006-07-26 17:26:45.000000000 -0400
***************
*** 13,24 ****
#define LKC_DIRECT_LINK
#include "lkc.h"
! const char conf_def_filename[] = ".config";
const char conf_defname[] = "defconfig";
const char *conf_confnames[] = {
! ".config",
conf_defname,
NULL,
};
--- 13,24 ----
#define LKC_DIRECT_LINK
#include "lkc.h"
! const char conf_def_filename[] = "configuration";
const char conf_defname[] = "defconfig";
const char *conf_confnames[] = {
! "configuration",
conf_defname,
NULL,
};
*************** static char *conf_expand_value(const cha
*** 49,70 ****
return res_value;
}
- char *conf_get_default_confname(void)
- {
- struct stat buf;
- static char fullname[PATH_MAX+1];
- char *env, *name;
-
- name = conf_expand_value(conf_defname);
- env = getenv(SRCTREE);
- if (env) {
- sprintf(fullname, "%s/%s", env, name);
- if (!stat(fullname, &buf))
- return fullname;
- }
- return name;
- }
-
int conf_read(const char *name)
{
FILE *in = NULL;
--- 49,54 ----
*************** struct menu *next_menu(struct menu *menu
*** 271,277 ****
int conf_write(const char *name)
{
! FILE *out, *out_h;
struct symbol *sym;
struct menu *menu;
const char *basename;
--- 255,261 ----
int conf_write(const char *name)
{
! FILE *out;
struct symbol *sym;
struct menu *menu;
const char *basename;
*************** int conf_write(const char *name)
*** 279,288 ****
int type, l;
const char *str;
- /* busybox`s code */
- const char *opt_name;
- int use_flg;
-
dirname[0] = 0;
if (name && name[0]) {
struct stat st;
--- 263,268 ----
*************** int conf_write(const char *name)
*** 309,342 ****
out = fopen(newname, "w");
if (!out)
return 1;
- out_h = NULL;
- if (!name) {
- out_h = fopen(".tmpconfig.h", "w");
- if (!out_h)
- return 1;
- }
fprintf(out, "#\n"
! "# Automatically generated make config: don't edit\n"
"#\n");
- /* busybox`s code */
- if (out_h) {
- fprintf(out_h, "#ifndef BB_CONFIG_H\n#define BB_CONFIG_H\n");
- fprintf(out_h, "/*\n"
- " * Automatically generated header file: don't edit\n"
- " */\n\n"
- "/* Version Number */\n"
- "#define BB_VER \"%s\"\n"
- "#define BB_BT \"%s\"\n",
- getenv("VERSION"),
- getenv("BUILDTIME"));
- if (getenv("EXTRA_VERSION"))
- fprintf(out_h, "#define BB_EXTRA_VERSION \"%s\"\n",
- getenv("EXTRA_VERSION"));
- fprintf(out_h, "\n");
- }
- /* end busybox`s code */
-
if (!sym_change_count)
sym_clear_all_valid();
--- 289,299 ----
out = fopen(newname, "w");
if (!out)
return 1;
fprintf(out, "#\n"
! "# Automatically generated configuration: don't edit\n"
! "# use make menuconfig or make config to make changes\n"
"#\n");
if (!sym_change_count)
sym_clear_all_valid();
*************** int conf_write(const char *name)
*** 357,367 ****
"#\n"
"# %s\n"
"#\n", str);
- if (out_h)
- fprintf(out_h, "\n"
- "/*\n"
- " * %s\n"
- " */\n", str);
} else if (!(sym->flags & SYMBOL_CHOICE)) {
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_FORCEWRITE))
--- 314,319 ----
*************** int conf_write(const char *name)
*** 375,388 ****
type = S_BOOLEAN;
}
- /* busybox`s code */
- opt_name = strchr(sym->name, '_');
- if(opt_name == NULL)
- opt_name = sym->name;
- else
- opt_name++;
- use_flg = 1;
- /* end busybox`s code */
switch (type) {
case S_BOOLEAN:
--- 327,332 ----
*************** int conf_write(const char *name)
*** 390,410 ****
switch (sym_get_tristate_value(sym)) {
case no:
fprintf(out, "# %s is not set\n", sym->name);
- if (out_h)
- fprintf(out_h, "#undef %s\n", sym->name);
- use_flg = 0; /* busybox`s code */
break;
case mod:
- #if 0 /* busybox`s code */
fprintf(out, "%s=m\n", sym->name);
- if (out_h)
- fprintf(out_h, "#define %s_MODULE 1\n", sym->name);
- #endif /* busybox`s code */
break;
case yes:
fprintf(out, "%s=y\n", sym->name);
- if (out_h)
- fprintf(out_h, "#define %s 1\n", sym->name);
break;
}
break;
--- 334,345 ----
*************** int conf_write(const char *name)
*** 412,473 ****
// fix me
str = sym_get_string_value(sym);
fprintf(out, "%s=\"", sym->name);
- if (out_h)
- fprintf(out_h, "#define %s \"", sym->name);
do {
l = strcspn(str, "\"\\");
if (l) {
fwrite(str, l, 1, out);
- if (out_h)
- fwrite(str, l, 1, out_h);
}
str += l;
while (*str == '\\' || *str == '"') {
fprintf(out, "\\%c", *str);
- if (out_h)
- fprintf(out_h, "\\%c", *str);
str++;
}
} while (*str);
fputs("\"\n", out);
- if (out_h)
- fputs("\"\n", out_h);
break;
case S_HEX:
str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
fprintf(out, "%s=%s\n", sym->name, *str ? str : "0");
- if (out_h)
- fprintf(out_h, "#define %s 0x%s\n", sym->name, str);
break;
}
case S_INT:
str = sym_get_string_value(sym);
fprintf(out, "%s=%s\n", sym->name, *str ? str : "0");
- if (out_h)
- fprintf(out_h, "#define %s %s\n", sym->name, str);
break;
}
- /* busybox`s code */
- if (out_h) {
- fprintf(out_h, "#define ENABLE_%s %d\n", opt_name, use_flg);
- fprintf(out_h, "#define USE_%s(...)%s\n", opt_name,
- (use_flg ? " __VA_ARGS__" : ""));
- fprintf(out_h, "#define SKIP_%s(...)%s\n\n", opt_name,
- (use_flg ? "" : " __VA_ARGS__"));
- }
- /* end busybox`s code */
}
next:
menu = next_menu(menu);
}
fclose(out);
- if (out_h) {
- fprintf(out_h, "#endif /* BB_CONFIG_H */\n"); /* busybox`s code */
- fclose(out_h);
- rename(".tmpconfig.h", "include/bb_config.h"); /* busybox`s config name */
- file_write_dep(NULL);
- }
if (!name || basename != conf_def_filename) {
if (!name)
name = conf_def_filename;
--- 347,381 ----
diff -Npr menu-bb/Makefile menu/Makefile
*** menu-bb/Makefile 2006-03-22 16:16:18.000000000 -0500
--- menu/Makefile 2006-07-26 18:06:25.000000000 -0400
***************
*** 1,11 ****
# Makefile for BusyBox
#
# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
- top_srcdir=../..
- top_builddir=../..
- srcdir=$(top_srcdir)/scripts/config
- include $(top_srcdir)/Rules.mak
all: ncurses conf mconf
--- 1,30 ----
# Makefile for BusyBox
#
# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
+ # Modified by George Boudreau georgeb@LinuxFromScratch.org
+
+ top_srcdir=.
+ top_builddir=.
+ srcdir=$(top_srcdir)
+
+ # Select the compiler needed to build binaries for your development system
+ HOSTCC = gcc
+ HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+
+ # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
+ LC_ALL:= C
+
+ SED ?= sed
+ SECHO := @-false
+ DISP := pur
+ Q := @
+
+ show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
+ pur_disp_compile.h = echo " "HOSTCC $(show_objs)
+ disp_compile.h = $($(DISP)_disp_compile.h)
+ cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
+ compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
all: ncurses conf mconf
diff -Npr menu-bb/mconf.c menu/mconf.c
*** menu-bb/mconf.c 2006-03-22 16:16:18.000000000 -0500
--- menu/mconf.c 2006-07-26 17:26:45.000000000 -0400
*************** static char menu_backtitle[128];
*** 32,38 ****
static const char mconf_readme[] =
"Overview\n"
"--------\n"
! "Some features may be built directly into BusyBox. Some features\n"
"may be completely removed altogether. There are also certain\n"
"parameters which are not really features, but must be\n"
"entered in as decimal or hexadecimal numbers or possibly text.\n"
--- 32,38 ----
static const char mconf_readme[] =
"Overview\n"
"--------\n"
! "Some features may be built directly into JHALFS. Some features\n"
"may be completely removed altogether. There are also certain\n"
"parameters which are not really features, but must be\n"
"entered in as decimal or hexadecimal numbers or possibly text.\n"
*************** load_config_text[] =
*** 194,204 ****
"last retrieved. Leave blank to abort.",
load_config_help[] =
"\n"
! "For various reasons, one may wish to keep several different BusyBox\n"
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
! "BusyBox's default, entering the name of the file here will allow you\n"
"to modify that configuration.\n"
"\n"
"If you are uncertain, then you have probably never used alternate\n"
--- 194,204 ----
"last retrieved. Leave blank to abort.",
load_config_help[] =
"\n"
! "For various reasons, one may wish to keep several different JHALFS\n"
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
! "JHALFS's default, entering the name of the file here will allow you\n"
"to modify that configuration.\n"
"\n"
"If you are uncertain, then you have probably never used alternate\n"
*************** save_config_text[] =
*** 208,214 ****
"as an alternate. Leave blank to abort.",
save_config_help[] =
"\n"
! "For various reasons, one may wish to keep different BusyBox\n"
"configurations available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
--- 208,214 ----
"as an alternate. Leave blank to abort.",
save_config_help[] =
"\n"
! "For various reasons, one may wish to keep different JHALFS\n"
"configurations available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
*************** int main(int ac, char **av)
*** 940,946 ****
sym = sym_lookup("VERSION", 0);
sym_calc_value(sym);
! snprintf(menu_backtitle, 128, "BusyBox v%s Configuration",
sym_get_string_value(sym));
mode = getenv("MENUCONFIG_MODE");
--- 940,946 ----
sym = sym_lookup("VERSION", 0);
sym_calc_value(sym);
! snprintf(menu_backtitle, 128, "JHALFS v%s Configuration",
sym_get_string_value(sym));
mode = getenv("MENUCONFIG_MODE");
*************** int main(int ac, char **av)
*** 961,976 ****
init_dialog();
do {
stat = dialog_yesno(NULL,
! "Do you wish to save your new BusyBox configuration?", 5, 60);
} while (stat < 0);
end_dialog();
if (stat == 0) {
conf_write(NULL);
printf("\n"
! "*** End of BusyBox configuration.\n");
} else
! printf("\n\nYour BusyBox configuration changes were NOT saved.\n\n");
return 0;
}
--- 961,976 ----
init_dialog();
do {
stat = dialog_yesno(NULL,
! "Do you wish to save your new JHALFS configuration?", 5, 60);
} while (stat < 0);
end_dialog();
if (stat == 0) {
conf_write(NULL);
printf("\n"
! "*** End of JHALFS configuration.\n");
} else
! printf("\n\nYour JHALFS configuration changes were NOT saved.\n\n");
return 0;
}
diff -Npr menu-bb/zconf.tab.c_shipped menu/zconf.tab.c_shipped
*** menu-bb/zconf.tab.c_shipped 2006-03-22 16:16:18.000000000 -0500
--- menu/zconf.tab.c_shipped 2006-07-26 17:26:45.000000000 -0400
*************** void conf_parse(const char *name)
*** 1925,1931 ****
sym_init();
menu_init();
modules_sym = sym_lookup("MODULES", 0);
! rootmenu.prompt = menu_add_prop(P_MENU, "BusyBox Configuration", NULL, NULL);
//zconfdebug = 1;
zconfparse();
--- 1925,1931 ----
sym_init();
menu_init();
modules_sym = sym_lookup("MODULES", 0);
! rootmenu.prompt = menu_add_prop(P_MENU, "JHALFS Configuration", NULL, NULL);
//zconfdebug = 1;
zconfparse();
diff -Npr menu-bb/zconf.y menu/zconf.y
*** menu-bb/zconf.y 2006-03-22 16:16:18.000000000 -0500
--- menu/zconf.y 2006-07-26 17:26:45.000000000 -0400
*************** void conf_parse(const char *name)
*** 487,493 ****
sym_init();
menu_init();
modules_sym = sym_lookup("MODULES", 0);
! rootmenu.prompt = menu_add_prop(P_MENU, "BusyBox Configuration", NULL, NULL);
//zconfdebug = 1;
zconfparse();
--- 487,493 ----
sym_init();
menu_init();
modules_sym = sym_lookup("MODULES", 0);
! rootmenu.prompt = menu_add_prop(P_MENU, "JHALFS Configuration", NULL, NULL);
//zconfdebug = 1;
zconfparse();

View file

@ -1,255 +0,0 @@
Introduction
------------
The configuration database is collection of configuration options
organized in a tree structure:
+- Code maturity level options
| +- Prompt for development and/or incomplete code/drivers
+- General setup
| +- Networking support
| +- System V IPC
| +- BSD Process Accounting
| +- Sysctl support
+- Loadable module support
| +- Enable loadable module support
| +- Set version information on all module symbols
| +- Kernel module loader
+- ...
Every entry has its own dependencies. These dependencies are used
to determine the visible of an entry. Any child entry is only
visible if its parent entry is also visible.
Menu entries
------------
Most entries define a config option, all other entries help to organize
them. A single configuration option is defined like this:
config MODVERSIONS
bool "Set version information on all module symbols"
depends MODULES
help
Usually, modules have to be recompiled whenever you switch to a new
kernel. ...
Every line starts with a key word and can be followed by multiple
arguments. "config" starts a new config entry. The following lines
define attributes for this config option. Attributes can be the type of
the config option, input prompt, dependencies, help text and default
values. A config option can be defined multiple times with the same
name, but every definition can have only a single input prompt and the
type must not conflict.
Menu attributes
---------------
A menu entry can have a number of attributes. Not all of them are
applicable everywhere (see syntax).
- type definition: "bool"/"tristate"/"string"/"hex"/"integer"
Every config option must have a type. There are only two basic types:
tristate and string, the other types base on these two. The type
definition optionally accepts an input prompt, so these two examples
are equivalent:
bool "Networking support"
and
bool
prompt "Networking support"
- input prompt: "prompt" <prompt> ["if" <expr>]
Every menu entry can have at most one prompt, which is used to display
to the user. Optionally dependencies only for this prompt can be added
with "if".
- default value: "default" <symbol> ["if" <expr>]
A config option can have any number of default values. If multiple
default values are visible, only the first defined one is active.
Default values are not limited to the menu entry, where they are
defined, this means the default can be defined somewhere else or be
overriden by an earlier definition.
The default value is only assigned to the config symbol if no other
value was set by the user (via the input prompt above). If an input
prompt is visible the default value is presented to the user and can
be overridden by him.
Optionally dependencies only for this default value can be added with
"if".
- dependencies: "depends on"/"requires" <expr>
This defines a dependency for this menu entry. If multiple
dependencies are defined they are connected with '&&'. Dependencies
are applied to all other options within this menu entry (which also
accept "if" expression), so these two examples are equivalent:
bool "foo" if BAR
default y if BAR
and
depends on BAR
bool "foo"
default y
- help text: "help"
This defines a help text. The end of the help text is determined by
the level indentation, this means it ends at the first line which has
a smaller indentation than the first line of the help text.
Menu dependencies
-----------------
Dependencies define the visibility of a menu entry and can also reduce
the input range of tristate symbols. The tristate logic used in the
expressions uses one more state than normal boolean logic to express the
module state. Dependency expressions have the following syntax:
<expr> ::= <symbol> (1)
<symbol> '=' <symbol> (2)
<symbol> '!=' <symbol> (3)
'(' <expr> ')' (4)
'!' <expr> (5)
<expr> '||' <expr> (6)
<expr> '&&' <expr> (7)
Expressions are listed in decreasing order of precedence.
(1) Convert the symbol into an expression. Boolean and tristate symbols
are simply converted into the respective expression values. All
other symbol types result in 'n'.
(2) If the values of both symbols are equal, it returns 'y',
otherwise 'n'.
(3) If the values of both symbols are equal, it returns 'n',
otherwise 'y'.
(4) Returns the value of the expression. Used to override precedence.
(5) Returns the result of (2-/expr/).
(6) Returns the result of min(/expr/, /expr/).
(7) Returns the result of max(/expr/, /expr/).
An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
respectively for calculations). A menu entry becomes visible when it's
expression evaluates to 'm' or 'y'.
There are two type of symbols: constant and nonconstant symbols.
Nonconstant symbols are the most common ones and are defined with the
'config' statement. Nonconstant symbols consist entirely of alphanumeric
characters or underscores.
Constant symbols are only part of expressions. Constant symbols are
always surrounded by single or double quotes. Within the quote any
other character is allowed and the quotes can be escaped using '\'.
Menu structure
--------------
The position of a menu entry in the tree is determined in two ways. First
it can be specified explicitely:
menu "Network device support"
depends NET
config NETDEVICES
...
endmenu
All entries within the "menu" ... "endmenu" block become a submenu of
"Network device support". All subentries inherit the dependencies from
the menu entry, e.g. this means the dependency "NET" is added to the
dependency list of the config option NETDEVICES.
The other way to generate the menu structure is done by analyzing the
dependencies. If a menu entry somehow depends on the previous entry, it
can be made a submenu of it. First the the previous (parent) symbol must
be part of the dependency list and then one of these two condititions
must be true:
- the child entry must become invisible, if the parent is set to 'n'
- the child entry must only be visible, if the parent is visible
config MODULES
bool "Enable loadable module support"
config MODVERSIONS
bool "Set version information on all module symbols"
depends MODULES
comment "module support disabled"
depends !MODULES
MODVERSIONS directly depends on MODULES, this means it's only visible if
MODULES is different from 'n'. The comment on the other hand is always
visible when MODULES it's visible (the (empty) dependency of MODULES is
also part of the comment dependencies).
Kconfig syntax
--------------
The configuration file describes a series of menu entries, where every
line starts with a keyword (except help texts). The following keywords
end a menu entry:
- config
- choice/endchoice
- comment
- menu/endmenu
- if/endif
- source
The first four also start the definition of a menu entry.
config:
"config" <symbol>
<config options>
This defines a config symbol <symbol> and accepts any of above
attributes as options.
choices:
"choice"
<choice options>
<choice block>
"endchoice"
This defines a choice group and accepts any of above attributes as
options. A choice can only be of type bool or tristate, while a boolean
choice only allows a single config entry to be selected, a tristate
choice also allows any number of config entries to be set to 'm'. This
can be used if multiple drivers for a single hardware exists and only a
single driver can be compiled/loaded into the kernel, but all drivers
can be compiled as modules.
A choice accepts another option "optional", which allows to set the
choice to 'n' and no entry needs to be selected.
comment:
"comment" <prompt>
<comment options>
This defines a comment which is displayed to the user during the
configuration process and is also echoed to the output files. The only
possible options are dependencies.
menu:
"menu" <prompt>
<menu options>
<menu block>
"endmenu"
This defines a menu block, see "Menu structure" above for more
information. The only possible options are dependencies.
if:
"if" <expr>
<if block>
"endif"
This defines an if block. The dependency expression <expr> is appended
to all enclosed menu entries.
source:
"source" <prompt>
This reads the specified configuration file. This file is always parsed.

5
menu/LICENSE.txt Normal file
View file

@ -0,0 +1,5 @@
Copyright (c) 2011-2019, Ulf Magnusson <ulfalizer@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -1,145 +0,0 @@
# Makefile for BusyBox
#
# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
# Modified by George Boudreau georgeb@LinuxFromScratch.org
top_srcdir=.
top_builddir=.
srcdir=$(top_srcdir)
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
LC_ALL:= C
SED ?= sed
SECHO := @-false
DISP := pur
Q := @
show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
pur_disp_compile.h = echo " "HOSTCC $(show_objs)
disp_compile.h = $($(DISP)_disp_compile.h)
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
all: ncurses conf mconf
ifeq ($(shell uname),SunOS)
LIBS = -lcurses
else
LIBS = -lncurses
endif
ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
else
ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
else
ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
else
ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
else
ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
else
HOSTNCURSES += -DCURSES_LOC="<curses.h>"
endif
endif
endif
endif
endif
ifeq (/usr/include/locale.h, $(wildcard /usr/include/locale.h))
HOSTNCURSES += -DLOCALE=1
endif
CONF_SRC = conf.c
MCONF_SRC = mconf.c
LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
lxdialog/msgbox.c
SHARED_SRC = zconf.tab.c
SHARED_DEPS := $(srcdir)/lkc.h $(srcdir)/lkc_proto.h \
lkc_defs.h $(srcdir)/expr.h zconf.tab.h
CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC))
MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
conf: $(CONF_OBJS) $(SHARED_OBJS)
$(SECHO) " "HOSTCC $@ ; true
$(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
mconf: $(MCONF_OBJS) $(SHARED_OBJS)
$(SECHO) " "HOSTCC $@ ; true
$(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
$(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
$(compile.h) -I.
$(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
@[ -d $(@D) ] || mkdir $(@D)
$(compile.h) $(HOSTNCURSES) -I.
lkc_defs.h: $(srcdir)/lkc_proto.h
@$(SED) < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
###
# The following requires flex/bison
# By default we use the _shipped versions, uncomment the
# following line if you are modifying the flex/bison src.
#LKC_GENPARSER := 1
ifdef LKC_GENPARSER
%.tab.c %.tab.h: $(srcdir)/%.y
bison -t -d -v -b $* -p $(notdir $*) $<
lex.%.c: $(srcdir)/%.l
flex -P$(notdir $*) -o$@ $<
else
lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
$(compile.h) -I$(srcdir)
lex.zconf.c: $(srcdir)/lex.zconf.c_shipped
$(Q)cp $< $@
zconf.tab.c: $(srcdir)/zconf.tab.c_shipped
$(Q)cp $< $@
zconf.tab.h: $(srcdir)/zconf.tab.h_shipped
$(Q)cp $< $@
endif
zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \
$(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS)
$(compile.h) -I$(srcdir) -I.
.PHONY: ncurses
ncurses:
@echo "int main() {}" > lxtemp.c
@if $(HOSTCC) lxtemp.c $(LIBS) ; then \
rm -f lxtemp.c a.out; \
else \
rm -f lxtemp.c; \
echo -e "\007" ;\
echo ">> Unable to find the Ncurses libraries." ;\
echo ">>" ;\
echo ">> You must have Ncurses installed in order" ;\
echo ">> to use 'make menuconfig'" ;\
echo ;\
exit 1 ;\
fi
clean:
rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h

4
menu/README Normal file
View file

@ -0,0 +1,4 @@
The files in this directory come from
https://github.com/ulfalizer/Kconfiglib.git
They are subjected to the ISC license.
See the file LICENSE.txt

View file

@ -1,571 +0,0 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
static void conf(struct menu *menu);
static void check_conf(struct menu *menu);
enum {
ask_all,
ask_new,
ask_silent,
set_default,
set_yes,
set_mod,
set_no,
set_random
} input_mode = ask_all;
char *defconfig_file;
static int indent = 1;
static int valid_stdin = 1;
static int conf_cnt;
static char line[128];
static struct menu *rootEntry;
static char nohelp_text[] = "Sorry, no help available for this option yet.\n";
static void strip(char *str)
{
char *p = str;
int l;
while ((isspace(*p)))
p++;
l = strlen(p);
if (p != str)
memmove(str, p, l + 1);
if (!l)
return;
p = str + l - 1;
while ((isspace(*p)))
*p-- = 0;
}
static void check_stdin(void)
{
if (!valid_stdin && input_mode == ask_silent) {
printf("aborted!\n\n");
printf("Console input/output is redirected. ");
printf("Run 'make oldconfig' to update configuration.\n\n");
exit(1);
}
}
static void conf_askvalue(struct symbol *sym, const char *def)
{
enum symbol_type type = sym_get_type(sym);
tristate val;
if (!sym_has_value(sym))
printf("(NEW) ");
line[0] = '\n';
line[1] = 0;
if (!sym_is_changable(sym)) {
printf("%s\n", def);
line[0] = '\n';
line[1] = 0;
return;
}
switch (input_mode) {
case ask_new:
case ask_silent:
if (sym_has_value(sym)) {
printf("%s\n", def);
return;
}
check_stdin();
case ask_all:
fflush(stdout);
fgets(line, 128, stdin);
return;
case set_default:
printf("%s\n", def);
return;
default:
break;
}
switch (type) {
case S_INT:
case S_HEX:
case S_STRING:
printf("%s\n", def);
return;
default:
;
}
switch (input_mode) {
case set_yes:
if (sym_tristate_within_range(sym, yes)) {
line[0] = 'y';
line[1] = '\n';
line[2] = 0;
break;
}
case set_mod:
if (type == S_TRISTATE) {
if (sym_tristate_within_range(sym, mod)) {
line[0] = 'm';
line[1] = '\n';
line[2] = 0;
break;
}
} else {
if (sym_tristate_within_range(sym, yes)) {
line[0] = 'y';
line[1] = '\n';
line[2] = 0;
break;
}
}
case set_no:
if (sym_tristate_within_range(sym, no)) {
line[0] = 'n';
line[1] = '\n';
line[2] = 0;
break;
}
case set_random:
do {
val = (tristate)(random() % 3);
} while (!sym_tristate_within_range(sym, val));
switch (val) {
case no: line[0] = 'n'; break;
case mod: line[0] = 'm'; break;
case yes: line[0] = 'y'; break;
}
line[1] = '\n';
line[2] = 0;
break;
default:
break;
}
printf("%s", line);
}
int conf_string(struct menu *menu)
{
struct symbol *sym = menu->sym;
const char *def, *help;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
printf("(%s) ", sym->name);
def = sym_get_string_value(sym);
if (sym_get_string_value(sym))
printf("[%s] ", def);
conf_askvalue(sym, def);
switch (line[0]) {
case '\n':
break;
case '?':
/* print help */
if (line[1] == '\n') {
help = nohelp_text;
if (menu->sym->help)
help = menu->sym->help;
printf("\n%s\n", help);
def = NULL;
break;
}
default:
line[strlen(line)-1] = 0;
def = line;
}
if (def && sym_set_string_value(sym, def))
return 0;
}
}
static int conf_sym(struct menu *menu)
{
struct symbol *sym = menu->sym;
tristate oldval, newval;
const char *help;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
if (sym->name)
printf("(%s) ", sym->name);
(void)sym_get_type(sym);
putchar('[');
oldval = sym_get_tristate_value(sym);
switch (oldval) {
case no:
putchar('N');
break;
case mod:
putchar('M');
break;
case yes:
putchar('Y');
break;
}
if (oldval != no && sym_tristate_within_range(sym, no))
printf("/n");
if (oldval != mod && sym_tristate_within_range(sym, mod))
printf("/m");
if (oldval != yes && sym_tristate_within_range(sym, yes))
printf("/y");
if (sym->help)
printf("/?");
printf("] ");
conf_askvalue(sym, sym_get_string_value(sym));
strip(line);
switch (line[0]) {
case 'n':
case 'N':
newval = no;
if (!line[1] || !strcmp(&line[1], "o"))
break;
continue;
case 'm':
case 'M':
newval = mod;
if (!line[1])
break;
continue;
case 'y':
case 'Y':
newval = yes;
if (!line[1] || !strcmp(&line[1], "es"))
break;
continue;
case 0:
newval = oldval;
break;
case '?':
goto help;
default:
continue;
}
if (sym_set_tristate_value(sym, newval))
return 0;
help:
help = nohelp_text;
if (sym->help)
help = sym->help;
printf("\n%s\n", help);
}
}
static int conf_choice(struct menu *menu)
{
struct symbol *sym, *def_sym;
struct menu *child;
bool is_new;
sym = menu->sym;
(void)sym_get_type(sym);
is_new = !sym_has_value(sym);
if (sym_is_changable(sym)) {
conf_sym(menu);
sym_calc_value(sym);
switch (sym_get_tristate_value(sym)) {
case no:
return 1;
case mod:
return 0;
case yes:
break;
}
} else {
switch (sym_get_tristate_value(sym)) {
case no:
return 1;
case mod:
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
return 0;
case yes:
break;
}
}
while (1) {
int cnt, def;
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
def_sym = sym_get_choice_value(sym);
cnt = def = 0;
line[0] = '0';
line[1] = 0;
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
if (!child->sym) {
printf("%*c %s\n", indent, '*', menu_get_prompt(child));
continue;
}
cnt++;
if (child->sym == def_sym) {
def = cnt;
printf("%*c", indent, '>');
} else
printf("%*c", indent, ' ');
printf(" %d. %s", cnt, menu_get_prompt(child));
if (child->sym->name)
printf(" (%s)", child->sym->name);
if (!sym_has_value(child->sym))
printf(" (NEW)");
printf("\n");
}
printf("%*schoice", indent - 1, "");
if (cnt == 1) {
printf("[1]: 1\n");
goto conf_childs;
}
printf("[1-%d", cnt);
if (sym->help)
printf("?");
printf("]: ");
switch (input_mode) {
case ask_new:
case ask_silent:
if (!is_new) {
cnt = def;
printf("%d\n", cnt);
break;
}
check_stdin();
case ask_all:
fflush(stdout);
fgets(line, 128, stdin);
strip(line);
if (line[0] == '?') {
printf("\n%s\n", menu->sym->help ?
menu->sym->help : nohelp_text);
continue;
}
if (!line[0])
cnt = def;
else if (isdigit(line[0]))
cnt = atoi(line);
else
continue;
break;
case set_random:
def = (random() % cnt) + 1;
case set_default:
case set_yes:
case set_mod:
case set_no:
cnt = def;
printf("%d\n", cnt);
break;
}
conf_childs:
for (child = menu->list; child; child = child->next) {
if (!child->sym || !menu_is_visible(child))
continue;
if (!--cnt)
break;
}
if (!child)
continue;
if (line[strlen(line) - 1] == '?') {
printf("\n%s\n", child->sym->help ?
child->sym->help : nohelp_text);
continue;
}
sym_set_choice_value(sym, child->sym);
if (child->list) {
indent += 2;
conf(child->list);
indent -= 2;
}
return 1;
}
}
static void conf(struct menu *menu)
{
struct symbol *sym;
struct property *prop;
struct menu *child;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
prop = menu->prompt;
if (prop) {
const char *prompt;
switch (prop->type) {
case P_MENU:
if (input_mode == ask_silent && rootEntry != menu) {
check_conf(menu);
return;
}
case P_COMMENT:
prompt = menu_get_prompt(menu);
if (prompt)
printf("%*c\n%*c %s\n%*c\n",
indent, '*',
indent, '*', prompt,
indent, '*');
default:
;
}
}
if (!sym)
goto conf_childs;
if (sym_is_choice(sym)) {
conf_choice(menu);
if (sym->curr.tri != mod)
return;
goto conf_childs;
}
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
conf_string(menu);
break;
default:
conf_sym(menu);
break;
}
conf_childs:
if (sym)
indent += 2;
for (child = menu->list; child; child = child->next)
conf(child);
if (sym)
indent -= 2;
}
static void check_conf(struct menu *menu)
{
struct symbol *sym;
struct menu *child;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
if (sym) {
if (sym_is_changable(sym) && !sym_has_value(sym)) {
if (!conf_cnt++)
printf("*\n* Restart config...\n*\n");
rootEntry = menu_get_parent_menu(menu);
conf(rootEntry);
}
if (sym_is_choice(sym) && sym_get_tristate_value(sym) != mod)
return;
}
for (child = menu->list; child; child = child->next)
check_conf(child);
}
int main(int ac, char **av)
{
int i = 1;
const char *name;
struct stat tmpstat;
if (ac > i && av[i][0] == '-') {
switch (av[i++][1]) {
case 'o':
input_mode = ask_new;
break;
case 's':
input_mode = ask_silent;
valid_stdin = isatty(0) && isatty(1) && isatty(2);
break;
case 'd':
input_mode = set_default;
break;
case 'D':
input_mode = set_default;
defconfig_file = av[i++];
if (!defconfig_file) {
printf("%s: No default config file specified\n",
av[0]);
exit(1);
}
break;
case 'n':
input_mode = set_no;
break;
case 'm':
input_mode = set_mod;
break;
case 'y':
input_mode = set_yes;
break;
case 'r':
input_mode = set_random;
srandom(time(NULL));
break;
case 'h':
case '?':
printf("%s [-o|-s] config\n", av[0]);
exit(0);
}
}
name = av[i];
if (!name) {
printf("%s: configuration file missing\n", av[0]);
}
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
case ask_silent:
if (stat(".config", &tmpstat)) {
printf("***\n"
"*** You have not yet configured JHALFS!\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make config\").\n"
"***\n");
exit(1);
}
case ask_all:
case ask_new:
conf_read(NULL);
break;
default:
break;
}
if (input_mode != ask_silent) {
rootEntry = &rootmenu;
conf(&rootmenu);
if (input_mode == ask_all) {
input_mode = ask_silent;
valid_stdin = 1;
}
}
do {
conf_cnt = 0;
check_conf(&rootmenu);
} while (conf_cnt);
if (conf_write(NULL)) {
fprintf(stderr, "\n*** Error during writing of the JHALFS configuration.\n\n");
return 1;
}
return 0;
}

View file

@ -1,392 +0,0 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
const char conf_def_filename[] = "configuration";
const char conf_defname[] = "defconfig";
const char *conf_confnames[] = {
"configuration",
conf_defname,
NULL,
};
static char *conf_expand_value(const char *in)
{
struct symbol *sym;
const char *src;
static char res_value[SYMBOL_MAXLENGTH];
char *dst, name[SYMBOL_MAXLENGTH];
res_value[0] = 0;
dst = name;
while ((src = strchr(in, '$'))) {
strncat(res_value, in, src - in);
src++;
dst = name;
while (isalnum(*src) || *src == '_')
*dst++ = *src++;
*dst = 0;
sym = sym_lookup(name, 0);
sym_calc_value(sym);
strcat(res_value, sym_get_string_value(sym));
in = src;
}
strcat(res_value, in);
return res_value;
}
int conf_read(const char *name)
{
FILE *in = NULL;
char line[1024];
char *p, *p2;
int lineno = 0;
struct symbol *sym;
struct property *prop;
struct expr *e;
int i;
if (name) {
in = zconf_fopen(name);
} else {
const char **names = conf_confnames;
while ((name = *names++)) {
name = conf_expand_value(name);
in = zconf_fopen(name);
if (in) {
printf("#\n"
"# using defaults found in %s\n"
"#\n", name);
break;
}
}
}
if (!in)
return 1;
for_all_symbols(i, sym) {
sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED;
sym->flags &= ~SYMBOL_VALID;
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
free(sym->user.val);
default:
sym->user.val = NULL;
sym->user.tri = no;
}
}
while (fgets(line, sizeof(line), in)) {
lineno++;
sym = NULL;
switch (line[0]) {
case '#':
if (line[1]!=' ')
continue;
p = strchr(line + 2, ' ');
if (!p)
continue;
*p++ = 0;
if (strncmp(p, "is not set", 10))
continue;
sym = sym_find(line + 2);
if (!sym) {
fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 2);
break;
}
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
sym->user.tri = no;
sym->flags &= ~SYMBOL_NEW;
break;
default:
;
}
break;
case 'A' ... 'Z':
p = strchr(line, '=');
if (!p)
continue;
*p++ = 0;
p2 = strchr(p, '\n');
if (p2)
*p2 = 0;
sym = sym_find(line);
if (!sym) {
fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line);
break;
}
switch (sym->type) {
case S_TRISTATE:
if (p[0] == 'm') {
sym->user.tri = mod;
sym->flags &= ~SYMBOL_NEW;
break;
}
case S_BOOLEAN:
if (p[0] == 'y') {
sym->user.tri = yes;
sym->flags &= ~SYMBOL_NEW;
break;
}
if (p[0] == 'n') {
sym->user.tri = no;
sym->flags &= ~SYMBOL_NEW;
break;
}
break;
case S_STRING:
if (*p++ != '"')
break;
for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
if (*p2 == '"') {
*p2 = 0;
break;
}
memmove(p2, p2 + 1, strlen(p2));
}
if (!p2) {
fprintf(stderr, "%s:%d: invalid string found\n", name, lineno);
exit(1);
}
case S_INT:
case S_HEX:
if (sym_string_valid(sym, p)) {
sym->user.val = strdup(p);
sym->flags &= ~SYMBOL_NEW;
} else {
fprintf(stderr, "%s:%d: symbol value '%s' invalid for %s\n", name, lineno, p, sym->name);
exit(1);
}
break;
default:
;
}
break;
case '\n':
break;
default:
continue;
}
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->user.tri) {
case no:
break;
case mod:
if (cs->user.tri == yes)
/* warn? */;
break;
case yes:
if (cs->user.tri != no)
/* warn? */;
cs->user.val = sym;
break;
}
cs->user.tri = E_OR(cs->user.tri, sym->user.tri);
cs->flags &= ~SYMBOL_NEW;
}
}
fclose(in);
if (modules_sym)
sym_calc_value(modules_sym);
for_all_symbols(i, sym) {
sym_calc_value(sym);
if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
if (sym->visible == no)
sym->flags |= SYMBOL_NEW;
switch (sym->type) {
case S_STRING:
case S_INT:
case S_HEX:
if (!sym_string_within_range(sym, sym->user.val))
sym->flags |= SYMBOL_NEW;
default:
break;
}
}
if (!sym_is_choice(sym))
continue;
prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr)
if (e->right.sym->visible != no)
sym->flags |= e->right.sym->flags & SYMBOL_NEW;
}
sym_change_count = 1;
return 0;
}
struct menu *next_menu(struct menu *menu)
{
if (menu->list) return menu->list;
do {
if (menu->next) {
menu = menu->next;
break;
}
} while ((menu = menu->parent));
return menu;
}
#define SYMBOL_FORCEWRITE (1<<31)
int conf_write(const char *name)
{
FILE *out;
struct symbol *sym;
struct menu *menu;
const char *basename;
char dirname[128], tmpname[128], newname[128];
int type, l;
const char *str;
dirname[0] = 0;
if (name && name[0]) {
struct stat st;
char *slash;
if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
strcpy(dirname, name);
strcat(dirname, "/");
basename = conf_def_filename;
} else if ((slash = strrchr(name, '/'))) {
int size = slash - name + 1;
memcpy(dirname, name, size);
dirname[size] = 0;
if (slash[1])
basename = slash + 1;
else
basename = conf_def_filename;
} else
basename = name;
} else
basename = conf_def_filename;
sprintf(newname, "%s.tmpconfig.%d", dirname, (int)getpid());
out = fopen(newname, "w");
if (!out)
return 1;
fprintf(out, "#\n"
"# Automatically generated configuration: don't edit\n"
"# use make menuconfig or make config to make changes\n"
"#\n");
if (!sym_change_count)
sym_clear_all_valid();
/* Force write of all non-duplicate symbols. */
/* Write out everything by default. */
for(menu = rootmenu.list; menu; menu = next_menu(menu))
if (menu->sym) menu->sym->flags |= SYMBOL_FORCEWRITE;
menu = rootmenu.list;
while (menu) {
sym = menu->sym;
if (!sym) {
if (!menu_is_visible(menu))
goto next;
str = menu_get_prompt(menu);
fprintf(out, "\n"
"#\n"
"# %s\n"
"#\n", str);
} else if (!(sym->flags & SYMBOL_CHOICE)) {
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_FORCEWRITE))
goto next;
sym->flags &= ~SYMBOL_FORCEWRITE;
type = sym->type;
if (type == S_TRISTATE) {
sym_calc_value(modules_sym);
if (modules_sym->curr.tri == no)
type = S_BOOLEAN;
}
switch (type) {
case S_BOOLEAN:
case S_TRISTATE:
switch (sym_get_tristate_value(sym)) {
case no:
fprintf(out, "# %s is not set\n", sym->name);
break;
case mod:
fprintf(out, "%s=m\n", sym->name);
break;
case yes:
fprintf(out, "%s=y\n", sym->name);
break;
}
break;
case S_STRING:
// fix me
str = sym_get_string_value(sym);
fprintf(out, "%s=\"", sym->name);
do {
l = strcspn(str, "\"\\");
if (l) {
fwrite(str, l, 1, out);
}
str += l;
while (*str == '\\' || *str == '"') {
fprintf(out, "\\%c", *str);
str++;
}
} while (*str);
fputs("\"\n", out);
break;
case S_HEX:
str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
fprintf(out, "%s=%s\n", sym->name, *str ? str : "0");
break;
}
case S_INT:
str = sym_get_string_value(sym);
fprintf(out, "%s=%s\n", sym->name, *str ? str : "0");
break;
}
}
next:
menu = next_menu(menu);
}
fclose(out);
if (!name || basename != conf_def_filename) {
if (!name)
name = conf_def_filename;
sprintf(tmpname, "%s.old", name);
rename(name, tmpname);
}
sprintf(tmpname, "%s%s", dirname, basename);
if (rename(newname, tmpname))
return 1;
sym_change_count = 0;
return 0;
}

File diff suppressed because it is too large Load diff

View file

@ -1,195 +0,0 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#ifndef EXPR_H
#define EXPR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif
struct file {
struct file *next;
struct file *parent;
char *name;
int lineno;
int flags;
};
#define FILE_BUSY 0x0001
#define FILE_SCANNED 0x0002
#define FILE_PRINTED 0x0004
typedef enum tristate {
no, mod, yes
} tristate;
enum expr_type {
E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE
};
union expr_data {
struct expr *expr;
struct symbol *sym;
};
struct expr {
enum expr_type type;
union expr_data left, right;
};
#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define E_NOT(dep) (2-(dep))
struct expr_value {
struct expr *expr;
tristate tri;
};
struct symbol_value {
void *val;
tristate tri;
};
enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
};
struct symbol {
struct symbol *next;
char *name;
char *help;
enum symbol_type type;
struct symbol_value curr, user;
tristate visible;
int flags;
struct property *prop;
struct expr *dep, *dep2;
struct expr_value rev_dep;
};
#define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#define SYMBOL_YES 0x0001
#define SYMBOL_MOD 0x0002
#define SYMBOL_NO 0x0004
#define SYMBOL_CONST 0x0007
#define SYMBOL_CHECK 0x0008
#define SYMBOL_CHOICE 0x0010
#define SYMBOL_CHOICEVAL 0x0020
#define SYMBOL_PRINTED 0x0040
#define SYMBOL_VALID 0x0080
#define SYMBOL_OPTIONAL 0x0100
#define SYMBOL_WRITE 0x0200
#define SYMBOL_CHANGED 0x0400
#define SYMBOL_NEW 0x0800
#define SYMBOL_AUTO 0x1000
#define SYMBOL_CHECKED 0x2000
#define SYMBOL_CHECK_DONE 0x4000
#define SYMBOL_WARNED 0x8000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 257
#define SYMBOL_HASHMASK 0xff
enum prop_type {
P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE
};
struct property {
struct property *next;
struct symbol *sym;
enum prop_type type;
const char *text;
struct expr_value visible;
struct expr *expr;
struct menu *menu;
struct file *file;
int lineno;
};
#define for_all_properties(sym, st, tok) \
for (st = sym->prop; st; st = st->next) \
if (st->type == (tok))
#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
#define for_all_prompts(sym, st) \
for (st = sym->prop; st; st = st->next) \
if (st->text)
struct menu {
struct menu *next;
struct menu *parent;
struct menu *list;
struct symbol *sym;
struct property *prompt;
struct expr *dep;
unsigned int flags;
//char *help;
struct file *file;
int lineno;
void *data;
};
#define MENU_CHANGED 0x0001
#define MENU_ROOT 0x0002
#ifndef SWIG
extern struct file *file_list;
extern struct file *current_file;
struct file *lookup_file(const char *name);
extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern int cdebug;
struct expr *expr_alloc_symbol(struct symbol *sym);
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(struct expr *org);
void expr_free(struct expr *e);
int expr_eq(struct expr *e1, struct expr *e2);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
tristate expr_calc_value(struct expr *e);
struct expr *expr_eliminate_yn(struct expr *e);
struct expr *expr_trans_bool(struct expr *e);
struct expr *expr_eliminate_dups(struct expr *e);
struct expr *expr_transform(struct expr *e);
int expr_contains_symbol(struct expr *dep, struct symbol *sym);
bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
void expr_gstr_print(struct expr *e, struct gstr *gs);
static inline int expr_is_yes(struct expr *e)
{
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
}
static inline int expr_is_no(struct expr *e)
{
return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* EXPR_H */

Some files were not shown because too many files have changed in this diff Show more