Compare commits
493 commits
new_featur
...
mihari-dev
Author | SHA1 | Date | |
---|---|---|---|
|
41e5e3f5d8 | ||
|
35094eda67 | ||
|
cd87e527fe | ||
|
6ffc37b902 | ||
|
10756d05d7 | ||
|
9440e4ac61 | ||
|
bc64795e63 | ||
|
824efcac1c | ||
|
c1f02f262e | ||
|
05b955b62c | ||
|
23b0161d6c | ||
|
c5f4ef3d5e | ||
|
67ca47e5f8 | ||
|
924076f0b5 | ||
|
04a608ba8e | ||
|
a9360e10a7 | ||
|
da4bce358d | ||
|
d18fc24d5b | ||
|
078ef3cf12 | ||
|
249d4ade20 | ||
|
09ac7fc548 | ||
|
cff36a77ba | ||
|
8e9343b632 | ||
|
640cd5746b | ||
|
cacc6c5433 | ||
|
63190e6547 | ||
|
3c43655ec6 | ||
|
645ec4780e | ||
|
1352172467 | ||
|
5ed69f823f | ||
|
6d9bd8e8e8 | ||
|
1c22535b2e | ||
|
9a89ba79de | ||
|
c552eabe63 | ||
|
200cc0151e | ||
|
aceacf2f85 | ||
|
74601a7f06 | ||
|
1b02a9acff | ||
|
3b27f93764 | ||
|
06b731490f | ||
|
45f82b1326 | ||
|
08614168ec | ||
|
9eb3dbe1c4 | ||
|
4ba94ad556 | ||
|
78d04f3f79 | ||
|
c18186f031 | ||
|
c463f10a88 | ||
|
4978d4d7f6 | ||
|
a2598ef89f | ||
|
a23b5e3116 | ||
|
23be80624c | ||
|
cd1fa118f5 | ||
|
22eb3171ad | ||
|
f6e9ef2fac | ||
|
adf818b9b3 | ||
|
72711ab1cd | ||
|
4dfe8f99c4 | ||
|
1bf09c15a7 | ||
|
42dfc6ef21 | ||
|
dedd502636 | ||
|
0a1943912e | ||
|
3fa4147515 | ||
|
6ac0d96300 | ||
|
24ad4fd4f4 | ||
|
e98162dfb2 | ||
|
4fdf9f301e | ||
|
93b6920dbf | ||
|
5126ee3663 | ||
|
3940a45db3 | ||
|
b39eb29be5 | ||
|
5c8df43896 | ||
|
951d334793 | ||
|
33ee66c69e | ||
|
0f4df7ccfd | ||
|
ed335a3113 | ||
|
35f6261ab5 | ||
|
fd90f80466 | ||
|
262e174aa1 | ||
|
3722d3164c | ||
|
87eb9e9a94 | ||
|
8bcaf0d58b | ||
|
e181f757ba | ||
|
5156f51859 | ||
|
875366f635 | ||
|
594ff3d878 | ||
|
29615d9e3a | ||
|
316d06039f | ||
|
d54e3c9856 | ||
|
ff30640702 | ||
|
55e82d2ae0 | ||
|
84d0d39a97 | ||
|
93814d176b | ||
|
82ddba94a3 | ||
|
f32cd505a8 | ||
|
d3dbebe625 | ||
|
86debb00ea | ||
|
28ef51b817 | ||
|
6df52e8417 | ||
|
dc53def3ee | ||
|
88e5cbc258 | ||
|
924a237843 | ||
|
9b99adace9 | ||
|
30a444a477 | ||
|
8c2b505caf | ||
|
a2917edfa2 | ||
|
2bf44e2724 | ||
|
2c1a763990 | ||
|
1242857a75 | ||
|
3e82b0bd81 | ||
|
8825e69592 | ||
|
2bd2fb81d0 | ||
|
2fd624d8f6 | ||
|
9f89fae89a | ||
|
f45af2ca4d | ||
|
62206d62a3 | ||
|
48700c348f | ||
|
c412a07545 | ||
|
327a3ee7ba | ||
|
9a86aa588e | ||
|
0fa52f2403 | ||
|
4c36783ec4 | ||
|
7f25c704ed | ||
|
9d665db456 | ||
|
e3f41e33d5 | ||
|
16cef03acf | ||
|
978286a4b9 | ||
|
3faf067c44 | ||
|
03b24b2a45 | ||
|
0f3b1c317c | ||
|
2e35653630 | ||
|
20051e00f7 | ||
|
abadee36de | ||
|
f81d8bdb6f | ||
|
141d072bf6 | ||
|
a78cfc961e | ||
|
e0bbc6e6ac | ||
|
bbabe74e15 | ||
|
b734bfb4c6 | ||
|
ff5c301860 | ||
|
dd9ca56bd2 | ||
|
7ae97740a8 | ||
|
b8e5cad4c0 | ||
|
a6fbc65357 | ||
|
f9a7f8ec34 | ||
|
0870a7cfdb | ||
|
837362b50f | ||
|
e57e0291c3 | ||
|
5e1d9dd5d4 | ||
|
a690d42f88 | ||
|
1fc36f5654 | ||
|
5132b9373d | ||
|
794f94f85e | ||
|
eec87dbd1f | ||
|
1870b56894 | ||
|
0495e57e0a | ||
|
267b19da59 | ||
|
b0965faf0d | ||
|
5fd1a98625 | ||
|
0a93085f84 | ||
|
9daa202654 | ||
|
60e539b9fc | ||
|
2b3edd2e77 | ||
|
f756851d45 | ||
|
e25788e846 | ||
|
610a5c4a0e | ||
|
59c4761950 | ||
|
fd4a7982f2 | ||
|
240d928d23 | ||
|
59a1e1add9 | ||
|
d5413a91a1 | ||
|
50cf934f51 | ||
|
ee96ad26f9 | ||
|
4c32ca80bd | ||
|
2718053f55 | ||
|
2257bd71b7 | ||
|
e22aa9615e | ||
|
840b9ba06e | ||
|
b5d1c50492 | ||
|
e68c306380 | ||
|
52cced4e53 | ||
|
22abf3706e | ||
|
33a4e41462 | ||
|
756863be9b | ||
|
c1060c9add | ||
|
df5553b1f3 | ||
|
bcae37dc8b | ||
|
97b270f9bd | ||
|
106157fdae | ||
|
0722dde31d | ||
|
cfdb089dcf | ||
|
894eec328d | ||
|
203e4c2697 | ||
|
380c2c619a | ||
|
34c47bef04 | ||
|
605ea3628b | ||
|
1318902ce8 | ||
|
7a10c525bc | ||
|
2ac2fc50b9 | ||
|
4ed4a3244d | ||
|
b3825c3eb8 | ||
|
dfab075401 | ||
|
de67016950 | ||
|
dd5d63d102 | ||
|
f538085157 | ||
|
fbbe081243 | ||
|
1e686d17a4 | ||
|
38dd3c3d74 | ||
|
82eacf52a5 | ||
|
47dfc81bdc | ||
|
c2af9cd73f | ||
|
e5518fd03e | ||
|
f9babd04b5 | ||
|
782a77b2c4 | ||
|
ea0be93e9e | ||
|
018ab000f3 | ||
|
5562bf14e0 | ||
|
088130f04a | ||
|
426e40be67 | ||
|
7ce5a6195f | ||
|
bfc99d1f9f | ||
|
2873df61d7 | ||
|
56c1fff69a | ||
|
a8b8d192eb | ||
|
f7c6c3c108 | ||
|
7e9e66faa4 | ||
|
6f74ca146f | ||
|
8b85dae454 | ||
|
e3ccc2786a | ||
|
88a8275eb8 | ||
|
46c6113b28 | ||
|
ee842e234b | ||
|
3484658167 | ||
|
b6e981a9a3 | ||
|
f017b22731 | ||
|
2f8d952deb | ||
|
89bcb1be0e | ||
|
3ac3ae199f | ||
|
5dd7bff0ee | ||
|
5a965adf4f | ||
|
959319749e | ||
|
d5a739aebd | ||
|
49f8b03399 | ||
|
13e52a5572 | ||
|
706e5bf46a | ||
|
7b33f40896 | ||
|
9a4c530f55 | ||
|
0a0753d579 | ||
|
e4b7aa8206 | ||
|
cce9c165cd | ||
|
3da8c49659 | ||
|
b33c6ee52d | ||
|
b217a303e4 | ||
|
22bb166d9d | ||
|
6447575192 | ||
|
ebe1ba613c | ||
|
36f5dce727 | ||
|
9ef12f76bb | ||
|
7e0a1b8018 | ||
|
6caa5b8816 | ||
|
9728b235e6 | ||
|
a26389abd0 | ||
|
323ae3e633 | ||
|
ae1d8a5b59 | ||
|
38016d5ca7 | ||
|
f5ecc2838a | ||
|
06eddf40f2 | ||
|
31a9b1440c | ||
|
bdb0761120 | ||
|
709eb7470d | ||
|
49e2745200 | ||
|
dd7e0f6793 | ||
|
7b7b5e9624 | ||
|
0a577f5575 | ||
|
0835a1065f | ||
|
a73ed74337 | ||
|
a2b56892e4 | ||
|
04de9bc4db | ||
|
3261fe76c8 | ||
|
4762fb9900 | ||
|
903eefd093 | ||
|
939731aa52 | ||
|
123105f683 | ||
|
1dce18968f | ||
|
a131250b6f | ||
|
5e4a124e3d | ||
|
20e3fcdec2 | ||
|
2a9b0c3181 | ||
|
94fc75e616 | ||
|
c035132e2a | ||
|
9a61eadbbf | ||
|
fcb78f4822 | ||
|
2d99aa4bb3 | ||
|
a30c80e273 | ||
|
4ad6e44878 | ||
|
654f592149 | ||
|
a1795f0351 | ||
|
0974c32271 | ||
|
39304601fe | ||
|
0336215926 | ||
|
085435e66f | ||
|
91b5249f05 | ||
|
974fe35ae0 | ||
|
30732c6a16 | ||
|
0a0b60984c | ||
|
96d7e44922 | ||
|
c9928765ae | ||
|
8fc6a47249 | ||
|
7933ed76c6 | ||
|
5451eaeb9e | ||
|
3b14992061 | ||
|
30a89617c4 | ||
|
6622409404 | ||
|
a4af6811bd | ||
|
cf2f109b89 | ||
|
619b313adb | ||
|
77a8042414 | ||
|
2c603d8caf | ||
|
f596dde66c | ||
|
7fa93699d4 | ||
|
183cc33453 | ||
|
72e9e684e7 | ||
|
aeb8539125 | ||
|
dfc023a13c | ||
|
a22bfe1ab5 | ||
|
8589e90f5c | ||
|
8fb8ff2612 | ||
|
aa283c0dee | ||
|
2e2ac742c7 | ||
|
c048987a2c | ||
|
bc2f5913e6 | ||
|
0e4ddfa0c1 | ||
|
2758d9421e | ||
|
adbd09b06c | ||
|
eabfc593e5 | ||
|
05f3977323 | ||
|
3142368d67 | ||
|
c6506aea23 | ||
|
a659e46082 | ||
|
13c475babc | ||
|
49ba78d711 | ||
|
f5e658dc6c | ||
|
426c618053 | ||
|
3b43e17bda | ||
|
90f5b6de2e | ||
|
5af9ab4b8c | ||
|
d39252b7ca | ||
|
399058f718 | ||
|
7a821947ad | ||
|
cd02aa5ad9 | ||
|
b71e3adb60 | ||
|
d505128fbc | ||
|
f168be19d5 | ||
|
04fcea11b7 | ||
|
c8d5f11878 | ||
|
94a78ddfa2 | ||
|
1646303d91 | ||
|
6e28f3c4de | ||
|
625cb147bd | ||
|
3b4399c962 | ||
|
b86dfaf1c0 | ||
|
6747d510ed | ||
|
2b67b9ba4d | ||
|
2969cdfb6b | ||
|
0d1c9f0ce1 | ||
|
eb5a32de85 | ||
|
b25dbcf791 | ||
|
5c69841844 | ||
|
8fb1daade2 | ||
|
e030049a44 | ||
|
df1f318915 | ||
|
9e0c4b6a3a | ||
|
28546ae95d | ||
|
7bc70cd968 | ||
|
67c3df4aef | ||
|
ad747edfb0 | ||
|
6613034d13 | ||
|
1cb4c7662c | ||
|
4696ddd406 | ||
|
bcbecc53f9 | ||
|
b7583ec500 | ||
|
c7b535b488 | ||
|
f1edc8e377 | ||
|
d80302bf94 | ||
|
59afe7323a | ||
|
5afaf7cc48 | ||
|
1fa0dee15b | ||
|
2140f22a88 | ||
|
764a5d712c | ||
|
84a3fda1c3 | ||
|
d2a7ec8984 | ||
|
2e1c1c3c16 | ||
|
dc7fd7b7ba | ||
|
5637b53ba7 | ||
|
c672fa87d7 | ||
|
5a8939e7f9 | ||
|
489bdc21d1 | ||
|
1d5f3e309f | ||
|
4b2a5fd304 | ||
|
0d93997796 | ||
|
ce99eb609b | ||
|
e6ed1a1de7 | ||
|
9556f88088 | ||
|
fb63ddff14 | ||
|
7a0c3d2128 | ||
|
87405299a9 | ||
|
b2fa9e83de | ||
|
d0d4181726 | ||
|
711b98e84e | ||
|
e674994435 | ||
|
6c8095a04f | ||
|
ca37fee8d7 | ||
|
ee68aee4b1 | ||
|
91e8eaa0b0 | ||
|
e3f4b9a4c1 | ||
|
ce244f6517 | ||
|
b15261a649 | ||
|
6d1d77c1e8 | ||
|
f73377282f | ||
|
2cef19fddd | ||
|
607ef21bf6 | ||
|
91b7b5fd88 | ||
|
b8aa7ed93b | ||
|
dd08e14af0 | ||
|
506120eeec | ||
|
200fbdee76 | ||
|
340c27e8ae | ||
|
51dba866a0 | ||
|
e415656b9f | ||
|
203a64ca76 | ||
|
a1fcdea110 | ||
|
d0e13dd268 | ||
|
9bbb9c83f3 | ||
|
322226dbf8 | ||
|
45f8a9c86d | ||
|
c57747dba5 | ||
|
a4acb1236b | ||
|
6990d80390 | ||
|
973c767b90 | ||
|
59bb076988 | ||
|
46ac3305f3 | ||
|
cee84ade49 | ||
|
945ccaa75e | ||
|
909ee37e1a | ||
|
8d56c87e53 | ||
|
de57ef4f16 | ||
|
6bba83ffeb | ||
|
cc8dba9d35 | ||
|
5e59386c6d | ||
|
1814367e83 | ||
|
0ad3a337f1 | ||
|
c67990fd77 | ||
|
b6f19e750c | ||
|
c6c2d8966a | ||
|
c7c32a324f | ||
|
9da16d9bf1 | ||
|
3aa1acdc0d | ||
|
70ea617040 | ||
|
2cf28dcaf1 | ||
|
8dc464678e | ||
|
39dc04a73d | ||
|
e5d44f5f1f | ||
|
18567e96ff | ||
|
f4a3b0ca3f | ||
|
56178bab73 | ||
|
240b1a8635 | ||
|
abc276c1b4 | ||
|
d601cfcc47 | ||
|
3d24e5bfdf | ||
|
85506da325 | ||
|
df97e687b5 | ||
|
84440e673d | ||
|
70d73d1e82 | ||
|
fbdd1a8401 | ||
|
6eaae5e34c | ||
|
67723e1682 | ||
|
342c862481 | ||
|
9575278319 | ||
|
f1fcb6b7a6 | ||
|
26e6739b12 | ||
|
ebb631aad8 | ||
|
78d47793a9 | ||
|
4f3c433f7b | ||
|
878a5a08dc | ||
|
c9598f2108 | ||
|
061d54fbd5 | ||
|
8ebac92b36 | ||
|
e253015c69 | ||
|
4888f0cdd4 | ||
|
f37d08b3aa | ||
|
9543675e7d | ||
|
e6967a11b1 | ||
|
5f154f1a1f | ||
|
316f845e03 |
142 changed files with 31536 additions and 25275 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# configuration*
|
||||
custom/config/
|
||||
menu/__pycache__/
|
||||
# pkgmngt/packInstall.sh
|
||||
# pkgmngt/packageManager.xml
|
197
BLFS/Makefile
197
BLFS/Makefile
|
@ -1,35 +1,50 @@
|
|||
# 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>
|
||||
# Pierre Labastie <pierre.labastie at neuf.fr>
|
||||
|
||||
# $Id$
|
||||
|
||||
ifdef V
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
|
||||
# Known behavior
|
||||
LANG=C
|
||||
LC_ALL=C
|
||||
# Makefile should reside in a directory where there are two subdirectories
|
||||
# initially:
|
||||
TOPDIR = $(shell pwd)
|
||||
# the stylesheets
|
||||
XSLDIR = $(TOPDIR)/xsl
|
||||
# the menu program sources
|
||||
MENU = $(TOPDIR)/menu
|
||||
|
||||
# The right-hand side is updated by jhalfs
|
||||
TRACKING_DIR = tracking-dir
|
||||
TOPDIR=$(shell pwd)
|
||||
BLFS_XML = $(TOPDIR)/blfs-xml
|
||||
XSLDIR = $(TOPDIR)/xsl
|
||||
|
||||
RENDERTMP = $(BLFS_XML)/tmp
|
||||
BLFS_FULL = $(RENDERTMP)/blfs-full.xml
|
||||
PACK_LIST = $(TOPDIR)/packages.xml
|
||||
MENU = $(TOPDIR)/menu
|
||||
# Those directories and files will be created and populated by make:
|
||||
# directory of the book sources:
|
||||
LFS_XML = $(TOPDIR)/lfs-xml
|
||||
BLFS_XML = $(TOPDIR)/blfs-xml
|
||||
# contains the REV used in the preceding call:
|
||||
REVFILE = $(TOPDIR)/revision
|
||||
# the list of packages:
|
||||
PACK_LIST = $(TOPDIR)/packages.xml
|
||||
# the generated menu input:
|
||||
CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
|
||||
CONFIG_OUT = $(TOPDIR)/configuration
|
||||
BOOK_XML = $(TOPDIR)/book.xml
|
||||
TRACKFILE = $(TRACKING_DIR)/instpkg.xml
|
||||
# menu output:
|
||||
CONFIG_OUT = $(TOPDIR)/configuration
|
||||
# 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
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>\n\
|
||||
\n\
|
||||
|
@ -39,27 +54,59 @@ define INITIAL_TRACK
|
|||
</sublist>
|
||||
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)/%, \
|
||||
$(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)/%, \
|
||||
$(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)
|
||||
$(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
|
||||
$(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
|
||||
|
||||
$(MENU)/mconf:
|
||||
$(Q)$(MAKE) -C $(MENU) ncurses conf mconf
|
||||
$(CONFIG_OUT): $(CONFIG_CONFIG_IN)
|
||||
$(Q)CONFIG_="" KCONFIG_CONFIG=configuration \
|
||||
python3 $(MENU)/menuconfig.py $(CONFIG_CONFIG_IN)
|
||||
|
||||
$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
|
||||
$(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) \
|
||||
--stringparam lfs-full $(LFS_FULL) \
|
||||
-o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
|
||||
$(Q)xmllint --postvalid --format -o $@ $@.tmp
|
||||
$(Q)rm $@.tmp
|
||||
|
@ -72,11 +119,10 @@ $(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE)
|
|||
$(TRACKFILE): $(TRACKING_DIR)
|
||||
$(Q)if ! [ -f $@ ]; then \
|
||||
echo Initializing $(TRACKFILE) && \
|
||||
/bin/echo -e '$(INITIAL_TRACK)' > $@ && \
|
||||
$(MAKE) $(PACK_LIST); \
|
||||
/bin/echo -e '$(INITIAL_TRACK)' > $@; \
|
||||
fi
|
||||
$(Q)for track in $(TRACKING_DIR)/*-*; do \
|
||||
if [ -f $$track ]; then \
|
||||
if [ -f $$track ]; then \
|
||||
pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
|
||||
version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
|
||||
xsltproc --stringparam packages $(PACK_LIST) \
|
||||
|
@ -85,7 +131,8 @@ $(TRACKFILE): $(TRACKING_DIR)
|
|||
-o track.tmp $(XSLDIR)/bump.xsl $@ && \
|
||||
sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
|
||||
xmllint --format --postvalid track.tmp > $@; \
|
||||
fi; \
|
||||
fi; \
|
||||
rm -f $$track; \
|
||||
done; \
|
||||
rm -f track.tmp
|
||||
|
||||
|
@ -96,27 +143,91 @@ $(TRACKING_DIR):
|
|||
$(XSLDIR)/specialCases.xsl: $(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)
|
||||
@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)xmllint --nonet --noent --xinclude --postvalid \
|
||||
-o $@ $(BLFS_XML)/index.xml
|
||||
@echo "Adjusting BLFS for revision $(REV)..."
|
||||
$(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)
|
||||
|
||||
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
|
||||
$(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):
|
||||
@echo Getting the book sources...
|
||||
$(Q)svn co $(SVN) $@
|
||||
|
||||
@echo Getting the BLFS book sources...
|
||||
$(Q)git clone $(GIT) $@
|
||||
ifneq (,$(BLFS-BRANCH))
|
||||
$(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
|
||||
cd $@ && \
|
||||
git checkout $(BLFS-BRANCH); \
|
||||
fi
|
||||
endif
|
||||
# Clean up
|
||||
|
||||
clean:
|
||||
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
|
||||
- $(MAKE) -C $(MENU) clean
|
||||
|
||||
.PHONY: clean all update $(CONFIG_OUT)
|
||||
FORCE:
|
||||
.PHONY: clean all update $(CONFIG_OUT) version FORCE
|
||||
|
|
24
BLFS/TODO
24
BLFS/TODO
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Project TODO list
|
||||
#
|
||||
# $Id$
|
||||
#####
|
||||
|
||||
|
||||
|
@ -17,4 +16,25 @@
|
|||
|
||||
-- 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)
|
||||
|
|
152
BLFS/envars.conf
152
BLFS/envars.conf
|
@ -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
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
set -e
|
||||
|
||||
declare TOPDIR='..'
|
||||
|
@ -42,7 +40,7 @@ __write_build_cmd() { #
|
|||
#----------------------------------#
|
||||
(
|
||||
cat << EOF
|
||||
@source ${TOPDIR}/envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1
|
||||
@${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -50,12 +48,15 @@ EOF
|
|||
#----------------------------------#
|
||||
__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
|
||||
@xsltproc --stringparam packages ${PACK_FILE} \\
|
||||
--stringparam package ${pkg_name#*-?-} \\
|
||||
--stringparam package "${pkg_name}" \\
|
||||
-o track.tmp \\
|
||||
${BUMP} \$(TRACKING_FILE) && \\
|
||||
sed -i 's@PACKDESC@${ATOPDIR}/packdesc.dtd@' track.tmp && \\
|
||||
|
@ -156,11 +157,19 @@ EOF
|
|||
}
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
# Let us make a clean base:
|
||||
rm -rf *
|
||||
|
||||
generate_Makefile
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id: gen-special.sh 21 2012-02-16 15:06:19Z labastie $
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# generates an xsl stylesheet containing a template for special
|
||||
# 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
|
||||
|
||||
# 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@')
|
||||
|
||||
# Non-versioned packages:
|
||||
NV_LIST="cacerts xorg-env kde-pre-install-config kf5-intro lxqt-pre-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)
|
||||
NV_LIST="postlfs-config-profile postlfs-config-random postlfs-config-vimrc \
|
||||
initramfs xorg-env kde-pre-install-config kf5-intro \
|
||||
lxqt-pre-install lxqt-post-install ojdk-conf tex-path"
|
||||
|
||||
cat >$SPECIAL_FILE << EOF
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
@ -54,30 +48,6 @@ cat >$SPECIAL_FILE << EOF
|
|||
|
||||
<xsl:template match='*' mode="special">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(@id,'udev')">
|
||||
<xsl:text> </xsl:text>
|
||||
<package><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="version">$UDEVVERSION</xsl:element>
|
||||
<xsl:if
|
||||
test="document(\$installed-packages)//package[name=current()/@id]">
|
||||
<xsl:text>
 </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>
 </xsl:text>
|
||||
</package><xsl:text>
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- Although versioned, this page is not a package. But
|
||||
the sect2 with id "xorg-env" is referred to at several
|
||||
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:param name="section"/>
|
||||
<xsl:param name="status"/>
|
||||
<xsl:param name="build"/>
|
||||
<xsl:choose>
|
||||
EOF
|
||||
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
|
||||
# that the preceding package is a dependency of the following,
|
||||
# except the first.
|
||||
list_cat="$(sed -n '/>cat/,/EOF</p' $file | grep -v 'cat\|EOF' |
|
||||
sed 's/^[^ ]*\ *\([^&]*\).*/\1/' | sed 's/-$//')"
|
||||
list_cat="$(sed -n '/>cat/,/EOF</p' $file | grep -v 'cat\|EOF\|#' |
|
||||
awk '{ print $NF }' | sed 's/-&.*//')"
|
||||
|
||||
# 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
|
||||
|
@ -160,7 +131,11 @@ EOF
|
|||
if [ "$i" = "$packname" ]; then break; fi
|
||||
precpack=$i
|
||||
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
|
||||
<module><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">$packname</xsl:element>
|
||||
|
@ -178,6 +153,7 @@ EOF
|
|||
cat >>$SPECIAL_FILE << EOF
|
||||
<xsl:element name="dependency">
|
||||
<xsl:attribute name="status">required</xsl:attribute>
|
||||
<xsl:attribute name="build">before</xsl:attribute>
|
||||
<xsl:attribute name="name">$precpack</xsl:attribute>
|
||||
<xsl:attribute name="type">ref</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
@ -194,21 +170,35 @@ EOF
|
|||
<!-- End dependencies -->
|
||||
</module>
|
||||
EOF
|
||||
cat >> tmpfile << EOF
|
||||
<xsl:element name="dependency">
|
||||
<xsl:attribute name="status">
|
||||
<xsl:value-of select="\$status"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="name">$packname</xsl:attribute>
|
||||
<xsl:attribute name="type">ref</xsl:attribute>
|
||||
</xsl:element>
|
||||
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>
|
||||
#EOF
|
||||
precpack=$packname
|
||||
done
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
</package>
|
||||
</xsl:when>
|
||||
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>
|
||||
EOF
|
||||
done
|
||||
|
@ -218,28 +208,57 @@ for ver_ent in $EXCEPTIONS; do
|
|||
[[ -z $id ]] && continue
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
<xsl:when test="@id='$id'">
|
||||
<xsl:text> </xsl:text>
|
||||
<package><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">$id</xsl:element>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="version">$ver_ent</xsl:element>
|
||||
<xsl:if
|
||||
test="document(\$installed-packages)//package[name=current()/@id]">
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="inst-version">
|
||||
<xsl:value-of
|
||||
select="document(\$installed-packages
|
||||
)//package[name=current()/@id]/version"/>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<!-- if there is a sect1 ancestor, we have a module -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::sect1">
|
||||
<xsl:text> </xsl:text>
|
||||
<module><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">$id</xsl:element>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="version">$ver_ent</xsl:element>
|
||||
<xsl:if
|
||||
test="document(\$installed-packages)//package[name=current()/@id]">
|
||||
<xsl:text>
 </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"/>
|
||||
<xsl:apply-templates select=".//para[@role='required' or
|
||||
@role='recommended' or
|
||||
@role='optional']"
|
||||
mode="dependency"/>
|
||||
<!-- End dependencies -->
|
||||
<xsl:text>
 </xsl:text>
|
||||
</package><xsl:text>
</xsl:text>
|
||||
<xsl:text>
 </xsl:text>
|
||||
</module><xsl:text>
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text> </xsl:text>
|
||||
<package><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">$id</xsl:element>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="version">$ver_ent</xsl:element>
|
||||
<xsl:if
|
||||
test="document(\$installed-packages)//package[name=current()/@id]">
|
||||
<xsl:text>
 </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>
 </xsl:text>
|
||||
</package><xsl:text>
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
EOF
|
||||
done
|
||||
|
|
|
@ -1,31 +1,54 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Read and parse the configuration parameters..
|
||||
#
|
||||
set -e
|
||||
|
||||
TOPDIR=$1
|
||||
TRACKFILE=$1
|
||||
if test -z "$TRACKFILE"; then
|
||||
TRACKFILE=tracking-dir/instpkg.xml
|
||||
fi
|
||||
TOPDIR=$2
|
||||
if test -z "$TOPDIR"; then
|
||||
TOPDIR=$(pwd)
|
||||
fi
|
||||
BLFS_FULL=$2
|
||||
BLFS_FULL=$3
|
||||
if test -z "$BLFS_FULL"; then
|
||||
BLFS_FULL=${TOPDIR}/blfs-xml/tmp/blfs-full.xml
|
||||
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 DepDir="${TOPDIR}/dependencies"
|
||||
declare LibDir="${TOPDIR}/libs"
|
||||
declare PackFile="${TOPDIR}/packages.xml"
|
||||
declare BookXml="${TOPDIR}/book.xml"
|
||||
declare MakeBook="${TOPDIR}/xsl/make_book.xsl"
|
||||
declare GetVersion="${TOPDIR}/xsl/get_version.xsl"
|
||||
declare MakeScripts="${TOPDIR}/xsl/scripts.xsl"
|
||||
declare ListLFS="${TOPDIR}/xsl/list_lfs.xsl"
|
||||
declare BookHtml="${TOPDIR}/book-html"
|
||||
declare BLFS_XML="${TOPDIR}/blfs-xml"
|
||||
declare -a TARGET
|
||||
declare DEP_LEVEL
|
||||
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() { #
|
||||
|
@ -44,7 +67,22 @@ parse_configuration() { #
|
|||
# Create global variables for these parameters.
|
||||
optDependency=* | \
|
||||
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 ;;
|
||||
esac
|
||||
|
||||
|
@ -62,13 +100,18 @@ parse_configuration() { #
|
|||
TARGET=(${optTARGET[*]})
|
||||
DEP_LEVEL=$optDependency
|
||||
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() { #
|
||||
#--------------------------#
|
||||
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 config_param
|
||||
local -i index
|
||||
|
@ -85,18 +128,15 @@ validate_configuration() { #
|
|||
# Generates the root of the dependency tree
|
||||
#
|
||||
#--------------------------#
|
||||
generate_deps() { #
|
||||
generate_deps() { #
|
||||
#--------------------------#
|
||||
|
||||
local -i index
|
||||
local DepDir=$1
|
||||
rm -f $DepDir/*.{o,}dep
|
||||
rm -f $DepDir/*.{tree,dep}
|
||||
for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
|
||||
echo 1 ${TARGET[${index}]} >> $DepDir/root.odep
|
||||
echo 1 b ${TARGET[${index}]} >> $DepDir/root.dep
|
||||
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
|
||||
pushd $DepDir > /dev/null
|
||||
set +e
|
||||
generate_dependency_tree root.dep 1
|
||||
echo
|
||||
LIST="$(tree_browse root.dep)"
|
||||
generate_subgraph root.dep 1 1 b
|
||||
echo -e "\n${SD_BORDER}"
|
||||
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
|
||||
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}
|
||||
echo Making XML book
|
||||
xsltproc --stringparam list "$LIST" \
|
||||
xsltproc --stringparam list "$LIST" \
|
||||
--stringparam MTA "$MAIL_SERVER" \
|
||||
--stringparam lfsbook "$LFS_FULL" \
|
||||
-o ${BookXml} \
|
||||
${MakeBook} \
|
||||
$BLFS_FULL
|
||||
|
@ -177,12 +268,79 @@ for ht in ${BookHtml}/*.html
|
|||
done
|
||||
echo -en "\n\tGenerating the build scripts ...\n"
|
||||
rm -rf scripts
|
||||
xsltproc --xinclude --nonet \
|
||||
--stringparam sudo $SUDO \
|
||||
-o ./scripts/ ${MakeScripts} \
|
||||
if test $STATS = y; then
|
||||
LIST_STAT="${TARGET[*]}"
|
||||
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}
|
||||
# Make the scripts executable.
|
||||
chmod -R +x scripts
|
||||
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
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# common constants
|
||||
#
|
||||
# $Id$
|
||||
#####
|
||||
|
||||
|
||||
|
|
|
@ -1,38 +1,145 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
#---------------------------------------------------------------------------#
|
||||
# This is a set of (recursive) functions for manipulating a dependency #
|
||||
# tree. Everything would be "simple" without circular dependencies. We #
|
||||
# would just have to build the tree using the packages.xml file, and to #
|
||||
# provide a function for browsing it. But we need to be able to detect #
|
||||
# circular dependencies and to possibly change the tree depending on #
|
||||
# priorities. This is why we keep with each node a record of the path #
|
||||
# from the root to the node, which we call *link* and a record of the #
|
||||
# successive priorities which we call *priolink*. #
|
||||
# #
|
||||
# Layout of the tree: #
|
||||
# #
|
||||
# A node of the tree is represented by a file <nodeName>.dep. We keep all #
|
||||
# those files in the same directory. The root node file is "root.dep". #
|
||||
# Files <nodeName>.dep have the following layout: #
|
||||
# - the first line is the link: the link is an array of numbers #
|
||||
# (n1 n2 ... nN), describing the path from the root to <nodeName>: n1 #
|
||||
# is the position of the first node of the path in root.dep, n2 is the #
|
||||
# position of the second node of the path in <node1>.dep and so on. The #
|
||||
# link is not needed for normal tree operations (building a subtree or #
|
||||
# browsing the tree), but it allows to check whether a dependency is #
|
||||
# circular, and to find its parent. #
|
||||
# - the second line is an array of priorities (p1 p2 ... pN), giving the #
|
||||
# priority (1=required, 2=recommended, 3=optional) of each dependency #
|
||||
# in the link. #
|
||||
# - each subsequent line is of the form "p <depname>", where p is the #
|
||||
# priority as above, and <depname> is the name of the dependency. The #
|
||||
# position which is recorded in the link is the number of the line #
|
||||
# minus 2. #
|
||||
# #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# This is a set of (recursive) functions for manipulating a dependency graph. #
|
||||
# We use algorithms and definitions from chapter 4 (mainly section 4.2) of #
|
||||
# https://algs4.cs.princeton.edu/. The graph we manipulate is the directed #
|
||||
# graph of the dependencies: nodes are packages in the BLFS book. A node A is #
|
||||
# connected to a node B if package A depends on B. A topological order (rev- #
|
||||
# erted) is exactly what we want for a build order. But a topological order #
|
||||
# only exists if the graph is acyclic. We'll therefore have to remove cycles. #
|
||||
# There are a number of other features we want to consider: #
|
||||
# - edges are weighted according to the dependency requirement: #
|
||||
# 1 for required #
|
||||
# 2 for recommended #
|
||||
# 3 for optional #
|
||||
# 4 for external #
|
||||
# We should consider only edges with weight lower or equal to that #
|
||||
# specified by the user, but see below. #
|
||||
# - we do not want to build the whole book. The user requests a set of #
|
||||
# packages, and we'd like to consider only nodes reachable from this set #
|
||||
# using edges of weight not exceeding the specified weight. #
|
||||
# - we do not want to rebuild packages already built. But we still have to #
|
||||
# generate the full dependency graph, because if A depends on B, which is #
|
||||
# already built, and B depends on C, which is not built, or needs to be #
|
||||
# updated, then A may depends on C. We therefore have to remove already #
|
||||
# built (and up to date) packages from the graph, but need to keep the #
|
||||
# dependency chain. #
|
||||
# - when doing the topological sort, we want to consider all the edges and #
|
||||
# not only those not exceeding the specified weight: If a package A in the #
|
||||
# reachable subgraph depends optionally on another package B in the same #
|
||||
# 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: #
|
||||
# #
|
||||
# In case we find a cirdular dependency, it has the form : #
|
||||
|
@ -51,9 +158,283 @@
|
|||
# Global variables:
|
||||
# A string of spaces for indenting:
|
||||
declare -a spaceSTR=" "
|
||||
# When we are backing up from a circular dependency, `exchange_triplet'
|
||||
# shall contain (parent dependency_0 dependency_n):
|
||||
declare -a exchange_triplet
|
||||
# When we are backing up from a circular dependency, `parentNode'
|
||||
# contains the node which has an edge entering the cycle
|
||||
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() { #
|
||||
|
@ -62,27 +443,24 @@ generate_dependency_tree() { #
|
|||
function: Create a subtree of the dependency tree
|
||||
(recursive function)
|
||||
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)
|
||||
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
|
||||
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,
|
||||
a file <pkg>.dep and its dependencies
|
||||
a file <pkg>.tree and its dependencies
|
||||
on error: nothing
|
||||
on success: nothing
|
||||
inline_doc
|
||||
|
||||
local DepFile=$1
|
||||
local depFile=$1
|
||||
local priority=$2
|
||||
local -a rootlink
|
||||
local -a priolink
|
||||
|
@ -90,156 +468,113 @@ local -a otherlink
|
|||
local -i depth
|
||||
local -i count=0
|
||||
local id_of_dep
|
||||
local build_of_dep
|
||||
local prio_of_dep
|
||||
local parent
|
||||
local lines_to_remove=
|
||||
local srootlink
|
||||
local dep_level
|
||||
local priostring
|
||||
local dpriostring
|
||||
local i
|
||||
|
||||
{
|
||||
# We use fd number 6 for input from DepFile, because we need 0 for user input
|
||||
read -u6 -a rootlink
|
||||
read -a rootlink
|
||||
depth=${#rootlink[*]}
|
||||
read -u6 -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
|
||||
read -a priolink
|
||||
srootlink="${rootlink[*]} "
|
||||
case $priority in
|
||||
1) priostring=required ;;
|
||||
2) priostring=recommended ;;
|
||||
3) priostring=optional ;;
|
||||
4) priostring=external ;;
|
||||
esac
|
||||
# start of DepFile
|
||||
echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}$DepFile${OFF} $priostring"
|
||||
# start of depFile
|
||||
echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}${depFile%.tree}${OFF} $priostring"
|
||||
|
||||
while read -u6 prio_of_dep id_of_dep; do
|
||||
case $prio_of_dep in
|
||||
while read prio_of_dep build_of_dep id_of_dep; do
|
||||
case $prio_of_dep in
|
||||
1) dpriostring=required ;;
|
||||
2) dpriostring=recommended ;;
|
||||
3) dpriostring=optional ;;
|
||||
4) dpriostring=external ;;
|
||||
esac
|
||||
esac
|
||||
# count entries in file
|
||||
(( count++ ))
|
||||
# Has this entry already been seen?
|
||||
if [ -f ${id_of_dep}.dep ]; then # found ${id_of_dep}.dep already in tree
|
||||
otherlink=($(head -n 1 ${id_of_dep}.dep))
|
||||
if [ -z "${otherlink[*]}" ]
|
||||
then echo otherlink empty for $id_of_dep.dep
|
||||
if [ -f ${id_of_dep}.tree ]; then # found ${id_of_dep}.tree already in tree
|
||||
otherlink=($(head -n 1 ${id_of_dep}.tree))
|
||||
if [ -z "${otherlink[*]}" ]
|
||||
then echo otherlink empty for $id_of_dep.tree
|
||||
echo This should not happen, but happens to happen...
|
||||
exit 1
|
||||
fi
|
||||
# Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11)
|
||||
#Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11)
|
||||
# and otherlink=(1 1)
|
||||
if [[ ${srootlink#"${otherlink[*]} "} != ${srootlink} ]]; then # cir. dep
|
||||
echo -en "\nCirc: $((depth+1))${spaceSTR:0:$((depth+1))}${YELLOW}${id_of_dep}${OFF} $dpriostring"
|
||||
# First look for the other parent of this dependency.
|
||||
# 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:
|
||||
# Find lowest priority in branch from parent to depFile:
|
||||
p2=0
|
||||
for (( i=${#otherlink[*]}; i < $depth ; i++ )) ; do
|
||||
if (( ${priolink[i]} > $p2 )); then p2=${priolink[i]}; fi
|
||||
done
|
||||
if (( $prio_of_dep >= $p2 )); then # prune
|
||||
lines_to_remove="$lines_to_remove $id_of_dep"
|
||||
sed -i "/$id_of_dep/d" ${DepFile/.dep/.odep}
|
||||
else #backup with prio priority
|
||||
exchange_triplet=($parent $id_of_dep ${DepFile%.dep})
|
||||
return $priority
|
||||
sed -i "/$id_of_dep/d" ${depFile/.tree/.dep}
|
||||
else # find and set parent, then return lowest priority
|
||||
# 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]
|
||||
# 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
|
||||
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)
|
||||
lines_to_remove="$lines_to_remove $id_of_dep"
|
||||
fi # circular or not
|
||||
continue # this dependency has already been seen, and the associated
|
||||
# subtree computed. We are done
|
||||
fi # Has this entry already been seen?
|
||||
# So, this entry has not already been seen.
|
||||
# If this is an external dep, just display it and go to next dep:
|
||||
if [ "$prio_of_dep" -eq 4 ]; then
|
||||
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
|
||||
# So, this entry has not already been seen. Let's build the corresponding
|
||||
# subtree. First check there is a subtree...
|
||||
# Use -s, because it may happen that after removing lines, .dep exists
|
||||
# but is empty.
|
||||
if [[ -s ${id_of_dep}.odep ]]; then # this dependency has dependencies
|
||||
sed "1i${rootlink[*]} $count\\
|
||||
${priolink[*]} $prio_of_dep" < ${id_of_dep}.odep \
|
||||
> ${id_of_dep}.dep # add link and priolink
|
||||
generate_dependency_tree ${id_of_dep}.dep $prio_of_dep
|
||||
if [[ -s ${id_of_dep}.dep ]]; then # this dependency has dependencies
|
||||
sed "1i${rootlink[*]} $count\\
|
||||
${priolink[*]} $prio_of_dep" < ${id_of_dep}.dep \
|
||||
> ${id_of_dep}.tree # add link and priolink
|
||||
generate_dependency_tree ${id_of_dep}.tree $prio_of_dep
|
||||
# Test return value, in case we exchange dependencies
|
||||
p2=$?
|
||||
case $p2 in
|
||||
0) # Normal return
|
||||
;;
|
||||
[123]) # We are backing up to parent
|
||||
if [[ ${exchange_triplet} == ${DepFile%.dep} ]] ; then
|
||||
# We are the parent!
|
||||
# First, we have to find the parent of our new direct dep, and remove
|
||||
# the new direct dep from the parent.odep:
|
||||
otherlink=($(head -n1 ${exchange_triplet[2]}.dep))
|
||||
unset otherlink[-1]
|
||||
parent=$(grep -l ^"${otherlink[*]}"\$ *.dep)
|
||||
sed -i /[[:digit:]]\ ${exchange_triplet[2]}\$/d ${parent/.dep/.odep}
|
||||
tree_erase ${id_of_dep}.dep
|
||||
# We want that our direct dep be ${exchange_triplet[2]} and that id_of_dep
|
||||
# be pulled in as an indirect dep, so exchange.
|
||||
# Just doing a sed -i "s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
|
||||
# is not good if $DepFile contains several times the same line
|
||||
# so first find the first line and then sed
|
||||
lineno=$(sed -n /${id_of_dep}/= $DepFile | head -n1)
|
||||
sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
|
||||
# Do the same for the odep file:
|
||||
local OdepFile=${DepFile/.dep/.odep}
|
||||
lineno=$(sed -n /${id_of_dep}/= $OdepFile | head -n1)
|
||||
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
|
||||
p2=$?
|
||||
case $p2 in
|
||||
0) # Normal return
|
||||
;;
|
||||
$prio_of_dep) # we remove this dep, but since it may become unreachable,
|
||||
# move it to be built later (as a dep of parent).
|
||||
tree_erase ${id_of_dep}.tree
|
||||
lines_to_remove="$lines_to_remove $id_of_dep"
|
||||
sed -i "/${id_of_dep}/d" ${depFile/.tree/.dep}
|
||||
echo "$prio_of_dep b $id_of_dep" >> $parentNode
|
||||
# must be added to .dep in case parentNode is destroyed when erasing
|
||||
# the tree
|
||||
echo "$prio_of_dep b $id_of_dep" >> ${parentNode/.tree/.dep}
|
||||
continue
|
||||
;;
|
||||
*) # We are backing up
|
||||
return $p2
|
||||
;;
|
||||
esac
|
||||
else # id_of_dep has no dependencies, just record the link in a file
|
||||
# and print
|
||||
echo "${rootlink[*]} $count" > ${id_of_dep}.tree
|
||||
echo -en "\nLeaf: $(($depth+1))${spaceSTR:0:$(($depth+1))}${CYAN}${id_of_dep}${OFF} $dpriostring"
|
||||
fi
|
||||
done
|
||||
echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}$DepFile${OFF}"
|
||||
} 6<$DepFile
|
||||
echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}${depFile%.tree}${OFF}"
|
||||
} <$depFile
|
||||
# It may happen that a file is created with several times
|
||||
# the same line. Normally, all those lines but one
|
||||
# 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
|
||||
# that line
|
||||
for line in $lines_to_remove
|
||||
do lineno=$(sed -n /^[[:digit:]]\ $line\$/= $DepFile | tail -n1)
|
||||
sed -i ${lineno}d $DepFile
|
||||
do lineno=$(sed -n /^[[:digit:]]\ b\ $line\$/= $depFile | tail -n1)
|
||||
sed -i ${lineno}d $depFile
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#---------------#
|
||||
tree_browse() { #
|
||||
#---------------#
|
||||
|
@ -264,8 +600,8 @@ local f
|
|||
#echo file=$file
|
||||
for f in $(grep '[^0-9 ]' $file | sed 's/.* //'); do
|
||||
# echo f=$f
|
||||
if grep -q '[^0-9 ]' ${f}.dep ; then
|
||||
tree_browse ${f}.dep
|
||||
if grep -q '[^0-9 ]' ${f}.tree ; then
|
||||
tree_browse ${f}.tree
|
||||
fi
|
||||
echo $f
|
||||
done
|
||||
|
@ -276,17 +612,24 @@ tree_erase() { #
|
|||
#--------------#
|
||||
local file=$1
|
||||
local f
|
||||
local -a rootlink
|
||||
local -a rootlink2
|
||||
local rootlink
|
||||
local rootlink2
|
||||
|
||||
#echo file=$file
|
||||
rootlink=($(head -n1 $file))
|
||||
rootlink="$(head -n1 $file) "
|
||||
for f in $(grep '[^0-9 ]' $file | sed 's/.* //'); do
|
||||
# echo " f"=$f
|
||||
if [ -f ${f}.dep ]; then
|
||||
rootlink2=($(head -n1 ${f}.dep))
|
||||
if [[ "${rootlink2[*]}" =~ "${rootlink[*]}" ]] ; then
|
||||
tree_erase ${f}.dep
|
||||
if [ -f ${f}.tree ]; then
|
||||
rootlink2="$(head -n1 ${f}.tree) "
|
||||
# We want two things:
|
||||
# i) do not erase the file if it is in another branch
|
||||
# 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
|
||||
done
|
||||
|
|
|
@ -18,5 +18,6 @@
|
|||
<!-- subdependencies of a dependency are defined for example in Perl
|
||||
modules -->
|
||||
<!ATTLIST dependency status (required|recommended|optional) "recommended"
|
||||
build (before|after|first) "before"
|
||||
name CDATA #REQUIRED
|
||||
type (ref|link) "ref">
|
||||
|
|
148
BLFS/update-lfs.sh
Executable file
148
BLFS/update-lfs.sh
Executable 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
|
|
@ -1,7 +1,5 @@
|
|||
<?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"
|
||||
version="1.0">
|
||||
|
||||
|
@ -9,15 +7,26 @@
|
|||
<xsl:param name="package" select="''"/>
|
||||
<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:choose>
|
||||
<xsl:when test="$version='N'">
|
||||
<xsl:value-of select=
|
||||
"document($packages)//*[self::package or self::module]
|
||||
[string(name)=$package]/version"/>
|
||||
[string(name)=$realpackage]/version"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$version"/>
|
||||
<xsl:copy-of select="$version"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
@ -33,8 +42,8 @@
|
|||
<xsl:apply-templates select=".//package"/>
|
||||
<xsl:if test="not(.//package[string(name)=$package])">
|
||||
<package>
|
||||
<name><xsl:value-of select="$package"/></name>
|
||||
<version><xsl:value-of select="$vers"/></version>
|
||||
<name><xsl:copy-of select="$package"/></name>
|
||||
<version><xsl:copy-of select="$vers"/></version>
|
||||
</package>
|
||||
</xsl:if>
|
||||
</sublist>
|
||||
|
@ -44,8 +53,8 @@
|
|||
<xsl:choose>
|
||||
<xsl:when test="string(name)=$package">
|
||||
<package>
|
||||
<name><xsl:value-of select="name"/></name>
|
||||
<version><xsl:value-of select="$vers"/></version>
|
||||
<name><xsl:copy-of select="$package"/></name>
|
||||
<version><xsl:copy-of select="$vers"/></version>
|
||||
</package>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?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"
|
||||
version="1.0">
|
||||
|
||||
<xsl:output method="text"/>
|
||||
|
||||
<xsl:param name="MTA" select="'sendmail'"/>
|
||||
<xsl:param name="dependencies" select="2"/>
|
||||
<xsl:param name="idofdep" select="'dbus'"/>
|
||||
|
||||
<xsl:key name="depnode"
|
||||
|
@ -20,39 +17,14 @@
|
|||
</xsl:template>
|
||||
|
||||
<xsl:template match="package">
|
||||
<xsl:apply-templates select="./dependency[@status='required']">
|
||||
<xsl:with-param name="priority" select="1"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:if test="$dependencies > '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:apply-templates select="./dependency"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="module">
|
||||
<xsl:apply-templates select="./dependency[@status='required']">
|
||||
<xsl:with-param name="priority" select="1"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:if test="$dependencies > '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:apply-templates select="./dependency"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dependency">
|
||||
<xsl:param name="priority"/>
|
||||
<xsl:variable name="depname">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@name='x-window-system'">xinit</xsl:when>
|
||||
|
@ -65,10 +37,11 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<!--
|
||||
<xsl:variable name="install_it">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='link'">
|
||||
<!-- No way to track versions: install ! -->
|
||||
<!- - No way to track versions: install ! - ->
|
||||
1
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
@ -79,22 +52,43 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:apply-templates select="dependency">
|
||||
<xsl:with-param name="priority" select="1"/>
|
||||
</xsl:apply-templates>
|
||||
-->
|
||||
<xsl:apply-templates select="dependency"/>
|
||||
<!--
|
||||
<xsl:if test="number($install_it)">
|
||||
-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='link'">
|
||||
<xsl:text>4</xsl:text>
|
||||
</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: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:choose>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$depname"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
<!--
|
||||
</xsl:if>
|
||||
-->
|
||||
</xsl:template>
|
||||
|
||||
<!-- lexicographic Comparison of strings. There is no way to directly
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?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"
|
||||
version="1.0">
|
||||
|
||||
|
@ -12,52 +10,189 @@
|
|||
<xsl:apply-templates select="//list"/>
|
||||
<xsl:text>comment ""
|
||||
|
||||
menu "Default package for resolving MTA dependency"
|
||||
menu "Build settings"
|
||||
|
||||
choice
|
||||
prompt "Mail server"
|
||||
choice
|
||||
prompt "Mail server for resolving the MTA dependency"
|
||||
config MS_sendmail
|
||||
bool "sendmail"
|
||||
config MS_postfix
|
||||
bool "postfix"
|
||||
config MS_exim
|
||||
bool "exim"
|
||||
endchoice
|
||||
config MAIL_SERVER
|
||||
endchoice
|
||||
config MAIL_SERVER
|
||||
string
|
||||
default sendmail if MS_sendmail
|
||||
default postfix if MS_postfix
|
||||
default exim if MS_exim
|
||||
default "sendmail" if MS_sendmail
|
||||
default "postfix" if MS_postfix
|
||||
default "exim" if MS_exim
|
||||
|
||||
endmenu
|
||||
|
||||
choice
|
||||
choice
|
||||
prompt "Dependency level"
|
||||
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
|
||||
bool "Required dependencies only"
|
||||
|
||||
config DEPLVL_2
|
||||
bool "Required and recommended dependencies"
|
||||
bool "Required plus recommended dependencies"
|
||||
|
||||
config DEPLVL_3
|
||||
bool "Required, recommended and optional dependencies"
|
||||
bool "Req/rec plus optional dependencies of requested package(s)"
|
||||
|
||||
endchoice
|
||||
config optDependency
|
||||
config DEPLVL_4
|
||||
bool "All non external dependencies"
|
||||
|
||||
endchoice
|
||||
config optDependency
|
||||
int
|
||||
default 1 if DEPLVL_1
|
||||
default 2 if DEPLVL_2
|
||||
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"
|
||||
default y
|
||||
help
|
||||
Select if sudo will be used (you build as a normal user)
|
||||
otherwise sudo is not needed (you build as root)
|
||||
Select if sudo will be used (you build as a normal user)
|
||||
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:template>
|
||||
|
||||
|
@ -66,7 +201,7 @@ config SUDO
|
|||
test=".//*[self::package or self::module]
|
||||
[(version and not(inst-version)) or
|
||||
string(version) != string(inst-version)]">
|
||||
<xsl:text>config	MENU_</xsl:text>
|
||||
<xsl:text>menuconfig	MENU_</xsl:text>
|
||||
<xsl:value-of select="@id"/>
|
||||
<xsl:text>
|
||||
bool	"</xsl:text>
|
||||
|
@ -74,16 +209,13 @@ bool	"</xsl:text>
|
|||
<xsl:text>"
|
||||
default	n
|
||||
|
||||
menu "</xsl:text>
|
||||
<xsl:value-of select="name"/>
|
||||
<xsl:text>"
|
||||
depends MENU_</xsl:text>
|
||||
if	MENU_</xsl:text>
|
||||
<xsl:value-of select="@id"/>
|
||||
<xsl:text>
|
||||
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="sublist"/>
|
||||
<xsl:text>endmenu
|
||||
<xsl:text>endif
|
||||
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
|
@ -94,7 +226,7 @@ depends MENU_</xsl:text>
|
|||
test=".//*[self::package or self::module]
|
||||
[(version and not(inst-version)) or
|
||||
string(version) != string(inst-version)]">
|
||||
<xsl:text>	config	MENU_</xsl:text>
|
||||
<xsl:text>	menuconfig	MENU_</xsl:text>
|
||||
<xsl:value-of select="@id"/>
|
||||
<xsl:text>
|
||||
	bool	"</xsl:text>
|
||||
|
@ -102,16 +234,13 @@ depends MENU_</xsl:text>
|
|||
<xsl:text>"
|
||||
	default	n
|
||||
|
||||
	menu "</xsl:text>
|
||||
<xsl:value-of select="name"/>
|
||||
<xsl:text>"
|
||||
	depends MENU_</xsl:text>
|
||||
	if	MENU_</xsl:text>
|
||||
<xsl:value-of select="@id"/>
|
||||
<xsl:text>
|
||||
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="package"/>
|
||||
<xsl:text>	endmenu
|
||||
<xsl:text>	endif
|
||||
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
|
@ -141,24 +270,21 @@ depends MENU_</xsl:text>
|
|||
<xsl:if
|
||||
test="not(version) and ./module[not(inst-version) or
|
||||
string(version) != string(inst-version)]">
|
||||
<xsl:text>		config	MENU_</xsl:text>
|
||||
<xsl:value-of select="translate(name,' ','_')"/>
|
||||
<xsl:text>		menuconfig	MENU_</xsl:text>
|
||||
<xsl:value-of select="translate(name,' ()','___')"/>
|
||||
<xsl:text>
|
||||
		bool	"</xsl:text>
|
||||
<xsl:value-of select="name"/>
|
||||
<xsl:text>"
|
||||
		default	n
|
||||
|
||||
		menu "</xsl:text>
|
||||
<xsl:value-of select="name"/>
|
||||
<xsl:text>"
|
||||
		depends MENU_</xsl:text>
|
||||
<xsl:value-of select="translate(name,' ','_')"/>
|
||||
		if	MENU_</xsl:text>
|
||||
<xsl:value-of select="translate(name,' ()','___')"/>
|
||||
<xsl:text>
|
||||
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="module"/>
|
||||
<xsl:text>		endmenu
|
||||
<xsl:text>		endif
|
||||
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
<?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
|
||||
of packages obeying packdesc.dtd + looks for already
|
||||
installed packages in the tracking file (stringparam
|
||||
'installed-packages') -->
|
||||
<!-- Extract also a list of LFS packages from stringparam lfs-full -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<xsl:param name="lfs-full" select="'./lfs-xml/lfs-full.xml'"/>
|
||||
<xsl:param name="installed-packages" select="'../lib/instpkg.xml'"/>
|
||||
|
||||
<xsl:output method="xml"
|
||||
|
@ -22,13 +23,116 @@
|
|||
|
||||
<xsl:template match="/">
|
||||
<princList>
|
||||
<xsl:text>

</xsl:text>
|
||||
<xsl:text>

 </xsl:text>
|
||||
<list>
|
||||
<xsl:attribute name="id">lfs</xsl:attribute>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<name>LFS Packages</name>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<sublist>
|
||||
<xsl:attribute name="id">lfs-system</xsl:attribute>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<name>LFS Final System</name>
|
||||
<xsl:apply-templates
|
||||
select='document($lfs-full)//
|
||||
chapter[@id="chapter-building-system"]/
|
||||
sect1/sect1info'/>
|
||||
<xsl:text>
 </xsl:text>
|
||||
</sublist>
|
||||
<sublist>
|
||||
<xsl:attribute name="id">lfs-conf</xsl:attribute>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<name>LFS Configuration files</name>
|
||||
<xsl:apply-templates
|
||||
select='document($lfs-full)//
|
||||
chapter[@id="chapter-config"]/
|
||||
sect1/sect1info[./productname="bootscripts"]'/>
|
||||
<xsl:text>
 </xsl:text>
|
||||
</sublist>
|
||||
<sublist>
|
||||
<xsl:attribute name="id">lfs-boot</xsl:attribute>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<name>LFS Making Bootable</name>
|
||||
<xsl:apply-templates select='document($lfs-full)//chapter[@id="chapter-bootable"]/sect1/sect1info[./productname="kernel"]'/>
|
||||
<xsl:text>
 </xsl:text>
|
||||
</sublist>
|
||||
<sublist>
|
||||
<xsl:attribute name="id">lfs-theend</xsl:attribute>
|
||||
<xsl:text>
 </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>
 </xsl:text>
|
||||
</sublist>
|
||||
<xsl:text>

 </xsl:text>
|
||||
</list>
|
||||
<!-- How to have blfs-bootscripts versionned? Do not know, so
|
||||
avoid it (TODO ?) -->
|
||||
<xsl:apply-templates select="//part[not(@id='introduction')]"/>
|
||||
</princList>
|
||||
</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(),' >'),'echo ')"/>
|
||||
</xsl:element>
|
||||
<xsl:if
|
||||
test="document($installed-packages)//package[name='LFS-Release']">
|
||||
<xsl:text>
 </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>
 </xsl:text>
|
||||
<xsl:element name="name">
|
||||
<xsl:value-of select="./productname"/>
|
||||
</xsl:element>
|
||||
<xsl:text>
 </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>
 </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:if test="count(.//*[contains(translate(@xreflabel,
|
||||
'123456789',
|
||||
|
@ -40,7 +144,7 @@
|
|||
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">
|
||||
<xsl:value-of select="title"/>
|
||||
<xsl:value-of select="normalize-space(title)"/>
|
||||
</xsl:element>
|
||||
<xsl:text>

</xsl:text>
|
||||
<xsl:apply-templates select="chapter"/>
|
||||
|
@ -55,13 +159,15 @@
|
|||
'123456789',
|
||||
'000000000'),
|
||||
'-0')
|
||||
]) > 0">
|
||||
]) > 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>
|
||||
<sublist>
|
||||
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">
|
||||
<xsl:value-of select="title"/>
|
||||
<xsl:value-of select="normalize-space(title)"/>
|
||||
</xsl:element>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:apply-templates select=".//sect1">
|
||||
|
@ -89,17 +195,15 @@
|
|||
<xsl:text> </xsl:text>
|
||||
<package><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">
|
||||
<xsl:value-of select="title"/>
|
||||
</xsl:element>
|
||||
<xsl:value-of select="normalize-space(title)"/>
|
||||
</xsl:element>
|
||||
<xsl:text>
</xsl:text>
|
||||
<!-- Do not use .//*, which would include self. -->
|
||||
<xsl:apply-templates
|
||||
select="descendant::node()[contains(translate(@xreflabel,
|
||||
'123456789',
|
||||
'000000000'),
|
||||
'-0')
|
||||
]"
|
||||
mode="normal">
|
||||
<!-- Do not use .//*, which would include self.
|
||||
Even a module can be a special case, so
|
||||
call the template of specialCases.xsl,
|
||||
which calls the "normal" template when the
|
||||
case is normal. -->
|
||||
<xsl:apply-templates select="descendant::*" mode="special">
|
||||
<xsl:sort select="@id"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:text> </xsl:text>
|
||||
|
@ -208,6 +312,7 @@
|
|||
</xsl:text>
|
||||
<xsl:element name="dependency">
|
||||
<xsl:attribute name="status">required</xsl:attribute>
|
||||
<xsl:attribute name="build">before</xsl:attribute>
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="preceding-sibling::sect1[1]/@id"/>
|
||||
</xsl:attribute>
|
||||
|
@ -247,10 +352,12 @@
|
|||
<xsl:template match="para" mode="dependency">
|
||||
<xsl:variable name="status" select="./@role"/>
|
||||
<!-- First internal dependencies -->
|
||||
<xsl:for-each select="./xref">
|
||||
<xsl:for-each select=".//xref">
|
||||
<xsl:choose>
|
||||
<!-- Avoid depending of myself -->
|
||||
<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 -->
|
||||
<xsl:when test="contains(@linkend,'xorg7-')">
|
||||
<xsl:call-template name="expand-deps">
|
||||
|
@ -260,6 +367,13 @@
|
|||
<xsl:with-param name="status">
|
||||
<xsl:value-of select="$status"/>
|
||||
</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:when>
|
||||
<xsl:otherwise>
|
||||
|
@ -269,6 +383,13 @@
|
|||
<xsl:attribute name="status">
|
||||
<xsl:value-of select="$status"/>
|
||||
</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:value-of select="@linkend"/>
|
||||
</xsl:attribute>
|
||||
|
@ -278,18 +399,31 @@
|
|||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
<!-- then external dependencies -->
|
||||
<xsl:for-each select="./ulink">
|
||||
<xsl:text>
|
||||
<xsl:for-each select=".//ulink">
|
||||
<xsl:choose>
|
||||
<!-- do not depend on something which is not a dependency -->
|
||||
<xsl:when test="@role='nodep'"/>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:element name="dependency">
|
||||
<xsl:attribute name="status">
|
||||
<xsl:value-of select="$status"/>
|
||||
</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:element name="dependency">
|
||||
<xsl:attribute name="status">
|
||||
<xsl:value-of select="$status"/>
|
||||
</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: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:template>
|
||||
|
||||
|
@ -301,6 +435,7 @@
|
|||
<!-- the dep on the preceding package used to be required for python.
|
||||
It seems optional now -->
|
||||
<xsl:attribute name="status">optional</xsl:attribute>
|
||||
<xsl:attribute name="build">before</xsl:attribute>
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="preceding-sibling::listitem[1]//@linkend"/>
|
||||
</xsl:attribute>
|
||||
|
@ -312,7 +447,7 @@
|
|||
<xsl:template match="listitem" mode="perlmod-dep">
|
||||
<xsl:param name="glue" select="'
 '"/>
|
||||
<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:element name="dependency">
|
||||
<xsl:attribute name="status">
|
||||
|
@ -325,6 +460,13 @@
|
|||
<xsl:otherwise>required</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</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:if test="para/xref">
|
||||
<xsl:value-of select="para/xref/@linkend"/>
|
||||
|
|
31
BLFS/xsl/get_version.xsl
Normal file
31
BLFS/xsl/get_version.xsl
Normal 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>
</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
236
BLFS/xsl/lfs_make_book.xsl
Normal 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)>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) > 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(),'<your name here>')">
|
||||
<screen role="root"><userinput>
|
||||
<xsl:copy-of
|
||||
select="substring-before(string(),'<your name here>')"/>
|
||||
<xsl:text>jhalfs</xsl:text>
|
||||
<xsl:copy-of
|
||||
select="substring-after(string(),'<your name here>')"/>
|
||||
</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
25
BLFS/xsl/list_lfs.xsl
Normal 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>
|
|
@ -1,25 +1,45 @@
|
|||
<?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"
|
||||
version="1.0">
|
||||
|
||||
<xsl:param name="list" select="''"/>
|
||||
<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
|
||||
method="xml"
|
||||
encoding="ISO-8859-1"
|
||||
doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
|
||||
|
||||
<xsl:include href="lfs_make_book.xsl"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<book>
|
||||
<xsl:copy-of select="/book/bookinfo"/>
|
||||
<preface>
|
||||
<?dbhtml filename="preface.html"?>
|
||||
<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>
|
||||
<chapter>
|
||||
<?dbhtml filename="chapter.html"?>
|
||||
|
@ -60,8 +80,37 @@
|
|||
select="substring-after($list,' ')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($list,'groupxx')"/>
|
||||
<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: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:apply-templates
|
||||
select="//sect1[contains(@id,'xorg7')
|
||||
|
@ -86,6 +135,158 @@
|
|||
<xsl:apply-templates select="." mode="sect1"/>
|
||||
</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:copy-of select="."/>
|
||||
</xsl:template>
|
||||
|
@ -112,9 +313,10 @@
|
|||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@linkend='bootscripts'">
|
||||
<xsl:when test="@linkend='bootscripts' or
|
||||
@linkend='systemd-units'">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:when>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@linkend"/> (in full book)
|
||||
</xsl:otherwise>
|
||||
|
@ -211,6 +413,7 @@
|
|||
<!-- Perl modules : transform them to minimal sect1. Use a template
|
||||
for installation instructions -->
|
||||
<xsl:template match="bridgehead">
|
||||
<xsl:if test="ancestor::sect1[@id='perl-modules']">
|
||||
<xsl:element name="sect1">
|
||||
<xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
|
||||
<xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
|
||||
|
@ -248,10 +451,11 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- 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:element name="sect1">
|
||||
<xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
|
||||
|
@ -307,6 +511,13 @@
|
|||
select=".//userinput[starts-with(string(),'cat ')]"/>
|
||||
</xsl:call-template>
|
||||
</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:call-template name="inst-instr">
|
||||
<xsl:with-param name="inst-instr"
|
||||
|
@ -328,6 +539,7 @@
|
|||
<xsl:attribute name="url">
|
||||
<xsl:value-of
|
||||
select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
|
||||
<xsl:value-of select="$download-dir"/>
|
||||
<xsl:value-of select="$tarball"/>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
@ -338,6 +550,7 @@
|
|||
<xsl:attribute name="url">
|
||||
<xsl:value-of
|
||||
select=".//para[contains(string(),'(FTP)')]/ulink/@url"/>
|
||||
<xsl:value-of select="$download-dir"/>
|
||||
<xsl:value-of select="$tarball"/>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
@ -367,7 +580,7 @@
|
|||
</para>
|
||||
|
||||
<screen><userinput>packagedir=<xsl:value-of
|
||||
select="substring-before($tarball,'.tar.bz2')"/>
|
||||
select="substring-before($tarball,'.tar.')"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:value-of select="substring-before($install-instructions,
|
||||
'as_root')"/>
|
||||
|
@ -407,9 +620,43 @@ END DEBUG -->
|
|||
select="substring-after($cat-md5,'
')"/>
|
||||
</xsl:call-template>
|
||||
</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:copy-of select="substring-after(
|
||||
substring-before($cat-md5,'
'),' ')"/>
|
||||
substring-before($cat-md5,'
'),' ')"/>
|
||||
</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),'
')">
|
||||
<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: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:choose>
|
||||
</xsl:template>
|
||||
|
|
583
BLFS/xsl/process-install.xsl
Normal file
583
BLFS/xsl/process-install.xsl
Normal 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)='
'">
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:call-template name="process-test">
|
||||
<xsl:with-param name="test-instr"
|
||||
select="substring-after($test-instr,'
')"/>
|
||||
<xsl:with-param name="want-stats" select="$want-stats"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($test-instr,'
')">
|
||||
<xsl:call-template name="process-test">
|
||||
<xsl:with-param name="test-instr"
|
||||
select="substring-before($test-instr,'
')"/>
|
||||
<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,'
')"/>
|
||||
<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> >> $TESTLOG 2>&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)='
'">
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:call-template name="output-comment-out">
|
||||
<xsl:with-param name="out-string"
|
||||
select="substring-after($out-string,'
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($out-string,'
')">
|
||||
<xsl:text>#</xsl:text>
|
||||
<xsl:copy-of select="substring-before($out-string,'
')"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:call-template name="output-comment-out">
|
||||
<xsl:with-param name="out-string"
|
||||
select="substring-after($out-string,'
')"/>
|
||||
</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 << 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>'
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,'
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>
|
165
BLFS/xsl/process-replaceable.xsl
Normal file
165
BLFS/xsl/process-replaceable.xsl
Normal 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(),'<ll>')">
|
||||
<xsl:copy-of select="$lang-ll"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(string(),'<CC>')">
|
||||
<xsl:copy-of select="$lang-CC"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(string(),'<charmap>')">
|
||||
<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 <N> Replace N with 4. -->
|
||||
<xsl:when test="contains(string(),'<N>') 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()='<EXAMPLE.ORG>'">
|
||||
<xsl:copy-of select="$DOMAINNAME"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string()='<example.org>'">
|
||||
<xsl:copy-of select="$domainname"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string()='<belgarath.example.org>'">
|
||||
<xsl:copy-of select="$fqdn"/>
|
||||
</xsl:when>
|
||||
<!-- in this case, even root can be used -->
|
||||
<xsl:when test="string()='<loginname>'">
|
||||
<xsl:text>$USER</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- for xorg environment. Note that libreoffice too uses <PREFIX> -->
|
||||
<xsl:when test="string()='<PREFIX>' and
|
||||
ancestor::sect1[@id='xorg-env']">
|
||||
<xsl:text>/usr</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- for libreoffice. Note that xorg environment too uses <PREFIX> -->
|
||||
<xsl:when test="string()='<PREFIX>' 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()='<lang>'">
|
||||
<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
119
CHEATSHEET
Normal 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)
|
||||
|
||||
------------------------------
|
449
CLFS/clfs.xsl
449
CLFS/clfs.xsl
|
@ -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) > 0 and
|
||||
count(descendant::screen/userinput) >
|
||||
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
set +h
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>#!/bin/bash
set +h
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="not(@id='ch-system-stripping')">
|
||||
<xsl:text>set -e</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:if test="sect2[@role='installation'] and
|
||||
not(@id='ch-system-multiarch-wrapper')">
|
||||
<xsl:text>cd $PKGDIR
</xsl:text>
|
||||
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
||||
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</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"
</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> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
||||
<xsl:if test="contains(string(),' -k ')">
|
||||
<xsl:text> || true</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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>
</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>
</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
</xsl:text>
|
||||
<xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
|
||||
<xsl:text>cp -v ../bootkernel-config .config
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
|
||||
<xsl:text>cp -v ../kernel-config .config
</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>&1')"/>
|
||||
<xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- special case for procps-ng -->
|
||||
<xsl:when test="contains(string(), 'pushd')">
|
||||
<xsl:text>{ </xsl:text>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>; } >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(string(), 'make -k')">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1 || true
</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> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:if test="not(contains(string(), '>>'))">
|
||||
<xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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>&1')"/>
|
||||
<xsl:text>>> $TEST_LOG 2>&1 || true
</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>>> $TEST_LOG 2>&1 && exit $PIPESTATUS)
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- special case for procps-ng -->
|
||||
<xsl:when test="contains(string(), 'pushd')">
|
||||
<xsl:text>{ </xsl:text>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>; } >> $TEST_LOG 2>&1
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(string(), 'make -k')">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:if test="not(contains(string(), '>>'))">
|
||||
<xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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>')"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$bomb-testsuite = 'n'">
|
||||
<xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>>> $TEST_LOG 2>&1</xsl:text>
|
||||
<xsl:if test="contains(string(),' -k ')">
|
||||
<xsl:text> || true</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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 >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
||||
<xsl:if test="contains(string(),' -k ')">
|
||||
<xsl:text> || true</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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> >> $TEST_LOG
</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
</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>
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- The rest of commands -->
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</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>
|
1256
CLFS/master.sh
1256
CLFS/master.sh
File diff suppressed because it is too large
Load diff
157
CLFS2/clfs2.xsl
157
CLFS2/clfs2.xsl
|
@ -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) > 0 and
|
||||
count(descendant::screen/userinput) >
|
||||
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
set +h
</xsl:text>
|
||||
<xsl:if test="not(@id='ch-system-stripping')">
|
||||
<xsl:text>set -e
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:if test="sect2[@role='installation'] and
|
||||
not(@id='ch-cross-tools-sysroot-wrapper')">
|
||||
<xsl:text>cd $PKGDIR
</xsl:text>
|
||||
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
||||
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</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>
</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>
</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
</xsl:text>
|
||||
<xsl:text>cp -v ../kernel-config .config
</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
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- The rest of commands -->
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</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>
|
536
CLFS2/master.sh
536
CLFS2/master.sh
|
@ -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}"
|
||||
|
||||
}
|
156
CLFS3/clfs3.xsl
156
CLFS3/clfs3.xsl
|
@ -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) > 0 and
|
||||
count(descendant::screen/userinput) >
|
||||
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
set +h
set -e

</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>

</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="sect2[@role='installation']">
|
||||
<xsl:text>cd $PKGDIR
</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>
</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>
</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
</xsl:text>
|
||||
<xsl:text>cp -v ../kernel-config .config
</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
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- The rest of commands -->
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</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>
|
586
CLFS3/master.sh
586
CLFS3/master.sh
|
@ -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}"
|
||||
|
||||
}
|
||||
|
158
FUNCTION_LIST
158
FUNCTION_LIST
|
@ -1,5 +1,3 @@
|
|||
$Id$
|
||||
|
||||
This is the list of functions used in jhalfs, excluding BLFS tool functions
|
||||
and functions defined in {C,H}LFS/master.sh.
|
||||
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.
|
||||
Description: Runs xsltproc with stylesheet urls.xsl on chapter 3 of the
|
||||
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
|
||||
--------------------------------------------------------------------------
|
||||
wrt_CustomTools_target():
|
||||
|
@ -68,7 +66,7 @@ script-name to the beginning of a line in the list. Writes the name found
|
|||
to stdout.
|
||||
Implements the behavior described in README.CUSTOM, that is, if script_name
|
||||
begins with d-, strip that part.
|
||||
Called by: various functions in master.sh
|
||||
Called by: various functions in master.sh
|
||||
--------------------------------------------------------------------------
|
||||
LUSER_wrt_target():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
|
@ -128,67 +126,63 @@ Description: Calculate time with perl, footer to log file
|
|||
--------------------------------------------------------------------------
|
||||
CHROOT_wrt_RunAsRoot():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
LUSER_wrt_CopyFstab():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
CHROOT_wrt_CopyFstab():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
LUSER_wrt_TouchTimestamp():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
CHROOT_wrt_TouchTimestamp():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
LUSER_wrt_LogNewFiles():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
CHROOT_wrt_LogNewFiles():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
LUSER_RemoveBuildDirs():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
CHROOT_wrt_RemoveBuildDirs():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
wrt_touch():
|
||||
From common/libs/func_wrt_Makefile.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
wrt_compare_targets():
|
||||
From common/libs/func_compare.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
wrt_system_build():
|
||||
From common/libs/func_compare.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
wrt_compare_work():
|
||||
From common/libs/func_compare.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
wrt_do_ica_work():
|
||||
From common/libs/func_compare.sh.
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
wrt_do_farce_work():
|
||||
From common/libs/func_compare.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
wrt_logs():
|
||||
From common/libs/func_compare.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
validate_config():
|
||||
From common/libs/func_validate_configs.sh.
|
||||
|
@ -196,135 +190,55 @@ Description: Are the config values sane (within reason)
|
|||
--------------------------------------------------------------------------
|
||||
write_error_and_die():
|
||||
From common/libs/func_validate_configs.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
validate_file():
|
||||
From common/libs/func_validate_configs.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
validate_dir():
|
||||
From common/libs/func_validate_configs.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
get_book():
|
||||
From common/libs/func_book_parser.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
extract_commands():
|
||||
From common/libs/func_book_parser.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
create_package_list():
|
||||
From common/libs/func_book_parser.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
check_version():
|
||||
From common/libs/func_check_version.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
write_error_and_die():
|
||||
From common/libs/func_check_version.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
check_prerequisites():
|
||||
From common/libs/func_check_version.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
write_or_exit():
|
||||
From common/progress_bar.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
no_empty_builddir():
|
||||
From common/common-functions.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
run_make():
|
||||
From common/common-functions.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
clean_builddir():
|
||||
From common/common-functions.
|
||||
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
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
simple_error():
|
||||
From jhalfs.
|
||||
|
@ -332,27 +246,27 @@ Description: Basic error trap.... JUST DIE
|
|||
--------------------------------------------------------------------------
|
||||
see_ya():
|
||||
From jhalfs.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
chapter4_Makefiles():
|
||||
From LFS/master.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
chapter5_Makefiles():
|
||||
From LFS/master.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
chapter6_Makefiles():
|
||||
From LFS/master.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
chapter78_Makefiles():
|
||||
From LFS/master.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
build_Makefile():
|
||||
From LFS/master.sh.
|
||||
Description:
|
||||
Description:
|
||||
--------------------------------------------------------------------------
|
||||
validate_opt_settings():
|
||||
From optimize/optimize_functions.
|
||||
|
|
330
HLFS/hlfs.xsl
330
HLFS/hlfs.xsl
|
@ -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) > 0 and
|
||||
count(descendant::screen/userinput) >
|
||||
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
set +h
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>#!/bin/bash
set +h
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="not(@id='ch-tools-stripping') and
|
||||
not(@id='ch-system-strippingagain')">
|
||||
<xsl:text>set -e
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:if test="(sect2[@role='installation'])">
|
||||
<xsl:text>cd $PKGDIR
</xsl:text>
|
||||
<xsl:if test="@id='ch-system-uclibc'">
|
||||
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</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;.*; 
</xsl:text>
|
||||
<xsl:text>tar -xvf binutils-&binutils-version;.*; 
</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;.*; 
</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;.*; 
</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"
</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> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
||||
<xsl:if test="contains(string(),' -k ')">
|
||||
<xsl:text> || true</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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>
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- Copying the kernel config file -->
|
||||
<xsl:when test="string() = 'make mrproper'">
|
||||
<xsl:text>make mrproper
</xsl:text>
|
||||
<xsl:text>cp -v /sources/kernel-config .config
</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>" >> ~/.bashrc
</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>
</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>
</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> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
||||
<xsl:if test="contains(string(),' -k ')">
|
||||
<xsl:text> || true</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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 >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
||||
<xsl:if test="contains(string(),' -k ')">
|
||||
<xsl:text> || true</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</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>
</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>&1')"/>
|
||||
<xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- Fixing Cocoon sanity checks -->
|
||||
<xsl:when test="contains(string(),'./strcat-overflow')">
|
||||
<xsl:text>set +e
</xsl:text>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
set -e
</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>
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- Don't stop on strip run -->
|
||||
<xsl:when test="contains(string(),'strip ')">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- The rest of commands -->
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</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>
|
659
HLFS/master.sh
659
HLFS/master.sh
|
@ -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}"
|
||||
|
||||
}
|
1235
LFS/lfs.xsl
1235
LFS/lfs.xsl
File diff suppressed because it is too large
Load diff
753
LFS/master.sh
753
LFS/master.sh
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
###################################
|
||||
### FUNCTIONS ###
|
||||
###################################
|
||||
|
@ -10,276 +8,199 @@
|
|||
#############################################################
|
||||
|
||||
|
||||
#----------------------------#
|
||||
chapter4_Makefiles() { #
|
||||
#----------------------------#
|
||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
|
||||
#-------------------------#
|
||||
chapter_targets() { #
|
||||
#-------------------------#
|
||||
# $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
|
||||
# lfs 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 "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
|
||||
# $2 contains the build number if rebuilding for ICA
|
||||
if [[ -z "$2" ]] ; then
|
||||
local N=""
|
||||
else
|
||||
local N=-build_$1
|
||||
local chapter6=""
|
||||
mkdir chapter06$N
|
||||
cp chapter06/* chapter06$N
|
||||
for script in chapter06$N/* ; do
|
||||
local N=-build_$2
|
||||
local CHROOT_TGT=""
|
||||
mkdir ${dir}$N
|
||||
cp ${dir}/* ${dir}$N
|
||||
for script in ${dir}$N/* ; do
|
||||
# Overwrite existing symlinks, files, and dirs
|
||||
sed -e 's/ln *-sv/&f/g' \
|
||||
-e 's/mv *-v/&f/g' \
|
||||
-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
|
||||
mv ${script} ${script}$N
|
||||
done
|
||||
# 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
|
||||
|
||||
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
|
||||
this_script=`basename $file`
|
||||
|
||||
# Skip the "stripping" scripts if the user does not want to strip.
|
||||
# Skip also linux-headers in iterative builds.
|
||||
# Some scripts need peculiar actions:
|
||||
# - 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
|
||||
*stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
|
||||
*stripping*) [[ "${STRIP}" = "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
|
||||
# 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.
|
||||
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
|
||||
|
||||
# Find the tarball corresponding to our script.
|
||||
# If it doesn't, we skip it in iterations rebuilds (except stripping).
|
||||
pkg_tarball=$(get_package_tarball_name $name)
|
||||
pkg_version=$(get_package_version $pkg_tarball)
|
||||
# Find the name of the tarball and the version of the package
|
||||
# If it doesn't exist, we skip it in iterations rebuilds (except stripping
|
||||
# and revisedchroot, where .a and .la files are removed).
|
||||
pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
|
||||
pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
|
||||
|
||||
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
|
||||
case "${this_script}" in
|
||||
*stripping*) ;;
|
||||
*stripping*|*cleanup*|*revised*) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Append each name of the script files to a list (this will become
|
||||
# the names of the targets in the Makefile)
|
||||
# The kernfs script must be run as part of SUDO target.
|
||||
# Append the name of the script to a list. The name of the
|
||||
# list is contained in the variable Makefile_target. We adjust this
|
||||
# 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
|
||||
*kernfs) runasroot="$runasroot ${this_script}" ;;
|
||||
*) chapter6="$chapter6 ${this_script}" ;;
|
||||
*settingenvironment) Makefile_target=LUSER_TGT ;;
|
||||
*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
|
||||
eval $Makefile_target=\"\$$Makefile_target ${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.
|
||||
# In the mount of kernel filesystems we need to set LFS
|
||||
# and not to use chroot.
|
||||
case "${this_script}" in
|
||||
*kernfs) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
|
||||
*) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
|
||||
case $Makefile_target in
|
||||
CHROOT_TGT) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
|
||||
*) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
|
||||
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
|
||||
# Touch timestamp file if installed files logs shall be created.
|
||||
# But only for the final install chapter and not when rebuilding it
|
||||
if [ "${INSTALL_LOG}" = "y" ] &&
|
||||
(( 1+nb_chaps <= $1 )) &&
|
||||
[ "x$N" = x ] ; then
|
||||
CHROOT_wrt_TouchTimestamp
|
||||
fi
|
||||
CHROOT_Unpack "$pkg_tarball"
|
||||
# If the testsuites must be run, initialize the log file
|
||||
case $name in
|
||||
binutils | gcc | glibc | gmp | mpfr )
|
||||
[[ "$TEST" != "0" ]] &&
|
||||
CHROOT_wrt_test_log "${this_script}" "$pkg_version"
|
||||
;;
|
||||
* )
|
||||
[[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] &&
|
||||
CHROOT_wrt_test_log "${this_script}" "$pkg_version"
|
||||
;;
|
||||
# Always initialize the test log file, since the test instructions may
|
||||
# be "uncommented" by the user
|
||||
case $Makefile_target in
|
||||
CHROOT_TGT) CHROOT_wrt_test_log "${this_script}" "$pkg_version" ;;
|
||||
LUSER_TGT ) LUSER_wrt_test_log "${this_script}" "$pkg_version" ;;
|
||||
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
|
||||
# and not to use chroot.
|
||||
# If using optimizations, write the instructions
|
||||
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
|
||||
*kernfs) wrt_RunAsRoot "$file" "$pkg_version" ;;
|
||||
*) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
|
||||
*addinguser)
|
||||
(
|
||||
# /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
|
||||
|
||||
# Write installed files log and remove the build directory(ies)
|
||||
# except if the package build fails.
|
||||
if [ "$pkg_tarball" != "" ] ; then
|
||||
case "${name}" in
|
||||
*xz-utils) CHROOT_wrt_RemoveBuildDirs "xz" ;;
|
||||
*) CHROOT_wrt_RemoveBuildDirs "$name" ;;
|
||||
esac
|
||||
if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
||||
CHROOT_wrt_LogNewFiles "$name"
|
||||
if [ "${INSTALL_LOG}" = "y" ] &&
|
||||
(( 1+nb_chaps <= $1 )) &&
|
||||
[ "x${N}" = "x" ] ; then
|
||||
CHROOT_wrt_LogNewFiles "${this_script}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -293,134 +214,59 @@ chapter6_Makefiles() {
|
|||
|
||||
# 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/*
|
||||
# Set "system_build" var for iteration targets
|
||||
if [ -z "$N" ] && (( 1+nb_chaps == $1 )); then
|
||||
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() { #
|
||||
#----------------------------#
|
||||
|
||||
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.tmp
|
||||
|
||||
chapter4_Makefiles
|
||||
chapter5_Makefiles
|
||||
chapter6_Makefiles
|
||||
# Add the iterations targets, if needed
|
||||
[[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
||||
chapter78_Makefiles
|
||||
# Ensure the first dependency is empty
|
||||
unset PREV
|
||||
|
||||
# We begin with the SETUP target; successive targets will be assigned in
|
||||
# the chapter_targets function.
|
||||
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
|
||||
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
|
||||
|
||||
|
@ -443,12 +289,41 @@ build_Makefile() { #
|
|||
i=`expr $i + 1`
|
||||
done
|
||||
|
||||
# Drop in the main target 'all:' and the chapter targets with each sub-target
|
||||
# as a dependency.
|
||||
# If CPUSET is defined and not equal to "all", then we define a first target
|
||||
# that calls a script which re-enters make calling target all
|
||||
if [ -n "$CPUSET" ] && [ "$CPUSET" != all ]; then
|
||||
(
|
||||
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
|
||||
@echo $VERSION > lfs-release && \\
|
||||
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 && \\
|
||||
sudo mv lsb-release \$(MOUNT_PT)/etc && \\
|
||||
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)
|
||||
|
||||
ck_UID:
|
||||
|
@ -471,123 +355,174 @@ ck_UID:
|
|||
exit 1; \\
|
||||
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:
|
||||
@\$(call echo_SU_request)
|
||||
@sudo make save-luser
|
||||
@sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
|
||||
@touch \$@
|
||||
|
||||
mk_LUSER: mk_SETUP
|
||||
@\$(call echo_SULUSER_request)
|
||||
@( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER" )
|
||||
@sudo make restore-luser-env
|
||||
@\$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER"
|
||||
@sudo make restore-luser
|
||||
@touch \$@
|
||||
|
||||
mk_SUDO: mk_LUSER
|
||||
@sudo rm -f envars
|
||||
@sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
|
||||
@touch \$@
|
||||
|
||||
mk_CHROOT: mk_SUDO
|
||||
mk_CHROOT: mk_SUDO devices
|
||||
@\$(call echo_CHROOT_request)
|
||||
@( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
|
||||
@touch \$@
|
||||
|
||||
mk_BOOT: mk_CHROOT
|
||||
mk_BOOT: mk_CHROOT devices
|
||||
@\$(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 \$@
|
||||
|
||||
mk_BLFS_TOOL: create-sbu_du-report
|
||||
mk_BLFS_TOOL: create-sbu_du-report devices
|
||||
@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
||||
\$(call sh_echo_PHASE,Building BLFS_TOOL); \\
|
||||
(sudo \$(CHROOT2) -c "make -C $BLFS_ROOT/work"); \\
|
||||
(sudo \$(CHROOT1) -c "make -C $BLFS_ROOT/work"); \\
|
||||
fi;
|
||||
@touch \$@
|
||||
|
||||
mk_CUSTOM_TOOLS: mk_BLFS_TOOL
|
||||
mk_CUSTOM_TOOLS: mk_BLFS_TOOL devices
|
||||
@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
|
||||
\$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
|
||||
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;
|
||||
@touch \$@
|
||||
|
||||
devices: ck_UID
|
||||
sudo mount -v --bind /dev \$(MOUNT_PT)/dev
|
||||
sudo mount -vt devpts devpts \$(MOUNT_PT)/dev/pts
|
||||
sudo mount -vt proc proc \$(MOUNT_PT)/proc
|
||||
sudo mount -vt sysfs sysfs \$(MOUNT_PT)/sys
|
||||
sudo mount -vt tmpfs tmpfs \$(MOUNT_PT)/run
|
||||
if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
|
||||
sudo mkdir -p \$(MOUNT_PT)/\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
|
||||
sudo env LFS=\$(MOUNT_PT) kernfs-scripts/devices.sh
|
||||
EOF
|
||||
) >> $MKFILE
|
||||
# With systemd, the commands in chapter 9 do not create a
|
||||
# valid /etc/resolv.conf, so that if we want to enter chroot,
|
||||
# and systemd has not yet been run (otherwise /etc/resolv.conf
|
||||
# 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
|
||||
EOF
|
||||
) >> $MKFILE
|
||||
fi
|
||||
(
|
||||
cat << EOF
|
||||
|
||||
teardown:
|
||||
sudo umount -v \$(MOUNT_PT)/sys
|
||||
sudo umount -v \$(MOUNT_PT)/proc
|
||||
sudo umount -v \$(MOUNT_PT)/dev/pts
|
||||
if mountpoint -q \$(MOUNT_PT)/run; then \\
|
||||
sudo umount -v \$(MOUNT_PT)/run; \\
|
||||
elif [ -h \$(MOUNT_PT)/dev/shm ]; then \\
|
||||
link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
|
||||
sudo umount -v \$(MOUNT_PT)/\$\$link; \\
|
||||
unset link; \\
|
||||
else \\
|
||||
sudo umount -v \$(MOUNT_PT)/dev/shm; \\
|
||||
teardown:
|
||||
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 we want to enter chroot,
|
||||
# and systemd has not yet been run (otherwise /etc/resolv.conf
|
||||
# exists), we just copy resolv.conf from the host.
|
||||
# We need to remove it now, if it has been created.
|
||||
if [ "$INITSYS" = systemd ]; then
|
||||
(
|
||||
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
|
||||
sudo umount -v \$(MOUNT_PT)/dev
|
||||
EOF
|
||||
) >> $MKFILE
|
||||
fi
|
||||
(
|
||||
cat << EOF
|
||||
|
||||
chroot: devices
|
||||
sudo \$(CHROOT2)
|
||||
chroot1: devices
|
||||
-sudo \$(CHROOT1)
|
||||
\$(MAKE) teardown
|
||||
|
||||
SETUP: $chapter4
|
||||
LUSER: $chapter5
|
||||
SUDO: $runasroot
|
||||
CHROOT: SHELL=/tools/bin/bash
|
||||
CHROOT: $chapter6
|
||||
BOOT: $chapter78
|
||||
CUSTOM_TOOLS: $custom_list
|
||||
chroot: devices
|
||||
-sudo \$(CHROOT1)
|
||||
\$(MAKE) teardown
|
||||
|
||||
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
|
||||
@\$(call echo_message, Building)
|
||||
@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); \\
|
||||
fi;
|
||||
fi
|
||||
@touch \$@
|
||||
|
||||
restore-luser-env:
|
||||
save-luser:
|
||||
@\$(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*
|
||||
@LUSER_ID=\$\$(grep '^\$(LUSER):' /etc/passwd | cut -d: -f3); \\
|
||||
if [ -n "\$\$LUSER_ID" ]; then \\
|
||||
if [ ! -d \$(LUSER_HOME).XXX ]; then \\
|
||||
mv \$(LUSER_HOME){,.XXX}; \\
|
||||
mkdir \$(LUSER_HOME); \\
|
||||
chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
|
||||
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)
|
||||
|
||||
do_housekeeping:
|
||||
@-umount \$(MOUNT_PT)/sys
|
||||
@-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;
|
||||
|
||||
@-rm -f /tools
|
||||
|
||||
EOF
|
||||
) >> $MKFILE
|
||||
|
|
353
LICENSE
353
LICENSE
|
@ -1,340 +1,19 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
Copyright (C) 2005-2019, jhalfs team
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
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
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
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.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
|
|
29
Makefile
29
Makefile
|
@ -1,36 +1,23 @@
|
|||
# From the Build Scripts Written By: Jim Gifford <lfs@jg555.com>
|
||||
# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org
|
||||
# Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
|
||||
# Manuel Canales Esparcia
|
||||
# Pierre Labastie
|
||||
|
||||
TOPDIR=$(shell pwd)
|
||||
CONFIG_CONFIG_IN = Config.in
|
||||
CONFIG = menu
|
||||
|
||||
all: menuconfig
|
||||
# @clear
|
||||
@`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' `
|
||||
@$$(grep RUN_ME configuration 2>/dev/null | sed -e 's@RUN_ME=\"@@' -e 's@\"@@')
|
||||
|
||||
$(CONFIG)/conf:
|
||||
$(MAKE) -C $(CONFIG) conf
|
||||
|
||||
$(CONFIG)/mconf:
|
||||
$(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)
|
||||
menuconfig:
|
||||
@cp -a configuration configuration.old 2>/dev/null || true
|
||||
@CONFIG_="" KCONFIG_CONFIG=configuration \
|
||||
python3 $(CONFIG)/menuconfig.py $(CONFIG_CONFIG_IN)
|
||||
|
||||
# Clean up
|
||||
|
||||
clean:
|
||||
rm -f configuration configuration.old error
|
||||
- $(MAKE) -C $(CONFIG) clean
|
||||
|
||||
clean-target:
|
||||
rm -f error
|
||||
- $(MAKE) -C $(CONFIG) clean
|
||||
|
||||
.PHONY: all menuconfig config clean clean-target
|
||||
.PHONY: all menuconfig clean
|
||||
|
|
472
README
472
README
|
@ -1,220 +1,371 @@
|
|||
$Id$
|
||||
|
||||
1. INTRODUCTION::
|
||||
|
||||
This collection of scripts, known as jhalfs, strives to create
|
||||
accurate makefiles from the Linux From Scratch book series XML files.
|
||||
This software is an evolution of the original "jhalfs-0.2" code developed
|
||||
by Jeremy Huntwork.
|
||||
The scripts in this directory implement an automation of the building
|
||||
of a GNU/LInux system, as described in the Linux From Scratch book series.
|
||||
The name of the project is jhalfs: in that name, "alfs" stands for
|
||||
"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 book(s) and, therefore, the configuration variables found in menuconfig
|
||||
interface will have meaning to you.
|
||||
The list of supported books can be found at
|
||||
http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks (maybe outdated,
|
||||
current develoment books and latest version are always supported).
|
||||
|
||||
The list of supported books can be found at
|
||||
http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks
|
||||
The documentation is split among various README.* files. Here is a list
|
||||
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::
|
||||
*. The resulting Makefile takes considerable time to run to completion.
|
||||
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.
|
||||
Other sources of information are the context help in the menu interface,
|
||||
and the LFS books themselves (both required readings of course!).
|
||||
|
||||
2. PREREQUISITES::
|
||||
|
||||
To use this tool you MUST:
|
||||
|
||||
- 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.
|
||||
It is strongly advised that you first build manually a complete system
|
||||
before attempting to automate the build.
|
||||
|
||||
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::
|
||||
|
||||
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::
|
||||
|
||||
We have installed the familiar menu based configuration tool driven by
|
||||
GNU make. see the section RUNNING, for details
|
||||
4.1. CONFIGURATION OF THE TOOLS:
|
||||
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::
|
||||
|
||||
The command <make> will launch a menu based configuration program. You will
|
||||
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::
|
||||
IMPORTANT::
|
||||
You must be logged as a normal user with sudo privileges to run
|
||||
the Makefile. Furthermore, you are supposed to have enough privilege
|
||||
to become any user. If you are not bothered about security issues,
|
||||
the entry for the user "jhalfs_user" in /etc/sudoers could be
|
||||
jhalfs_user ALL=(ALL) NOPASSWD:ALL
|
||||
the Makefile. Furthermore, you are supposed to have enough privilege
|
||||
to become any user. If you are not bothered about security issues,
|
||||
the entry for the user running the tool in /etc/sudoers could be
|
||||
<user> ALL=(ALL) NOPASSWD:ALL
|
||||
|
||||
NOTE::
|
||||
If you run the jhalfs script directly the only function you can select
|
||||
is to display the version number running <./jhalfs -v>
|
||||
The command <make> will launch a menu based configuration program,
|
||||
similar to the kernel "menuconfig" configuration tool.
|
||||
|
||||
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
|
||||
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.
|
||||
MENU "BOOK Settings"
|
||||
|
||||
(TODO: is this relevant to present CLFS?)
|
||||
WARNING:: If you add blfs-tool support on a CLFS Sysroot build
|
||||
you MUST edit the scripts to fix the installation paths.
|
||||
Use BOOK: You have three choices: LFS System V, LFS systemd, BLFS.
|
||||
The BLFS part is described in README.BLFS
|
||||
|
||||
After booting the new xLFS system some steps are needed to finish
|
||||
the installation of the automated tools:
|
||||
Book version: You have two choices: "Branch" or "Working Copy"
|
||||
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
|
||||
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.
|
||||
Multilib: Four choices: Normal LFS, Multilib with i686 libraries,
|
||||
multilib with x32 libraries, multilib with all libraries.
|
||||
It is recommended to use "Normal LFS" unless you know what you
|
||||
are doing
|
||||
|
||||
- Move /blfs-root to that user's home and change ownership of the
|
||||
directory and files to the user.
|
||||
Build method: two choices: chroot (as in book), boot
|
||||
Presently, the "boot" method is not implemented, so keep the default.
|
||||
|
||||
- Give the user read and write privileges over the $TRACKING_DIR
|
||||
directory and the files that it contains.
|
||||
Add blfs-tools support (see README.BLFS)
|
||||
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
|
||||
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.
|
||||
Add custom tools support (see README.CUSTOM)
|
||||
|
||||
- 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.
|
||||
MENU "General Settings"
|
||||
|
||||
We assume that blfs-tool will be used on a running fresh xLFS system.
|
||||
To use it to build BLFS packages from the chroot jail is also possible,
|
||||
but not supported.
|
||||
Build Directory: the name of the root of the LFS system
|
||||
This is the equivalent of the LFS variable in the book. Set it
|
||||
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
|
||||
/clfs.xsl
|
||||
MENU "Build Settings"
|
||||
|
||||
/CLFS2/master.sh
|
||||
/clfs2.xsl
|
||||
MENU Parallelism settings
|
||||
- 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
|
||||
/clfs3.xsl
|
||||
Run testsuites: say y to run the test suites
|
||||
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
|
||||
/hlfs.xsl
|
||||
Package management: see README.PACKAGE_MANAGEMENT
|
||||
|
||||
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.xsl
|
||||
|
||||
/common/common_functions
|
||||
/common/chroot.xsl
|
||||
/common_functions
|
||||
/create-sbu_du-report.sh
|
||||
/hostreqs.xsl
|
||||
/kernfs.xsl
|
||||
/makefile_functions
|
||||
/packages.xsl
|
||||
/urls.xsl
|
||||
/create-sbu_du-report.sh
|
||||
/progress_bar.sh
|
||||
/blfs-tool-deps/9xx-*
|
||||
/urls.xsl
|
||||
/libs/func_*
|
||||
|
||||
/custom/template
|
||||
/config/
|
||||
/examples/*
|
||||
/examples_CLFS-E/*
|
||||
/custom/examples/*
|
||||
/config/* (needs to be created after cloning since it is an
|
||||
empty directory initially)
|
||||
/template
|
||||
|
||||
/extras/do_copy_files
|
||||
/do_ica_prep
|
||||
/do_ica_work
|
||||
/farce
|
||||
/filelist
|
||||
|
||||
/menu/*
|
||||
|
||||
/optimize/opt_config
|
||||
/opt_override
|
||||
/optimize_functions
|
||||
/opt_config.d/noOpt
|
||||
/noSymbols
|
||||
/O2pipe
|
||||
/O3pipe
|
||||
/O3pipe_march
|
||||
/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.BLFS
|
||||
README.CLFS
|
||||
README.HLFS
|
||||
README.CUSTOM
|
||||
README.PACKAGE_MANAGEMENT
|
||||
TODO
|
||||
LICENSE
|
||||
|
||||
Config.in
|
||||
Makefile
|
||||
jhalfs
|
||||
blfs-tool
|
||||
Makefile
|
||||
|
||||
8. FAQ::
|
||||
Q. "This 'help' file is very sparse"
|
||||
A. Yes, it is. This tool, jhalfs, is for those who understand the LFS books
|
||||
and wish to automate the build. 99% of any problems that arise can be
|
||||
solved by reading the book(s).
|
||||
|
||||
Q. "It doesn't work!"
|
||||
A. Yes it does, try >> make
|
||||
Remember you must have 'sudo' privileges.
|
||||
|
||||
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.
|
||||
7. FAQ::
|
||||
Q. "It doesn't work"
|
||||
A. There are several reasons why it may be so. One possibility is the
|
||||
following: jhalfs was designed to work against the development versions
|
||||
of the LFS series of books. Consequently changes in a book sometimes
|
||||
break older versions of jhalfs. Before you start pulling out your hair,
|
||||
download the latest version of jhalfs to see if that solves your
|
||||
problem. Note that it may be the other way around. If you want to build
|
||||
an old version of the book, you may have to downgrade your jhalfs
|
||||
version.
|
||||
|
||||
Q. "How do I specify the build location?"
|
||||
A. The original LFS document worked against the well known location /mnt/lfs.
|
||||
This script automates the build of all of the LFS series of books and uses
|
||||
a generic location $BUILDDIR with a default value of /mnt/build_dir.
|
||||
You may change this value to suit your needs.
|
||||
A. The original LFS document worked against the well known location
|
||||
/mnt/lfs. This script automates the build of all of the LFS series of
|
||||
books and uses a generic location $BUILDDIR with a default value of
|
||||
/mnt/build_dir. You may change this value to suit your needs.
|
||||
|
||||
The layout below $BUILDDIR is as follows.
|
||||
$BUILDDIR/
|
||||
jhalfs (Makefile, cmd scripts, logs, etc..)
|
||||
sources (where packages reside)
|
||||
tools (temporary bootstrap system)
|
||||
cross-tools (temporary CLFS only)
|
||||
tools (temporary cross compiler)
|
||||
...
|
||||
FHS dir structure
|
||||
...
|
||||
|
@ -222,10 +373,10 @@ $Id$
|
|||
|
||||
Q. "What is the function of the SRC_ARCHIVE variable?"
|
||||
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
|
||||
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
|
||||
the directory any downloaded files will be mirrored there.
|
||||
|
||||
|
@ -238,37 +389,9 @@ $Id$
|
|||
|
||||
Q. "Why have 2 copies of the files?"
|
||||
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
|
||||
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..)
|
||||
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.
|
||||
|
||||
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
|
||||
|
@ -286,3 +409,4 @@ $Id$
|
|||
Authors:
|
||||
George Boudreau
|
||||
Manuel Canales Esparcia
|
||||
Pierre Labastie
|
||||
|
|
422
README.BLFS
422
README.BLFS
|
@ -1,11 +1,5 @@
|
|||
$Id$
|
||||
|
||||
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
|
||||
task. Some of the issues are: the BLFS book isn't linear; some package
|
||||
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,
|
||||
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::
|
||||
|
||||
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
|
||||
- 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, BLFS command bug, or jhalfs code bug)
|
||||
You should also have the following personal skills:
|
||||
- Ability to write and debug shell scripts: as said in the introduction,
|
||||
not all the generated scripts can be used directly. They need to be
|
||||
edited to produce an error free build.
|
||||
- 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
|
||||
generation is done in several steps:
|
||||
Select "Use Book --> Beyond Linux From Scratch" in the jhalfs menu:
|
||||
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
|
||||
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
|
||||
initialized when <make> is first run in blfs_root. It resides in a
|
||||
directory, which is created when needed during the process of building
|
||||
custom tools or blfs dependencies, right after xLFS. You can specify
|
||||
that directory location in the blfs-tools submenu of jhalfs. You may
|
||||
custom tools or blfs dependencies, right after LFS. You can specify
|
||||
that directory location in the blfs-tools sub-menu of jhalfs. You may
|
||||
need to update permissions and/or ownership of this directory before
|
||||
using the blfs tool (see README in jhalfs).
|
||||
|
||||
The default location of the tracking directory is /var/lib/jhalfs/BLFS.
|
||||
NB : after the initial build, that directory is only used to contain
|
||||
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
|
||||
included into instpkg.xml the next time the tool is run.
|
||||
|
||||
3.2 BLFS_TOOL INSTALLATION::
|
||||
|
||||
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
|
||||
4. USAGE::
|
||||
|
||||
From now on, all the work must be done from inside the installation
|
||||
root directory.
|
||||
|
||||
You may move that directory to the $HOME of a non root user, or build
|
||||
as root from that directory.
|
||||
Due to the complexity of the BLFS book, the scripts and Makefile
|
||||
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
|
||||
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
|
||||
you just built xLFS, and you can skip to step 3.4.
|
||||
|
||||
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.
|
||||
update the XML sources and packages database. To do that, run
|
||||
"make update". This is not necessary if you just built LFS, and you
|
||||
can skip to step 4.2.
|
||||
|
||||
On the next configuration run, packages already installed but listed
|
||||
with a new version in the book will be available for target selection
|
||||
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
|
||||
build order for one or several packages.
|
||||
|
||||
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
|
||||
used to solve alternatives are set (currently, only for the MTA). You can
|
||||
also select whether the build will be made as a normal user or as root.
|
||||
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
|
||||
In the package selection block, menus and submenus are organized
|
||||
as the book's parts, chapters and sections. You can navigate those menus
|
||||
and select as many targets as you want. But we suggest to not select
|
||||
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
|
||||
generated. When circular dependencies are found, a 3 line message is
|
||||
printed:
|
||||
A is a dependency of B
|
||||
C is a dependency of A
|
||||
A is a dependency of C
|
||||
and a question:
|
||||
Do you want to build A first?
|
||||
This means that the system has found the dependency chain: B->A->C->A.
|
||||
You have therefore to choose whether A is built before C, or
|
||||
C before A: the system cannot make that choice (well, maybe in a few
|
||||
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
|
||||
of B, then the tree dependency restarts from there, that is with the
|
||||
layout B->C->... You may then hit the case B->C->A->C, for which you
|
||||
should answer no, unless you want to enter an infinite (human driven)
|
||||
loop;-)
|
||||
In the "Build settings" submenu, the dependency level and default
|
||||
packages used to solve alternatives are set (currently, only for the MTA).
|
||||
You can also select whether the build will be made as a normal user or as
|
||||
root, whether to use "porg style" package management, whether to remove
|
||||
".la" files, and wheter statistics for the package are generated (build
|
||||
time, memory footprint and "DESTDIR" install). If you use package
|
||||
management, you have to enter the path to the packInstall.sh script too.
|
||||
|
||||
In the "Build layout" submenu, you can select where the source tarballs
|
||||
reside and are downloaded, where the packages are built, and whether to
|
||||
keep the build tree after installation.
|
||||
|
||||
In the "Optimization" submenu, you can select the number of parallel
|
||||
jobs, and set the usual CFLAGS, CXXFLAGS, and LDFLAGS. the special
|
||||
keyword "EMPTY" can be used for those flags to ensure they are unset.
|
||||
|
||||
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,
|
||||
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
|
||||
scriptlets.
|
||||
|
||||
There is also another directory, "dependencies" that contains files
|
||||
There is yet another directory, "dependencies" that contains files
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
Also, review and edit envars.conf. This file is used to set global envars
|
||||
needed by the build scripts.
|
||||
|
||||
3.6 CREATING THE MAKEFILE::
|
||||
4.4 CREATING THE MAKEFILE::
|
||||
|
||||
When the build scripts are ready to be run, the Makefile can be
|
||||
created. Create an empty directory (for example "mkdir work") and cd
|
||||
to that directory. Then run ../gen-makefile.sh
|
||||
created. Create an empty subdirectory (for example "mkdir work") and cd
|
||||
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
|
||||
"make".
|
||||
|
||||
4. GENERATED BUILD SCRIPTS ISSUES::
|
||||
5. GENERATED BUILD SCRIPTS ISSUES::
|
||||
|
||||
In this section, known issues with the generated build scripts are
|
||||
discussed. They are due to build procedures and/or BLFS layout
|
||||
particularities that we can't handle. In several cases, editing the
|
||||
build scripts is mandatory.
|
||||
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
|
||||
package by hand.
|
||||
You may also need to insert some build scripts created by you to resolve
|
||||
unhandled dependencies and/or to remove some script installing an unneeded
|
||||
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
|
||||
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.
|
||||
Normally, bootscript installation should work. On the other hand, the
|
||||
book does not give instruction for running them, so you might have to
|
||||
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
|
||||
edit the build script to fit the needs of your system. Sometimes, the
|
||||
bash startup files are modified (see for example the instructions for
|
||||
llvm). The shipped 'envars.conf' contains a line 'source /etc/profile',
|
||||
which ensures that the proper environment variables are used.
|
||||
For those packages that have a "Configuration" section, you should
|
||||
edit the build script to fit the needs of your system. Sometimes, the
|
||||
bash startup files are modified. The generated scripts contain a
|
||||
line 'source /etc/profile', which ensures that the proper environment
|
||||
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
|
||||
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
|
||||
support for individual packages, but not for patches nor *.wget and *.md5
|
||||
files.
|
||||
To build the whole Xorg7 chapter, select xinit. The (recommended)
|
||||
dependency chain brings in the whole set of Xorg packages.
|
||||
|
||||
If you have previously downloaded the patches, you must edit
|
||||
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
|
||||
5.5 PATCHES
|
||||
|
||||
Please, make sure that all scripts have the commands to download/apply
|
||||
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
|
||||
commands that require root privileges are run using sudo. Also make sure
|
||||
necessary root privilege commands are visible in your PATH. Or use
|
||||
the `Defaults secure_path=' in /etc/sudoers.
|
||||
necessary root privilege commands are visible in your PATH. The scripts
|
||||
ensure that /usr/sbin is appended to the user's PATH when running
|
||||
privileged commands.
|
||||
|
||||
For commands necessitating root privileges, the generated scripts wrap
|
||||
them with the construct:
|
||||
sudo -E sh << ROOT_EOF
|
||||
sudo -E sh -e << ROOT_EOF
|
||||
<commands to be executed as root with `$', ``', and `\' escaped>
|
||||
ROOT_EOF
|
||||
The -E switch ensures the whole environment is passed to the
|
||||
commands to be run with root privileges. It is effective only if the
|
||||
/etc/sudoers file contains `Defaults setenv', or SETENV in the user
|
||||
attributes. If you think it is a security issue, you may forbid this
|
||||
flag in /etc/sudoers, but then, you have to un-escape `$' for 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.
|
||||
The "-e" switch to sh ensures the command block exits with error if an
|
||||
error occurs. The "-E" switch to sudo ensures the whole environment is
|
||||
passed to the commands to be run with root privileges. It is effective
|
||||
only if the /etc/sudoers file contains `Defaults setenv', or SETENV in
|
||||
the user attributes (this is implicit if the command the user is allowed
|
||||
to run is `ALL'). If you think it is a security issue, you may forbid
|
||||
this flag in /etc/sudoers, but then, you have to un-escape `$' for
|
||||
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.
|
||||
|
||||
4.7 OTHERS
|
||||
5.7 OTHERS
|
||||
|
||||
There may be other issues that we are not aware of. If you find
|
||||
any, please report it to <alfs-discuss@linuxfromscratch.org>.
|
||||
|
|
44
README.CLFS
44
README.CLFS
|
@ -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.
|
128
README.CUSTOM
128
README.CUSTOM
|
@ -1,25 +1,21 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE
|
||||
|
||||
|
||||
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".
|
||||
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.
|
||||
|
||||
There is two areas that can be customized: how the base system is build
|
||||
and what additional configurations and packages requires your hardware to can
|
||||
boot and work with. Each one of this areas is handled in a different way.
|
||||
|
||||
There are two areas that can be customized: how the base system is built
|
||||
and what additional configurations and packages your hardware requires to be
|
||||
able to boot and run. Each of those areas are handled in a different way.
|
||||
|
||||
|
||||
|
||||
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.
|
||||
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
|
||||
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.
|
||||
|
||||
|
||||
EDITING THE BASE SCRIPTS
|
||||
|
||||
First step is to generate the build scripts with book defaults. To do that,
|
||||
configure jhalfs activating any option you want included, but do not select
|
||||
"Run the Makefile" option.
|
||||
To begin with, the build scripts should be generated with book defaults. To
|
||||
do that, configure jhalfs activating any option you want included, but do not
|
||||
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
|
||||
/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
|
||||
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
|
||||
${BUILD_DIR}/sources directory. When done, run 'make' from inside the
|
||||
${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 change the version of some package to build a newest or oldest one than the
|
||||
one found 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
|
||||
directory,
|
||||
To change the version of some package, or to build a newer or older version
|
||||
than that in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to
|
||||
change its tarball name and place the new tarball in the ${BUILD_DIR}/sources
|
||||
directory.
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
with Cracklib support, first you should decide before what default package it
|
||||
need be installed, in this example before 107-shadow. Then create a new script
|
||||
containing the needed commands, using an existing one as template, and name it with
|
||||
the same 3-digits string used for that mentioned default package, but adding
|
||||
another 1-digit string. In our example, the new script to build Cracklib just
|
||||
before Shadow will be named 107-1-cracklib. This naming schema allow to insert
|
||||
up to 10 scripts before each one of the default scripts. Place the tarball for
|
||||
the new package and required patches, if any, if ${BUILD_DIR}/sources and edit
|
||||
To insert a new package, for example to build Cracklib in order to build
|
||||
Shadow with Cracklib support, you should first decide before what package it
|
||||
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 the same 3-digits string used for that mentioned default package, but
|
||||
adding another 1-digit string. In our example, the new script to build Cracklib
|
||||
before Shadow will be named 107-1-cracklib. This naming scheme allows inserting
|
||||
up to 10 scripts before each of the existing scripts. Place the tarball for
|
||||
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
|
||||
package.
|
||||
|
||||
When ready, launch again the jhalfs configuration interface. Be sure that
|
||||
are selected exactly the same options than when generating the default build
|
||||
scripts. Be sure that "Rebuild files" is unselected and select "Run the Makefile"
|
||||
if you want. Then select "Rebuild the Makefile". This will create a new Makefile
|
||||
based on the changes you made to the build scripts.
|
||||
|
||||
|
||||
When ready, launch again the jhalfs configuration interface. Make sure that
|
||||
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" if you want. Then select "Rebuild the Makefile". This will create a
|
||||
new Makefile based on the changes you made to the build scripts.
|
||||
|
||||
|
||||
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
|
||||
configuration files, build the packages necessary to access the Internet
|
||||
or to support specific hardware, or to install basic utilities that need
|
||||
have available from the beginning, and was not intended to replace the BLFS
|
||||
or to support specific hardware, or to install basic utilities that are
|
||||
needed from the beginning, and was not intended to replace the BLFS
|
||||
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
|
||||
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 file which enables/disables the inclusion of personal scripts.
|
||||
configuration file which enables/disables the inclusion of custom scripts.
|
||||
|
||||
custom
|
||||
/config <-- where to put your scripts.
|
||||
/examples <-- a few example scripts
|
||||
/examples_CLFS-E <-- example scripts for CLFS-Embedded
|
||||
template <-- ALL scripts MUST look like this
|
||||
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -134,25 +121,36 @@ configuration file which enables/disables the inclusion of personal scripts.
|
|||
and rename it.
|
||||
|
||||
2. Populate the variables with the necessary values.
|
||||
Variable function is self explanatory except for the inclusion of the
|
||||
build cmds. If the package you want to include is found in the BLFS
|
||||
book then you only need to copy/paste the cmd strings between the xEOFx
|
||||
pairs, otherwise you will need to define the build cmds yourself.
|
||||
Variable function is self explanatory. PATCH variables must be
|
||||
numbered, starting at PATCH1 (up to PATCH10). If the md5 checksum value
|
||||
is known, it can be added after the URL as in (quotes needed):
|
||||
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
|
||||
all the information necessary for jhalfs to create a build script
|
||||
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
|
||||
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
|
||||
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
|
||||
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 -----------
|
||||
|
@ -175,7 +173,6 @@ for i in PATCH{1..10}; do
|
|||
done
|
||||
# Patches are named PATCH[1..10]
|
||||
# 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"
|
||||
|
||||
|
||||
|
@ -200,14 +197,12 @@ xEOFx
|
|||
|
||||
PKG="gpm"
|
||||
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"
|
||||
MD5="2c63e827d755527950d9d13fe3d87692"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
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"
|
||||
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
|
||||
) > tmp
|
||||
|
||||
|
|
11
README.HLFS
11
README.HLFS
|
@ -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.
|
|
@ -5,24 +5,48 @@ BY : Pierre Labastie (work in progress)
|
|||
|
||||
There are several hints discussing package management for LFS, but
|
||||
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
|
||||
inside jhalfs. I hope it is flexible enough to support several package
|
||||
managers. My implementation uses dpkg, from Debian, in a very crude way.
|
||||
Debian has a sophisticated package management system, which I have not
|
||||
tried to use here. For example, it should be usable with Pacman from
|
||||
Arch Linux (http://www.archlinux.org), as far as I remember from my old
|
||||
days with DIYL. I am sorry to say I have (almost) no experience with
|
||||
rpm, so I cannot tell whether it would fit.
|
||||
find now. So there was a need for such a tool, and an infrastructure,
|
||||
which allows using a package manager inside jhalfs, has been developped.
|
||||
I hope it is flexible enough to support several package managers, at least
|
||||
among those who use DESTDIR install and/or LD_PRELOAD during install.
|
||||
It has been tested with dpkg from Debian, pacman from Arch Linux,
|
||||
and porg. Sample configuration files are given for those three packages.
|
||||
I am sorry to say I have (almost) no experience with rpm, so I cannot
|
||||
tell whether it would fit.
|
||||
|
||||
2. OVERVIEW OF THE SYSTEM:
|
||||
|
||||
For now, package management is only available for LFS. I plan to
|
||||
upgrade BLFS tools, but nothing usable right now. I have not attempted
|
||||
to adapt this tool for the other flavours of LFS.
|
||||
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
|
||||
same as the one of the executed script. The path to this directory is
|
||||
available to the scriplets through the PKG_DEST variable.
|
||||
For now, package management is only available for LFS. The `porg style'
|
||||
(see below) package management has been ported to BLFS, but not the distro
|
||||
style one (the book layout makes it rather difficult).
|
||||
|
||||
This tool comes in two flavours:
|
||||
- for distros package managers (e.g dpkg or pacman), it basically performs
|
||||
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
|
||||
adds DESTDIR install instructions when "package management" is selected.
|
||||
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
|
||||
directory. Empty directories are then removed before packing the
|
||||
binary package.
|
||||
|
||||
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
|
||||
during the `Creating Directories' and `Creating Essential Files' stages.
|
||||
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.
|
||||
This file should reside in the `pkgmngt' directory and be named
|
||||
`packageManager.xml'. A template named `packageManager.xml.template' is
|
||||
provided in the `pkgmngt' subdirectory. There are also two XML files for
|
||||
dpkg and pacman, respectively `packageManager.xml.dpkg' and
|
||||
`packageManager.xml.pacman', that you can copy to `packageManager.xml'.
|
||||
provided in the `pkgmngt' subdirectory. There are also three XML files for
|
||||
dpkg, pacman, and porg, respectively `packageManager.xml.dpkg',
|
||||
`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.
|
||||
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
|
||||
`packInstall', which should pack the binary package and install it on the
|
||||
system. Note that nothing has been done to manage configuration files,
|
||||
|
||||
The last thing to do is to tell how to use the package manager. The user
|
||||
has to provide two functions, "wrapInstall" and "packInstall", as described
|
||||
above. Please note that nothing has been done to manage configuration files,
|
||||
which are ususally treated specially by package managers: depending on
|
||||
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
|
||||
upgrade. The user has to write his own `packInstall' function. The shell
|
||||
function should be defined in a file named `packInstall.sh', residing in
|
||||
the `pkgmngt' directory. A template is provided, as well as two example
|
||||
scripts for dpkg and pacman.
|
||||
upgrade. Both functions should be defined in a file named `packInstall.sh',
|
||||
residing in the `pkgmngt' directory. A template is provided (actually a copy
|
||||
of the file for dpkg), as well as three example scripts for dpkg, 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
19
TODO
|
@ -1,23 +1,6 @@
|
|||
jhalfs TODO
|
||||
---------------
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Remove RUN_ICA (it is redundant with COMPARE)
|
||||
BLFS MODULE (See BLFS/TODO)
|
||||
-----------
|
||||
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!-- $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">
|
||||
|
||||
<xsl:param name="jobs_2" select="1"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="//sect1"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="sect1">
|
||||
<xsl:if
|
||||
test="descendant::screen/userinput[starts-with(string(),'chroot')]">
|
||||
test="descendant::screen/userinput[contains(string(),'
chroot') or
|
||||
starts-with(string(),'chroot')]">
|
||||
<!-- The file names -->
|
||||
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
||||
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
||||
|
@ -39,14 +40,58 @@
|
|||
<!-- Creating dirs and files -->
|
||||
<exsl:document href="{$order}-{$filename}" method="text">
|
||||
<xsl:text>#!/bin/bash
</xsl:text>
|
||||
<xsl:apply-templates select=".//userinput[starts-with(string(),'chroot')]"/>
|
||||
<xsl:apply-templates
|
||||
select=".//userinput[contains(string(),'
chroot') or
|
||||
starts-with(string(),'chroot')]"/>
|
||||
<xsl:text>exit
</xsl:text>
|
||||
</exsl:document>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="userinput">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:call-template name="extract-chroot">
|
||||
<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,'
chroot')) and
|
||||
contains($instructions, '
chroot')">
|
||||
<xsl:call-template name="extract-chroot">
|
||||
<xsl:with-param name="instructions"
|
||||
select="substring(substring-after($instructions,
|
||||
substring-before($instructions,
|
||||
'
chroot')),2)"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($instructions,'\
')">
|
||||
<xsl:copy-of select="substring-before($instructions,'\
')"/>
|
||||
<xsl:text>\
|
||||
</xsl:text>
|
||||
<xsl:call-template name="extract-chroot">
|
||||
<xsl:with-param name="instructions"
|
||||
select="substring-after($instructions,'\
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($instructions,'
')">
|
||||
<xsl:copy-of select="substring-before($instructions,'
')"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="$instructions"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
|
@ -34,10 +32,12 @@ run_make() { #
|
|||
exit 1
|
||||
fi
|
||||
# Build the system
|
||||
if [ -e $MKFILE ] ; then
|
||||
if [ -e "$MKFILE" ] ; then
|
||||
echo -ne "Building the system...\n"
|
||||
cd $JHALFSDIR && make
|
||||
# if { echo try tty; tty; }; then
|
||||
cd "$JHALFSDIR" && make -j1
|
||||
echo -ne "done\n"
|
||||
# else echo there is no terminal!!; fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ clean_builddir() { #
|
|||
# Test if the clean must be done.
|
||||
if [ "${CLEAN}" = "y" ]; then
|
||||
# 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
|
||||
# Test to make sure that the build directory was populated by jhalfs
|
||||
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."
|
||||
exit 1
|
||||
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
|
||||
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
|
||||
# has generated an error message
|
||||
if [ -d $BUILDDIR/proc ] ; then
|
||||
|
@ -71,10 +79,10 @@ if [ "${CLEAN}" = "y" ]; then
|
|||
if [ -d $BUILDDIR/sys ] ; then
|
||||
sudo rmdir $BUILDDIR/sys || exit 1
|
||||
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}
|
||||
echo "done"
|
||||
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||
echo -n "Cleaning $BUILDDIR/$BLFS_ROOT ..."
|
||||
sudo rm -rf $BUILDDIR/$BLFS_ROOT
|
||||
echo "done"
|
||||
|
@ -85,31 +93,10 @@ if [ "${CLEAN}" = "y" ]; then
|
|||
echo -n "Cleaning remaining extracted sources in $BUILDDIR/sources ..."
|
||||
sudo rm -rf `find $BUILDDIR/sources -maxdepth 1 -mindepth 1 -type d`
|
||||
echo "done"
|
||||
echo -n "Removing dangling symlinks in / ..."
|
||||
sudo rm -f /tools /cross-tools
|
||||
echo "done"
|
||||
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 " ..."
|
||||
|
|
|
@ -1,33 +1,38 @@
|
|||
#!/bin/bash
|
||||
#$Id$
|
||||
|
||||
set -e
|
||||
|
||||
LOGSDIR=$1
|
||||
VERSION=$2
|
||||
DATE=$3
|
||||
|
||||
LINE="================================================================================"
|
||||
|
||||
# Make sure that we have a directory as first argument
|
||||
[[ ! -d "$LOGSDIR" ]] && \
|
||||
echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version]\n" && exit
|
||||
[ ! -d "$LOGSDIR" ] && \
|
||||
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
|
||||
[[ ! -f "$LOGSDIR"/000-masterscript.log ]] && \
|
||||
[ ! -f "$LOGSDIR"/000-masterscript.log ] && \
|
||||
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
|
||||
[[ -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
|
||||
# to the top level dir
|
||||
[[ -d "$LOGSDIR"/build_1 ]] && \
|
||||
[ -d "$LOGSDIR"/build_1 ] && \
|
||||
cp $LOGSDIR/build_1/* $LOGSDIR
|
||||
|
||||
# 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
|
||||
echo -e "\n`date`\n" > "$REPORT"
|
||||
|
@ -43,20 +48,30 @@ fi
|
|||
|
||||
# Dump CPU and memory info
|
||||
echo -e "\n\n\t\tCPU type:\n" >> "$REPORT"
|
||||
cat /proc/cpuinfo >> "$REPORT"
|
||||
lscpu >> "$REPORT"
|
||||
echo -e "\n\t\tMemory info:\n" >> "$REPORT"
|
||||
free >> "$REPORT"
|
||||
|
||||
# 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
|
||||
FIRSTLOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
|
||||
BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/???-binutils* | head -n1`
|
||||
FIRSTLOG=`grep -l "^Totalseconds:" * | sort -n | head -n1`
|
||||
BASELOG=`grep -l "^Totalseconds:" ???-binutils* | head -n1`
|
||||
echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
|
||||
SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
|
||||
echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n"
|
||||
echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT"
|
||||
popd
|
||||
# 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
|
||||
SBU2=0
|
||||
|
@ -71,7 +86,7 @@ for log in $BUILDLOGS ; do
|
|||
|
||||
# Start SBU calculation
|
||||
# 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')';`
|
||||
MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';`
|
||||
SBU=`perl -e 'printf "%.1f" , ('$TIME' / '$SBU_UNIT')';`
|
||||
|
@ -81,10 +96,10 @@ for log in $BUILDLOGS ; do
|
|||
|
||||
# Start disk usage calculation
|
||||
# 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')';`
|
||||
# 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')';`
|
||||
# Calculate disk space required to do the build
|
||||
REQUIRED1=`perl -e 'print ('$DU2' - '$DU1')';`
|
||||
|
@ -119,7 +134,7 @@ done
|
|||
# For printing the last 'Installed files disk usage', we need to 'du' the
|
||||
# root dir, excluding the jhalfs directory (and lost+found). We assume
|
||||
# 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')';`
|
||||
INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
|
||||
INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!-- $Id:$ -->
|
||||
<!-- Extracts minimal versions from LFS book host requirements,
|
||||
and generates a script containing statements of the
|
||||
form MIN_prog_VERSION=xx.yy.zz.
|
||||
|
@ -19,7 +18,7 @@
|
|||
<xsl:template match="emphasis">
|
||||
<!-- We assume that what is emphasized is in the form:
|
||||
aa...aa-dccsaaa (a anything except @, - "dash", d digit,
|
||||
c anything except space, s space)
|
||||
c anything except space, s space)
|
||||
or
|
||||
aa...aasdccsaaa
|
||||
This means we have to replace digits with @, and look for '-@'
|
||||
|
|
84
common/kernfs.xsl
Normal file
84
common/kernfs.xsl
Normal 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,'
')">
|
||||
<xsl:call-template name="check-mount">
|
||||
<xsl:with-param name="mytext"
|
||||
select="substring-before($mytext,'
')"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:call-template name="check-mount">
|
||||
<xsl:with-param name="mytext"
|
||||
select="substring-after($mytext,'
')"/>
|
||||
</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> && </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>
|
|
@ -1,53 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
#----------------------------#
|
||||
get_book() { #
|
||||
#----------------------------#
|
||||
cd $JHALFSDIR
|
||||
|
||||
if [ -z $WORKING_COPY ] ; then
|
||||
# Check for Subversion instead of just letting the script hit 'svn' and fail.
|
||||
test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
||||
if [ -z "$WORKING_COPY" ] ; then
|
||||
# Check for Subversion or git instead of just letting the script fail.
|
||||
test `type -p git` || eval "echo \"This feature requires Git.\"
|
||||
exit 1"
|
||||
echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
||||
|
||||
case $PROGNAME in
|
||||
lfs) svn_root="LFS" ;;
|
||||
hlfs) svn_root="HLFS" ;;
|
||||
clfs*) ;;
|
||||
*) echo "BOOK not defined in function <get_book>"
|
||||
exit 1 ;;
|
||||
esac
|
||||
echo -n "Downloading the lfs document, branch/tag/commit: $COMMIT... "
|
||||
|
||||
# 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
|
||||
# sources.
|
||||
if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
|
||||
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
||||
elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] || [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
|
||||
echo $TREE
|
||||
git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
||||
if [ ! $TREE == "development" ]; then
|
||||
cd ${PROGNAME}-$LFSVRS
|
||||
echo "Checking out $LFSVRS at $PWD in $TREE"
|
||||
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
|
||||
if [ ! -d "$BOOK"/.git ]; then
|
||||
git clone "$REPO" "$BOOK" >>"$LOGDIR/$LOG" 2>&1
|
||||
if [ "$COMMIT" != trunk ]; then
|
||||
pushd "$BOOK" >/dev/null
|
||||
echo "Checking out $COMMIT at $PWD"
|
||||
git checkout "$COMMIT" >>"$LOGDIR/$LOG" 2>&1
|
||||
popd >/dev/null
|
||||
fi
|
||||
else
|
||||
cd ${PROGNAME}-$LFSVRS
|
||||
case $PROGNAME in
|
||||
clfs*) git pull >>$LOGDIR/$LOG 2>&1
|
||||
if [ ! $TREE == "development" ]; then
|
||||
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
|
||||
fi
|
||||
;;
|
||||
lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
cd "$BOOK"
|
||||
# If the repo is in "detached head" state, git pull fails, so get
|
||||
# back first to trunk:
|
||||
git checkout trunk >>"$LOGDIR/$LOG" 2>&1
|
||||
git pull >>"$LOGDIR/$LOG" 2>&1
|
||||
if [ "$COMMIT" != "trunk" ]; then
|
||||
git checkout "$COMMIT" >>"$LOGDIR/$LOG" 2>&1
|
||||
fi
|
||||
fi
|
||||
echo -ne "done\n"
|
||||
|
||||
else
|
||||
else # Working copy
|
||||
echo -ne "Using $BOOK as book's sources ...\n"
|
||||
fi
|
||||
}
|
||||
|
@ -57,170 +45,136 @@ extract_commands() { #
|
|||
#----------------------------#
|
||||
|
||||
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
|
||||
rm -rf ${PROGNAME}-commands
|
||||
rm -rf "$COMMANDS"
|
||||
|
||||
# Extract the commands
|
||||
echo -n "Extracting commands for"
|
||||
case ${PROGNAME} in
|
||||
clfs)
|
||||
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
||||
xsltproc --nonet \
|
||||
--xinclude \
|
||||
--stringparam method $METHOD \
|
||||
--stringparam testsuite $TEST \
|
||||
--stringparam bomb-testsuite $BOMB_TEST \
|
||||
--stringparam vim-lang $VIMLANG \
|
||||
--stringparam timezone $TIMEZONE \
|
||||
--stringparam page $PAGE \
|
||||
--stringparam lang $LANG \
|
||||
--stringparam sparc $SPARC64_PROC \
|
||||
--stringparam x86 $TARGET \
|
||||
--stringparam mips $TARGET \
|
||||
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
||||
;;
|
||||
echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
|
||||
# The scripts pages are xincluded by the book, so must
|
||||
# be generated for running xsltproc
|
||||
pushd $BOOK > /dev/null
|
||||
if [ -f process-scripts.sh ]; then
|
||||
bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
|
||||
fi
|
||||
# Recent git versions need version.ent to be generated
|
||||
if [ -f git-version.sh ]; then
|
||||
bash git-version.sh "$INITSYS" >> $LOGDIR/$LOG 2>&1
|
||||
fi
|
||||
popd > /dev/null
|
||||
|
||||
clfs2)
|
||||
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
||||
xsltproc --nonet \
|
||||
--xinclude \
|
||||
--stringparam vim-lang $VIMLANG \
|
||||
--stringparam timezone $TIMEZONE \
|
||||
--stringparam page $PAGE \
|
||||
--stringparam lang $LANG \
|
||||
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
||||
;;
|
||||
if [ "$ALL_CORES" = "y" ]; then
|
||||
JOBS="\$(nproc)"
|
||||
else
|
||||
JOBS="$N_PARALLEL"
|
||||
fi
|
||||
if [ "$REALSBU" = y ]; then JOBSBP1=1; else JOBSBP1="$JOBS"; fi
|
||||
|
||||
clfs3)
|
||||
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
||||
xsltproc --nonet \
|
||||
--xinclude \
|
||||
--stringparam endian x$ENDIAN \
|
||||
--stringparam timezone $TIMEZONE \
|
||||
--stringparam page $PAGE \
|
||||
--stringparam lang $LANG \
|
||||
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-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
|
||||
# First profile the book, for revision and arch. Note that
|
||||
# MULTIBLIB is set to "default" if pure 64 bit book. In this case,
|
||||
# profiling on arch is useless, but does not hurt either.
|
||||
xsltproc --nonet \
|
||||
--xinclude \
|
||||
--stringparam profile.revision "$INITSYS" \
|
||||
--stringparam profile.arch "$MULTILIB" \
|
||||
--output prbook.xml \
|
||||
$BOOK/stylesheets/lfs-xsl/profile.xsl \
|
||||
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
||||
|
||||
# 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"
|
||||
|
||||
# Make the scripts executable.
|
||||
chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
||||
|
||||
# Create the packages file. We need it for proper Makefile creation
|
||||
create_package_list
|
||||
chmod -R +x "$JHALFSDIR/${COMMANDS}"
|
||||
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...
|
||||
get_sources
|
||||
|
||||
}
|
||||
|
||||
#----------------------------#
|
||||
create_package_list() { #
|
||||
create_chroot_scripts() { #
|
||||
#----------------------------#
|
||||
|
||||
# Create the packages file. We need it for proper Makefile creation
|
||||
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
|
||||
rm -rf chroot-scripts
|
||||
echo -n "Creating chroot commands scripts from $BOOK"
|
||||
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
||||
echo -n "... "
|
||||
case ${PROGNAME} in
|
||||
clfs*)
|
||||
xsltproc --nonet --xinclude \
|
||||
-o chroot-scripts/ chroot.xsl \
|
||||
$BOOK/BOOK/${ARCH}-index.xml >> $LOGDIR/$LOG 2>&1
|
||||
;;
|
||||
hlfs)
|
||||
xsltproc --nonet --xinclude \
|
||||
-o chroot-scripts/ chroot.xsl \
|
||||
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
||||
;;
|
||||
lfs)
|
||||
xsltproc --nonet --xinclude \
|
||||
-o chroot-scripts/ chroot.xsl \
|
||||
$BOOK/chapter06/chapter06.xml >> $LOGDIR/$LOG 2>&1
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
xsltproc --nonet --xinclude \
|
||||
--stringparam jobs_2 "$JOBS_2" \
|
||||
-o chroot-scripts/ chroot.xsl \
|
||||
$BOOK/chapter0?/*chroot*.xml >> $LOGDIR/$LOG 2>&1
|
||||
echo "done"
|
||||
|
||||
}
|
||||
|
||||
#----------------------------#
|
||||
create_kernfs_scripts() { #
|
||||
#----------------------------#
|
||||
|
||||
rm -rf kernfs-scripts
|
||||
mkdir kernfs-scripts
|
||||
echo -n "Creating virtual kernel FS commands scripts from $BOOK"
|
||||
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
||||
echo -n "... "
|
||||
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"
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# $Id$
|
||||
|
||||
check_version() {
|
||||
: <<inline_doc
|
||||
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 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
|
||||
|
||||
|
@ -51,10 +50,12 @@ inline_doc
|
|||
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}"
|
||||
IFS=".-(pab" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates)
|
||||
# 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
|
||||
ref_major=$1; ref_minor=$2; ref_revision=$3
|
||||
#
|
||||
|
@ -66,39 +67,35 @@ inline_doc
|
|||
#
|
||||
# Compare against minimum acceptable version..
|
||||
(( 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
|
||||
(( major < ref_major )) && write_error_and_die
|
||||
# major=ref_major
|
||||
(( minor < ref_minor )) && write_error_and_die
|
||||
(( 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
|
||||
# minor=ref_minor
|
||||
(( 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
|
||||
|
||||
# oops.. write error msg 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() { #
|
||||
#----------------------------#
|
||||
|
||||
case $PROGNAME in
|
||||
clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;;
|
||||
*) HOSTREQS="prologue/hostreqs.xml" ;;
|
||||
esac
|
||||
HOSTREQS=$(find $BOOK -name hostreqs.xml)
|
||||
|
||||
eval $(xsltproc $COMMON_DIR/hostreqs.xsl $BOOK/$HOSTREQS)
|
||||
eval $(xsltproc $COMMON_DIR/hostreqs.xsl $HOSTREQS)
|
||||
# Avoid translation of version strings
|
||||
local LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
# LFS/HLFS/CLFS prerequisites
|
||||
# LFS prerequisites
|
||||
if [ -n "$MIN_Linux_VER" ]; then
|
||||
check_version "$MIN_Linux_VER" "`uname -r`" "KERNEL"
|
||||
fi
|
||||
|
@ -106,10 +103,10 @@ check_prerequisites() { #
|
|||
check_version "$MIN_Bash_VER" "$BASH_VERSION" "BASH"
|
||||
fi
|
||||
if [ ! -z $MIN_GCC_VER ]; then
|
||||
check_version "$MIN_GCC_VER" "`gcc -dumpversion`" "GCC"
|
||||
check_version "$MIN_GCC_VER" "`g++ -dumpversion`" "G++"
|
||||
check_version "$MIN_GCC_VER" "`gcc -dumpfullversion -dumpversion`" "GCC"
|
||||
check_version "$MIN_GCC_VER" "`g++ -dumpfullversion -dumpversion`" "G++"
|
||||
elif [ ! -z $MIN_Gcc_VER ]; then
|
||||
check_version "$MIN_Gcc_VER" "`gcc -dumpversion`" "GCC"
|
||||
check_version "$MIN_Gcc_VER" "`gcc -dumpfullversion -dumpversion`" "GCC"
|
||||
fi
|
||||
if [ -n "$MIN_Glibc_VER" ]; then
|
||||
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
|
||||
check_version "$MIN_Xz_VER" "$(xz --version | head -n1 | cut -d" " -f4)" "XZ"
|
||||
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)"
|
||||
XSLTPROC_LOC="$(whereis -b xsltproc | cut -d" " -f2)"
|
||||
|
||||
|
||||
if [ ! -x $XMLLINT_LOC ]; then
|
||||
echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
||||
exit 1
|
||||
|
@ -225,31 +225,17 @@ inline_doc
|
|||
# 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 "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
|
||||
|
||||
|
||||
else
|
||||
echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
|
||||
exit 1
|
||||
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
|
||||
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'
|
||||
'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'>
|
||||
<article>
|
||||
|
@ -260,10 +246,17 @@ inline_doc
|
|||
</sect1>
|
||||
</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"
|
||||
else
|
||||
echo "Error: you need the Docbook XML DTD for installing BLFS tools"
|
||||
exit 2
|
||||
echo "Error: you need the Docbook XML DTD for running jhalfs"
|
||||
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
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# $Id$
|
||||
|
||||
#----------------------------------#
|
||||
wrt_compare_targets() { #
|
||||
#----------------------------------#
|
||||
|
@ -8,8 +6,9 @@ wrt_compare_targets() { #
|
|||
# and "ITERATIONS" with no "$".
|
||||
ITERATION=iteration-$N
|
||||
if [ "$N" != "1" ] ; then
|
||||
wrt_system_build "$N" "$PREV_IT"
|
||||
wrt_system_build "$1" "$N" "$PREV_IT"
|
||||
fi
|
||||
# add needed Makefile target
|
||||
this_script=$ITERATION
|
||||
CHROOT_wrt_target "$ITERATION" "$PREV"
|
||||
wrt_compare_work "$ITERATION" "$PREV_IT"
|
||||
|
@ -18,32 +17,33 @@ wrt_compare_targets() { #
|
|||
PREV_IT=$ITERATION
|
||||
PREV=$ITERATION
|
||||
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() { #
|
||||
#----------------------------------#
|
||||
local RUN=$1
|
||||
local PREV_IT=$2
|
||||
local CHAP=$1
|
||||
local RUN=$2
|
||||
local PREV_IT=$3
|
||||
|
||||
if [[ "$PROGNAME" = "clfs" ]] ; then
|
||||
final_system_Makefiles $RUN
|
||||
else
|
||||
chapter6_Makefiles $RUN
|
||||
fi
|
||||
chapter_targets $CHAP $RUN
|
||||
|
||||
if [[ "$PROGNAME" = "clfs" ]] ; then
|
||||
basicsystem="$basicsystem $PREV_IT $system_build"
|
||||
else
|
||||
chapter6="$chapter6 $PREV_IT $system_build"
|
||||
fi
|
||||
CHROOT_TGT="$CHROOT_TGT $PREV_IT $system_build"
|
||||
|
||||
if [[ "$RUN" = "$ITERATIONS" ]] ; then
|
||||
if [[ "$PROGNAME" = "clfs" ]] ; then
|
||||
basicsystem="$basicsystem iteration-$RUN"
|
||||
else
|
||||
chapter6="$chapter6 iteration-$RUN"
|
||||
fi
|
||||
CHROOT_TGT="$CHROOT_TGT iteration-$RUN"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -53,18 +53,19 @@ wrt_compare_work() { #
|
|||
local ITERATION=$1
|
||||
local PREV_IT=$2
|
||||
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 DEST_TOPDIR=/${SCRIPT_ROOT}
|
||||
local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
|
||||
local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
|
||||
|
||||
if [[ "$RUN_ICA" = "y" ]] ; then
|
||||
local DEST_ICA=$DEST_TOPDIR/ICA && \
|
||||
# the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
|
||||
(
|
||||
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
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
@ -72,19 +73,6 @@ EOF
|
|||
wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
|
||||
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
|
||||
}
|
||||
|
||||
#----------------------------------#
|
||||
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() { #
|
||||
#----------------------------------#
|
||||
|
@ -120,12 +97,12 @@ wrt_logs() { #
|
|||
for file in \`ls .\` ; do \\
|
||||
mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
||||
done ; \\
|
||||
fi ;
|
||||
fi
|
||||
@cd /\$(SCRIPT_ROOT)
|
||||
@if [ -d test-logs ] ; then \\
|
||||
cd test-logs && \\
|
||||
mkdir $build && \\
|
||||
mv -f ${system_build} $build && \\
|
||||
mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
|
||||
if [ ! $build = build_1 ] ; then \\
|
||||
cd $build && \\
|
||||
for file in \`ls .\` ; do \\
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
#----------------------------------#
|
||||
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
|
||||
# Create an entry for a self contained cmd script that does not
|
||||
# reference a package tarball
|
||||
case $PROGNAME in
|
||||
clfs2 | clfs3 )
|
||||
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
|
||||
CHROOT_wrt_target "${this_script}" "$PREV"
|
||||
CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
|
||||
wrt_touch
|
||||
|
||||
# Create the build script file
|
||||
|
@ -48,22 +38,11 @@ xEOFx
|
|||
|
||||
else
|
||||
# Create an entry for package
|
||||
case $PROGNAME in
|
||||
clfs2 | clfs3 )
|
||||
LUSER_wrt_target "${this_script}" "$PREV"
|
||||
LUSER_wrt_unpack "${PKG_FILE}"
|
||||
LUSER_wrt_RunAsUser "custom-tools/${this_script}"
|
||||
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
|
||||
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
|
||||
wrt_touch
|
||||
|
||||
# Create the build script file
|
||||
|
@ -93,7 +72,6 @@ xEOFx
|
|||
#----------------------------------#
|
||||
add_CustomToolsURLS() { # Add any users supplied scripts URL information
|
||||
#----------------------------------#
|
||||
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
|
||||
local this_script
|
||||
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
|
||||
[[ "x${PKG}" = "x" ]] && continue
|
||||
|
||||
echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
|
||||
echo "${URL} ${MD5}" >> urls.lst.tmp
|
||||
# Add any patches..
|
||||
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
|
||||
cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
|
||||
#----------------------------#
|
||||
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=""
|
||||
if [[ "${RETRYSRCDOWNLOAD}" = "y" ]] ; then
|
||||
|
@ -16,9 +16,6 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
|
|||
WGETPARAM+=" --tries ${RETRYDOWNLOADCNT}"
|
||||
WGETPARAM+=" --timeout ${DOWNLOADTIMEOUT}"
|
||||
|
||||
# Test if the packages must be downloaded
|
||||
[ ! "$GETPKG" = "y" ] && return
|
||||
|
||||
gs_wrt_message(){
|
||||
echo "${RED}$1${OFF}"
|
||||
echo "$1" >> MISSING_FILES.DMP
|
||||
|
@ -26,59 +23,44 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
|
|||
# Housekeeping
|
||||
[[ ! -d $BUILDDIR/sources ]] && mkdir $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
|
||||
create_urls
|
||||
|
||||
IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
|
||||
for line in `cat urls.lst`; do
|
||||
IFS=$saveIFS # Restore the system defaults
|
||||
# Clean up leftovers from preceding attempts
|
||||
>MISSING_FILES.DMP
|
||||
|
||||
# Skip some packages if they aren't needed
|
||||
case $line in
|
||||
*/tree* | */gcc-testsuite* ) #unneeded now?
|
||||
[[ "$TEST" = "0" ]] && continue
|
||||
;;
|
||||
*/vim-*-lang* )
|
||||
[[ "$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
|
||||
# Normally, urls.lst contains lines with two fields:
|
||||
# <package url> <book md5>, but
|
||||
# if a custom patch has an md5, there is a third field
|
||||
# on the line, due to the way add_CustomToolsURLS works.
|
||||
cat urls.lst | while read URL BOOKMD5 MAYBEMORE; do
|
||||
FILE=$(basename "$URL") # File name
|
||||
|
||||
# Validation pair
|
||||
MD5="$BOOKMD5 $FILE"
|
||||
HAVEMD5=1
|
||||
|
||||
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.
|
||||
if [ ! -z ${SRC_ARCHIVE} ] &&
|
||||
[ -d ${SRC_ARCHIVE} ] &&
|
||||
[ -f ${SRC_ARCHIVE}/$FILE ]; then
|
||||
cp ${SRC_ARCHIVE}/$FILE .
|
||||
if [ -n "${SRC_ARCHIVE}" ] &&
|
||||
[ -d "${SRC_ARCHIVE}" ] &&
|
||||
[ -f "${SRC_ARCHIVE}/$FILE" ]; then
|
||||
cp "${SRC_ARCHIVE}/$FILE" .
|
||||
echo "$FILE: -- copied from $SRC_ARCHIVE"
|
||||
fromARCHIVE=1
|
||||
else
|
||||
fromARCHIVE=0
|
||||
# If the file does not exist yet in /sources download a fresh one
|
||||
if [ ! -f $FILE ] ; then
|
||||
if [[ ! ("$SRC_ARCHIVE" = "") ]] ; then
|
||||
echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} or ${BUILDDIR}/sources${OFF}"
|
||||
# If the file does not exist yet in /sources, download a fresh one
|
||||
if [ ! -f "$FILE" ] ; then
|
||||
if [ -n "$SRC_ARCHIVE" ] ; then
|
||||
echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} nor in ${BUILDDIR}/sources${OFF}"
|
||||
else
|
||||
echo "${BOLD}${YELLOW}$FILE: not found in ${BUILDDIR}/sources${OFF}"
|
||||
fi
|
||||
if ! wget $URL1 $WGETPARAM && ! wget $URL2 $WGETPARAM ; then
|
||||
gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
|
||||
if ! wget "$URL" $WGETPARAM; then
|
||||
gs_wrt_message "$FILE not found on any server..SKIPPING"
|
||||
continue
|
||||
fi
|
||||
else
|
||||
|
@ -86,22 +68,22 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
|
|||
fi
|
||||
fi
|
||||
|
||||
# Deal with udev and bootscripts m5sum issue
|
||||
[[ $BOOKMD5 = "BOOTSCRIPTS-MD5SUM" ]] && continue
|
||||
[[ $BOOKMD5 = "UDEV-MD5SUM" ]] && continue
|
||||
[[ $BOOKMD5 = "LFS-NETSCRIPTS-MD5SUM" ]] && continue
|
||||
# Deal with bootscripts md5sum issue,
|
||||
# or skip if it is a custom patch without md5
|
||||
[ $BOOKMD5 = "BOOTSCRIPTS-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
|
||||
[[ $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" = 1 ] && echo "${BOLD}${YELLOW}MD5SUM did not match $SRC_ARCHIVE copy${OFF}"
|
||||
[ "$fromARCHIVE" = 0 ] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
|
||||
# Remove the old file and download a new one
|
||||
rm -fv $FILE
|
||||
rm -fv "$FILE"
|
||||
# Force storage in SRC_ARCHIVE
|
||||
fromARCHIVE=0;
|
||||
# Try to retrieve again the file. Servers in reverse order.
|
||||
if ! wget $URL2 $WGETPARAM && ! wget $URL1 $WGETPARAM ; then
|
||||
gs_wrt_message "$FILE not found on the servers.. SKIPPING"
|
||||
# Try to retrieve again the file.
|
||||
if ! wget "$URL" $WGETPARAM; then
|
||||
gs_wrt_message "$FILE not found on the server... SKIPPING"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
@ -114,7 +96,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
|
|||
fi
|
||||
|
||||
# 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 "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
|
||||
fi
|
||||
|
@ -124,12 +106,13 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
|
|||
|
||||
# Copy the freshly downloaded file
|
||||
# to the source archive.
|
||||
if [ ! -z ${SRC_ARCHIVE} ] &&
|
||||
[ -d ${SRC_ARCHIVE} ] &&
|
||||
[ -w ${SRC_ARCHIVE} ] &&
|
||||
[ "$fromARCHIVE" = "0" ] ; then
|
||||
if [ -n "${SRC_ARCHIVE}" ] &&
|
||||
[ -d "${SRC_ARCHIVE}" ] &&
|
||||
[ -w "${SRC_ARCHIVE}" ] &&
|
||||
[ ! -f "${SRC_ARCHIVE}/$FILE" ] &&
|
||||
[ "$fromARCHIVE" = 0 ] ; then
|
||||
echo "Storing file:<$FILE> in the package archive"
|
||||
cp -f $FILE ${SRC_ARCHIVE}
|
||||
cp -f "$FILE" "${SRC_ARCHIVE}"
|
||||
fi
|
||||
|
||||
done
|
||||
|
@ -147,38 +130,14 @@ create_urls() { #
|
|||
#----------------------------#
|
||||
cd $JHALFSDIR
|
||||
|
||||
case ${PROGNAME} in
|
||||
clfs*)
|
||||
echo -n "Creating CLFS <${ARCH}> specific URLs file"
|
||||
xsltproc --nonet --xinclude \
|
||||
--stringparam server $SERVER \
|
||||
--stringparam family clfs \
|
||||
-o $BUILDDIR/sources/urls.lst urls.xsl \
|
||||
$BOOK/BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
|
||||
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
|
||||
echo -n "Creating URLs file... "
|
||||
xsltproc --nonet --xinclude \
|
||||
--stringparam pkgmngt "$PKGMNGT" \
|
||||
--stringparam revision "$INITSYS" \
|
||||
--output ../sources/urls.lst \
|
||||
urls.xsl \
|
||||
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
||||
echo "OK"
|
||||
|
||||
cd $BUILDDIR/sources
|
||||
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
#----------------------------# Prepare BLFS_ROOT and extract
|
||||
install_blfs_tools() { # the scriptlets to build
|
||||
#----------------------------# the dependency tools
|
||||
set -e
|
||||
# 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 menu ${BUILDDIR}${BLFS_ROOT}
|
||||
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
||||
cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
||||
|
||||
# Clean-up
|
||||
make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
|
||||
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
|
||||
if [ "$WRAP_INSTALL" = y ]; then
|
||||
sed -e 's/PKGDIR/JH_UNPACKDIR/' \
|
||||
-e 's/PKG_DEST/JH_PKG_DIR/' \
|
||||
$PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
|
||||
fi
|
||||
|
||||
# Set some harcoded envars to their proper values
|
||||
sed -i s@tracking-dir@$TRACKING_DIR@ \
|
||||
${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
|
||||
sed -i s@trunk/BOOK@$BLFS_TREE@ \
|
||||
${BUILDDIR}${BLFS_ROOT}/Makefile
|
||||
${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh,gen_pkg_book.sh}
|
||||
|
||||
# If we have a working copy, copy it:
|
||||
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
|
||||
# book has already been validated, tmp is posterior to the others, and
|
||||
# validation will not be done again.
|
||||
cp -ruT --preserve=timestamps $BLFS_WC_LOCATION \
|
||||
${BUILDDIR}${BLFS_ROOT}/blfs-xml
|
||||
# sudo is needed because make (below) may already have been run and
|
||||
# may have put some files owned by root
|
||||
sudo cp -ruT --preserve=timestamps $BLFS_WC_LOCATION \
|
||||
${BUILDDIR}${BLFS_ROOT}/$BLFS_XML
|
||||
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
|
||||
# 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
|
||||
# has to be created
|
||||
sudo make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
|
||||
$BUILDDIR$BLFS_ROOT/packages.xml
|
||||
sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
|
||||
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)
|
||||
# mode, the tracking file has wrong path for DTD. Change it:
|
||||
|
@ -58,11 +85,6 @@ if [ "$DEP_LIBXSLT" = y ]; then
|
|||
else
|
||||
LINE_LIBXSLT='#CONFIG_libxslt is not set'
|
||||
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
|
||||
# if [ "$DEP_DBXML" = y ]; then
|
||||
# LINE_DBXML='CONFIG_DocBook=y'
|
||||
|
@ -89,58 +111,67 @@ if [ "$DEP_GPM" = y ]; then
|
|||
else
|
||||
LINE_GPM='#CONFIG_gpm is not set'
|
||||
fi
|
||||
if [ "$DEP_SVN" = y ]; then
|
||||
LINE_SVN='CONFIG_subversion=y'
|
||||
if [ "$DEP_GIT" = y ]; then
|
||||
LINE_GIT='CONFIG_git=y'
|
||||
else
|
||||
LINE_SVN='#CONFIG_subversion 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'
|
||||
LINE_GIT='#CONFIG_git is not set'
|
||||
fi
|
||||
|
||||
cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
|
||||
$LINE_OPENSSL
|
||||
$LINE_PYTHON
|
||||
$LINE_LIBXML
|
||||
$LINE_LIBXSLT
|
||||
$LINE_TIDY
|
||||
$LINE_WGET
|
||||
$LINE_SVN
|
||||
$LINE_GIT
|
||||
$LINE_GPM
|
||||
$LINE_LYNX
|
||||
$LINE_SUDO
|
||||
MAIL_SERVER=sendmail
|
||||
optDependency=2
|
||||
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
|
||||
# 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)
|
||||
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
|
||||
sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts
|
||||
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
|
||||
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 '/PACKAGE1=/,/^fi/p' \
|
||||
-e '/PATCH=/,/^fi/p' \
|
||||
-e '/URL=/,/^fi/p' \
|
||||
-e '/PACKAGE1=/,/^fi/{/^fi/a\
|
||||
[ ! -f "$JH_SRC_ARCHIVE/$PACKAGE1" ] && cp $PACKAGE1 $JH_SRC_ARCHIVE
|
||||
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
|
||||
chmod u+x $BUILDDIR$BLFS_ROOT/download_script
|
||||
|
||||
|
@ -148,7 +179,12 @@ chmod u+x $BUILDDIR$BLFS_ROOT/download_script
|
|||
pushd $BUILDDIR/sources
|
||||
# Remove `unpacked' files if some have been left
|
||||
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
|
||||
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
|
||||
# between 2 addresses, excluding either the first or the last one. So use
|
||||
# a loop for accumulating lines and deleting at the end.
|
||||
# Sorry for sed synthax.
|
||||
# Sorry for sed syntax.
|
||||
sed -i '\@^[[:space:]]*/etc/xml/catalog$@{
|
||||
n
|
||||
:a
|
||||
|
@ -174,16 +210,6 @@ fi
|
|||
if [ "$DEP_SUDO" = y ]; then
|
||||
sed -i '/cat.*pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
|
||||
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
|
||||
mkdir -p $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
|
||||
# updating to the end of the process, adding an 'update' target
|
||||
sed -i -e '/xsltproc/,+6d' \
|
||||
-e '/^all/s@$@ update@' \
|
||||
-e '/^all/i update:' \
|
||||
-e 's/touch/@touch/' Makefile
|
||||
cat >> Makefile << EOF
|
||||
update:
|
||||
update: all
|
||||
@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 \\
|
||||
--stringparam package \$\${file##*z-} \\
|
||||
-o track.tmp \\
|
||||
../xsl/bump.xsl \$(TRACKING_FILE); \\
|
||||
--stringparam package LFS-Release \\
|
||||
--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; \\
|
||||
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
|
||||
@touch \$@
|
||||
@echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
|
||||
|
|
83
common/libs/func_save.sh
Normal file
83
common/libs/func_save.sh
Normal 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
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
# $Id$
|
||||
|
||||
declare -r dotSTR=".................."
|
||||
|
||||
|
||||
|
@ -7,12 +5,10 @@ declare -r dotSTR=".................."
|
|||
validate_config() { # Are the config values sane (within reason)
|
||||
#----------------------------#
|
||||
: <<inline_doc
|
||||
Validates the configuration parameters. The global var PROGNAME selects the
|
||||
parameter list.
|
||||
Validates the configuration parameters.
|
||||
|
||||
input vars: none
|
||||
externals: color constants
|
||||
PROGNAME (lfs,hlfs,clfs,clfs2,clfs3,blfs)
|
||||
modifies: none
|
||||
returns: nothing
|
||||
on error: write text to console and dies
|
||||
|
@ -20,46 +16,33 @@ validate_config() { # Are the config values sane (within reason)
|
|||
inline_doc
|
||||
|
||||
# Common settings by Config.in sections and books family
|
||||
local -r BOOK_common="BOOK CUSTOM_TOOLS"
|
||||
local -r BOOK_clfsX="ARCH TARGET"
|
||||
local -r BOOK_common="COMMIT BOOK CUSTOM_TOOLS"
|
||||
local -r GENERAL_common="LUSER LGROUP LHOME BUILDDIR CLEAN GETPKG SRC_ARCHIVE \
|
||||
SERVER RETRYSRCDOWNLOAD RETRYDOWNLOADCNT DOWNLOADTIMEOUT \
|
||||
RETRYSRCDOWNLOAD RETRYDOWNLOADCNT DOWNLOADTIMEOUT \
|
||||
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 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"
|
||||
|
||||
# BOOK Settings by book
|
||||
local -r LFS_book="$BOOK_common 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"
|
||||
local -r LFS_book="$BOOK_common INITSYS BLFS_TOOL"
|
||||
|
||||
# Build Settings by book
|
||||
local -r LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE"
|
||||
local -r HLFS_build="$BUILD_chroot $BUILD_common"
|
||||
local -r CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
|
||||
local -r CLFS2_build="STRIP VIMLANG $BUILD_common"
|
||||
local -r CLFS3_build=" $BUILD_common"
|
||||
local -r LFS_build="$BUILD_chroot NCURSES5 $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
|
||||
|
||||
# System Settings by book
|
||||
local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT KEYMAP LOCAL LOG_LEVEL"
|
||||
|
||||
# Full list of books settings
|
||||
local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $ADVANCED_chroot $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 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 blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
|
||||
|
||||
# Additional variables
|
||||
local -r blfs_tool_PARAM_LIST="\
|
||||
BLFS_TREE BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR \
|
||||
DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_DBXML DEP_LYNX DEP_SUDO DEP_WGET \
|
||||
DEP_SVN DEP_GPM DEP_OPENSSL DEP_PYTHON"
|
||||
BLFS_COMMIT BLFS_ROOT BLFS_XML TRACKING_DIR \
|
||||
DEP_LIBXML DEP_LIBXSLT DEP_DBXML DEP_LYNX DEP_SUDO DEP_WGET \
|
||||
DEP_GIT DEP_GPM"
|
||||
local -r custom_tool_PARAM_LIST="TRACKING_DIR"
|
||||
|
||||
# Internal variables
|
||||
|
@ -80,6 +63,15 @@ inline_doc
|
|||
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() {
|
||||
# For parameters ending with a '+' failure causes a warning message only
|
||||
echo -n "`eval echo $PARAM_VALS`"
|
||||
|
@ -129,21 +121,19 @@ inline_doc
|
|||
}
|
||||
|
||||
set +e
|
||||
PARAM_GROUP=${PROGNAME}_PARAM_LIST
|
||||
for config_param in ${!PARAM_GROUP}; do
|
||||
for config_param in $lfs_PARAM_LIST; do
|
||||
case $config_param in
|
||||
# Envvars that depend on other settings to be displayed
|
||||
COMPARE) [[ ! "$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`" ;;
|
||||
BOMB_TEST) [[ ! "$TEST" = "0" ]] && 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`" ;;
|
||||
SERVER) [[ "$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`" ;;
|
||||
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
|
||||
LUSER) echo -e "`eval echo $PARAM_VALS`"
|
||||
|
@ -164,7 +154,7 @@ inline_doc
|
|||
# warning -z+ -w+
|
||||
SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;;
|
||||
# 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 ;;
|
||||
LHOME) validate_dir -z -d ;;
|
||||
|
||||
|
@ -176,7 +166,7 @@ inline_doc
|
|||
BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;;
|
||||
|
||||
# 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`"
|
||||
[[ -z "${!config_param}" ]] &&
|
||||
echo " -- Variable $config_param cannot be empty!" &&
|
||||
|
@ -184,7 +174,36 @@ inline_doc
|
|||
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`" ;;
|
||||
|
||||
esac
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# $Id$
|
||||
|
||||
#=== MAKEFILE HEADER ===
|
||||
|
||||
#----------------------------------#
|
||||
|
@ -27,24 +25,26 @@ SCRIPT_ROOT = $SCRIPT_ROOT
|
|||
|
||||
BASEDIR = \$(MOUNT_PT)
|
||||
SRCSDIR = \$(BASEDIR)/sources
|
||||
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
|
||||
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$COMMANDS
|
||||
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE
|
||||
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
|
||||
|
||||
crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands
|
||||
crCMDSDIR = /\$(SCRIPT_ROOT)/$COMMANDS
|
||||
crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE
|
||||
crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
|
||||
crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
|
||||
|
||||
SU_LUSER = sudo -u \$(LUSER) -i sh -c
|
||||
SU_LUSER = sudo -H -u \$(LUSER) sh -c
|
||||
LUSER_HOME = \$(LHOME)/\$(LUSER)
|
||||
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_CUSTOM_TOOLS = $CUSTOM_TOOLS
|
||||
ADD_BLFS_TOOLS = $BLFS_TOOL
|
||||
PKGMNGT = $PKGMNGT
|
||||
WRAP_INSTALL = $WRAP_INSTALL
|
||||
CPUSET = $CPUSET
|
||||
|
||||
|
||||
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 ====
|
||||
|
||||
#----------------------------------#
|
||||
|
@ -172,7 +76,7 @@ $i: $PREV
|
|||
@\$(call echo_message, Building)
|
||||
${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
|
||||
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
|
||||
@\$(PRT_DU) >>logs/\$@$version
|
||||
@ : > envars
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -193,7 +97,7 @@ $i: $PREV
|
|||
@\$(call echo_message, Building)
|
||||
${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
|
||||
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
|
||||
@\$(PRT_DU_CR) >>logs/\$@$version
|
||||
@ : > envars
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -206,8 +110,12 @@ EOF
|
|||
#----------------------------------#
|
||||
LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
|
||||
#----------------------------------#
|
||||
local FILE=$1
|
||||
local optSAVE_PREVIOUS=$2
|
||||
local FILE="$1"
|
||||
local optSAVE_PREVIOUS="$2"
|
||||
local version
|
||||
if [ "$3" != "" ]; then
|
||||
version=-"$3"
|
||||
fi
|
||||
|
||||
if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
|
||||
(
|
||||
|
@ -219,6 +127,7 @@ EOF
|
|||
|
||||
(
|
||||
cat << EOF
|
||||
@\$(PRT_DU) >>logs/\$@$version
|
||||
@\$(call unpack,$FILE)
|
||||
@\$(call get_pkg_root_LUSER)
|
||||
EOF
|
||||
|
@ -230,6 +139,10 @@ CHROOT_Unpack() { #
|
|||
#----------------------------------#
|
||||
local FILE=$1
|
||||
local optSAVE_PREVIOUS=$2
|
||||
local version
|
||||
if [ "$3" != "" ]; then
|
||||
version=-"$3"
|
||||
fi
|
||||
|
||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
||||
(
|
||||
|
@ -238,8 +151,10 @@ cat << EOF
|
|||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
fi
|
||||
|
||||
(
|
||||
cat << EOF
|
||||
cat << EOF
|
||||
@\$(PRT_DU_CR) >>logs/\$@$version
|
||||
@\$(call unpack2,$FILE)
|
||||
@\$(call get_pkg_root2)
|
||||
EOF
|
||||
|
@ -298,20 +213,10 @@ wrt_RunAsRoot() { # Some scripts must be run as root..
|
|||
fi
|
||||
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
|
||||
@export ${MOUNT_ENV}=\$(MOUNT_PT) && \\
|
||||
${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@$version 2>&1 && \\
|
||||
\$(PRT_DU) >>logs/\$@$version
|
||||
@export LFS=\$(MOUNT_PT) && \\
|
||||
$COMMANDS/`dirname $file`/\$@ >>logs/\$@$version 2>&1
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -328,8 +233,7 @@ LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log fil
|
|||
(
|
||||
cat << EOF
|
||||
@source ~/.bashrc && \\
|
||||
\$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@$version 2>&1 && \\
|
||||
\$(PRT_DU) >>logs/\$@$version
|
||||
\$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@$version 2>&1
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -345,8 +249,7 @@ CHROOT_wrt_RunAsRoot() { #
|
|||
(
|
||||
cat << EOF
|
||||
@source envars && \\
|
||||
\$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@$version 2>&1 && \\
|
||||
\$(PRT_DU_CR) >>logs/\$@$version
|
||||
\$(crCMDSDIR)/`dirname $file`/\$@ >>\$(crLOGDIR)/\$@$version 2>&1
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
||||
|
@ -407,10 +310,9 @@ EOF
|
|||
#----------------------------------#
|
||||
LUSER_wrt_LogNewFiles() { #
|
||||
#----------------------------------#
|
||||
local name=`echo ${1} | sed 's/[0-9]-//'`
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call log_new_files_LUSER,$name)
|
||||
@\$(call log_new_files_LUSER,$1)
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
@ -418,10 +320,9 @@ EOF
|
|||
#----------------------------------#
|
||||
CHROOT_wrt_LogNewFiles() { #
|
||||
#----------------------------------#
|
||||
local name=`echo ${1} | sed 's/[0-9]-//'`
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call log_new_files,$name)
|
||||
@\$(call log_new_files,$1)
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
|
||||
# $Id$
|
||||
|
||||
BOLD = "[0;1m"
|
||||
RED = "[1;31m"
|
||||
GREEN = "[0;32m"
|
||||
|
@ -34,21 +31,21 @@ define echo_SU_request
|
|||
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||
@echo $(BLUE)$@
|
||||
@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
|
||||
|
||||
define echo_SULUSER_request
|
||||
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||
@echo $(BOLD)$(BLUE)$@
|
||||
@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
|
||||
|
||||
define echo_CHROOT_request
|
||||
@echo $(BOLD)--------------------------------------------------------------------------------
|
||||
@echo $(BOLD)$(BLUE)$@
|
||||
@echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
||||
@echo a password is required
|
||||
@echo $(WHITE)You are going to CHROOT into $(MOUNT_PT)
|
||||
@echo a password may be required
|
||||
endef
|
||||
|
||||
define echo_message
|
||||
|
@ -115,6 +112,9 @@ define get_pkg_root2
|
|||
echo "export PKG_DEST=$(SRC)/$@" >> envars; \
|
||||
echo "source packInstall.sh" >> envars; \
|
||||
echo "export -f packInstall" >> envars; \
|
||||
if [ "$(WRAP_INSTALL)" = "y" ]; then \
|
||||
echo "export -f wrapInstall" >> envars; \
|
||||
fi; \
|
||||
fi;
|
||||
endef
|
||||
|
||||
|
@ -182,7 +182,7 @@ define echo_report
|
|||
echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
|
||||
echo ; \
|
||||
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 That will help us to keep more accurate SBU and ; \
|
||||
echo disk usage values into the book. Thanks. ; \
|
||||
|
@ -203,21 +203,15 @@ define echo_finished
|
|||
@echo $(tab_)- Mount the virtual kernel file systems.
|
||||
@echo
|
||||
@echo $(tab_)- Enter to the chroot using the command found
|
||||
@echo $(tab_)in the section -Entering the Chroot Environment-
|
||||
@echo $(tab_)except if building CLFS with METHOD=boot.
|
||||
@echo $(tab_)" in the section -Entering the Chroot Environment-"
|
||||
@echo $(tab_)" except if building with METHOD=boot."
|
||||
@echo
|
||||
@echo $(tab_)- Set a password for the root user.
|
||||
@echo
|
||||
@echo $(tab_)- Edit or create /etc/fstab,
|
||||
@echo $(tab_) " /etc/hosts,"
|
||||
@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 $(tab_)- Edit or create /etc/fstab and any other configuration file
|
||||
@echo $(tab_)" required to suit your needs."
|
||||
@echo
|
||||
@echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
|
||||
@echo $(tab_)- Set-up the boot loader.
|
||||
@echo
|
||||
@echo $(tab_)You can set-up the new boot-loader installed on the new system
|
||||
@echo $(tab_)or the host bootloader.
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||
|
||||
<!-- $Id$ -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<xsl:output method="text"/>
|
||||
|
||||
<!-- The libc model used for HLFS -->
|
||||
<xsl:param name="model" select="glibc"/>
|
||||
<!-- Should we include a package manager? -->
|
||||
<xsl:param name="pkgmngt" select="'n'"/>
|
||||
|
||||
<!-- The kernel series used for HLFS -->
|
||||
<xsl:param name="kernel" select="2.6"/>
|
||||
|
||||
<!-- Should we include a package manager -->
|
||||
<xsl:param name="pkgmngt" select="n"/>
|
||||
<!-- The system for LFS: sysv of systemd -->
|
||||
<xsl:param name="revision" select="'sysv'"/>
|
||||
|
||||
<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:apply-templates
|
||||
select="document('packageManager.xml')//sect1[@id='package']//para"/>
|
||||
|
@ -25,19 +22,13 @@
|
|||
</xsl:template>
|
||||
|
||||
<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:with-param name="url" select="ulink/@url"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<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:choose>
|
||||
<xsl:when test="contains($sub-url,'/') and
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
# $Id$
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -e
|
||||
|
||||
|
@ -15,11 +14,9 @@ declare -r ERASE_LINE=${CSI}$'2K'
|
|||
declare -r FRAME_OPEN=${CSI}$'2G['
|
||||
declare -r FRAME_CLOSE=${CSI}$'63G]'
|
||||
declare -r TS_POSITION=${CSI}$'65G'
|
||||
declare -r LINE_WRAP_OFF=${CSI}$'?7l'
|
||||
declare -r LINE_WRAP_ON=${CSI}$'?7h'
|
||||
declare -a RESET_LINE=${CURSOR_OFF}${ERASE_LINE}${FRAME_OPEN}${FRAME_CLOSE}
|
||||
declare -r 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 PREV_SEC=0
|
||||
|
||||
|
@ -49,22 +46,22 @@ write_or_exit "${RESET_LINE}${TS_POSITION}0 min. 0 sec"
|
|||
# loop forever..
|
||||
while true ; do
|
||||
|
||||
# Loop through the animation string
|
||||
for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do
|
||||
write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}"
|
||||
$SLEEP .12 # This value MUST be less than .2 seconds.
|
||||
done
|
||||
# Loop through the animation string
|
||||
for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do
|
||||
write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}"
|
||||
$SLEEP .12 # This value MUST be less than .2 seconds.
|
||||
done
|
||||
|
||||
# A BASH internal variable, the number of seconds the script
|
||||
# has been running. modulo convert to 0-59
|
||||
SEC=$(($SECONDS % 60))
|
||||
# A BASH internal variable, the number of seconds the script
|
||||
# has been running. modulo convert to 0-59
|
||||
SEC=$((SECONDS % 60))
|
||||
|
||||
# Detect rollover of the seconds.
|
||||
(( PREV_SEC > SEC )) && write_or_exit "${RESET_LINE}"
|
||||
PREV_SEC=$SEC
|
||||
# Detect rollover of the seconds.
|
||||
(( PREV_SEC > SEC )) && write_or_exit "${RESET_LINE}"
|
||||
PREV_SEC=$SEC
|
||||
|
||||
# Display the accumulated time. div minutes.. modulo seconds.
|
||||
write_or_exit "${TS_POSITION}$(($SECONDS / 60)) min. $SEC sec"
|
||||
# Display the accumulated time. div minutes.. modulo seconds.
|
||||
write_or_exit "${TS_POSITION}$((SECONDS / 60)) min. $SEC sec"
|
||||
done
|
||||
|
||||
exit
|
||||
|
|
36
common/run-in-cgroup.sh
Executable file
36
common/run-in-cgroup.sh
Executable 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
|
|
@ -1,29 +1,19 @@
|
|||
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||
|
||||
<!-- $Id$ -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<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? -->
|
||||
<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:apply-templates select="//ulink"/>
|
||||
<xsl:apply-templates select="//varlistentry[@revision=$revision
|
||||
or not(@revision)]//ulink"/>
|
||||
<xsl:if test="$pkgmngt='y'">
|
||||
<xsl:apply-templates
|
||||
select="document('packageManager.xml')//ulink"/>
|
||||
|
@ -34,11 +24,7 @@
|
|||
<!-- If some package doesn't have the predefined strings in their
|
||||
name, the next test must be fixed to match it also. Skip possible
|
||||
duplicated URLs due that may be splitted for PDF output -->
|
||||
<xsl:if test="(ancestor::varlistentry[@condition=$model]
|
||||
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
|
||||
<xsl:if test="(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
|
||||
contains(@url, '.tgz') or contains(@url, '.patch') or
|
||||
contains(@url, '.xz') or contains(@url, '.lzma')) and
|
||||
not(ancestor-or-self::*/@condition = 'pdf')">
|
||||
|
@ -48,16 +34,6 @@
|
|||
<xsl:with-param name="url" select="@url"/>
|
||||
</xsl:call-template>
|
||||
</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 -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(@url,'?')">
|
||||
|
@ -67,46 +43,6 @@
|
|||
<xsl:value-of select="@url"/>
|
||||
</xsl:otherwise>
|
||||
</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 -->
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="../following-sibling::para/literal"/>
|
||||
|
|
159
configuration
Normal file
159
configuration
Normal 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
159
configuration.old
Normal 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
|
22
custom/examples/940-libffi
Normal file
22
custom/examples/940-libffi
Normal 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
28
custom/examples/941-pcre
Normal 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
|
22
custom/examples/945-python3
Normal file
22
custom/examples/945-python3
Normal 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
|
|
@ -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
|
|
@ -1,22 +1,15 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
PKG="glib"
|
||||
PKG_VERSION="1.2.10"
|
||||
PKG_FILE="glib-1.2.10.tar.gz"
|
||||
URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
|
||||
MD5="6fe30dad87c77b91b632def29dd69ef9"
|
||||
PKG_VERSION="2.44.1"
|
||||
PKG_FILE="glib-2.44.1.tar.xz"
|
||||
URL="http://ftp.gnome.org/pub/gnome/sources/glib/2.44/${PKG_FILE}"
|
||||
MD5="83efba4722a9674b97437d1d99af79db"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
|
||||
|
||||
|
||||
( cat << "xEOFx"
|
||||
patch -Np1 -i ../glib-1.2.10-gcc34-1.patch &&
|
||||
./configure --prefix=/usr &&
|
||||
./configure --prefix=/usr --with-pcre=system &&
|
||||
make
|
||||
make install &&
|
||||
chmod -v 755 /usr/lib/libgmodule-1.2.so.0.0.10
|
||||
make install
|
||||
xEOFx
|
||||
) > tmp
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
PKG="mc"
|
||||
PKG_VERSION="4.6.1"
|
||||
PKG_FILE="mc-4.6.1.tar.gz"
|
||||
URL="http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/${PKG_FILE}"
|
||||
MD5="18b20db6e40480a53bac2870c56fc3c4"
|
||||
PKG_VERSION="4.8.14"
|
||||
PKG_FILE="mc-4.8.14.tar.xz"
|
||||
URL="http://ftp.midnight-commander.org/${PKG_FILE}"
|
||||
MD5="fbdaddb9edcf8925dcf3231331a8720b"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
|
||||
( cat << "xEOFx"
|
||||
./configure --prefix=/usr &&
|
||||
./configure --prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--with-screen=ncurses \
|
||||
--enable-charset &&
|
||||
make
|
||||
make install
|
||||
cp -v doc/keybind-migration.txt /usr/share/mc
|
||||
xEOFx
|
||||
) > tmp
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# The PPP package contains the pppd daemon and the chat program.
|
||||
# This is used for connecting to other machines; often for connecting
|
||||
# to the Internet via a dial-up or PPPoE connection to an ISP.
|
||||
# This is used for connecting to other machines; often for connecting
|
||||
# to the Internet via a dial-up or PPPoE connection to an ISP.
|
||||
#
|
||||
|
||||
PKG="ppp"
|
||||
PKG_VERSION="2.4.4"
|
||||
PKG_VERSION="2.4.7"
|
||||
PKG_FILE="ppp-${PKG_VERSION}.tar.gz"
|
||||
URL="http://samba.org/ftp/ppp/${PKG_FILE}"
|
||||
MD5="183800762e266132218b204dfb428d29"
|
||||
MD5="78818f40e6d33a1d1de68a1551f6595a"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# The OpenSSL package contains management tools and libraries
|
||||
# relating to cryptography. These are useful for providing
|
||||
# cryptography functions to other packages, notably OpenSSH,
|
||||
|
@ -8,28 +5,30 @@
|
|||
#
|
||||
|
||||
PKG="openssl"
|
||||
PKG_VERSION="0.9.8d"
|
||||
PKG_VERSION="1.0.2d"
|
||||
PKG_FILE="openssl-${PKG_VERSION}.tar.gz"
|
||||
URL="ftp://ftp.openssl.org/source/${PKG_FILE}"
|
||||
MD5="8ed1853538e1d05a1f5ada61ebf8bffa"
|
||||
MD5="38dd619b2e77cbac69b99f52a053d25a"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/openssl-0.9.8d-fix_manpages-1.patch"
|
||||
|
||||
( cat << "xEOFx"
|
||||
|
||||
sed -i -e 's/mcpu/march/' config
|
||||
patch -Np1 -i ../openssl-0.9.8d-fix_manpages-1.patch &&
|
||||
./config --openssldir=/etc/ssl --prefix=/usr shared &&
|
||||
make MANDIR=/usr/share/man
|
||||
./config --prefix=/usr \
|
||||
--openssldir=/etc/ssl \
|
||||
--libdir=lib \
|
||||
shared \
|
||||
zlib-dynamic &&
|
||||
make
|
||||
|
||||
make MANDIR=/usr/share/man install &&
|
||||
cp -v -r certs /etc/ssl &&
|
||||
install -v -d -m755 /usr/share/doc/openssl-0.9.8d &&
|
||||
cp -v -r doc/{HOWTO,README,*.{txt,html,gif}} \
|
||||
/usr/share/doc/openssl-0.9.8d
|
||||
|
||||
#sed -i 's# libcrypto.a##;s# libssl.a##' Makefile
|
||||
make MANDIR=/usr/share/man MANSUFFIX=ssl install &&
|
||||
install -dv -m755 /usr/share/doc/openssl-1.0.2d &&
|
||||
cp -vfr doc/* /usr/share/doc/openssl-1.0.2d
|
||||
|
||||
#
|
||||
# Note: certificates not installed by this.
|
||||
#
|
||||
xEOFx
|
||||
) > tmp
|
||||
|
|
|
@ -1,28 +1,34 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
PKG="gpm"
|
||||
PKG_VERSION="1.20.1"
|
||||
PKG_VERSION="1.20.7"
|
||||
PKG_FILE="gpm-${PKG_VERSION}.tar.bz2"
|
||||
URL="ftp://arcana.linux.it/pub/gpm/${PKG_FILE}"
|
||||
MD5="2c63e827d755527950d9d13fe3d87692"
|
||||
URL="https://anduin.linuxfromscratch.org/BLFS/gpm/${PKG_FILE}"
|
||||
MD5="bf84143905a6a903dbd4d4b911a2a2b8"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
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"
|
||||
|
||||
PATCH1="https://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.7-consolidated-1.patch"
|
||||
|
||||
( cat << "xEOFx"
|
||||
|
||||
patch -Np1 -i ../gpm-1.20.1-segfault-1.patch &&
|
||||
patch -Np1 -i ../gpm-1.20.1-silent-1.patch &&
|
||||
./configure --prefix=/usr --sysconfdir=/etc &&
|
||||
LDFLAGS="-lm" make
|
||||
patch -Np1 -i ../gpm-1.20.7-consolidated-1.patch &&
|
||||
./autogen.sh &&
|
||||
./configure --prefix=/usr --sysconfdir=/etc &&
|
||||
make
|
||||
|
||||
make install &&
|
||||
cp -v conf/gpm-root.conf /etc &&
|
||||
ldconfig
|
||||
make install &&
|
||||
|
||||
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
|
||||
# --- PUT THIS CMD INSIDE 999-blfs_bootscripts
|
||||
|
@ -31,7 +37,7 @@ ldconfig
|
|||
cat > /etc/sysconfig/mouse << "EOF"
|
||||
# Begin /etc/sysconfig/mouse
|
||||
|
||||
MDEVICE="/dev/psaux"
|
||||
MDEVICE="/dev/input/mice"
|
||||
PROTOCOL="imps2"
|
||||
GPMOPTS=""
|
||||
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# Lynx is a text based web browser.
|
||||
#
|
||||
|
||||
PKG="lynx"
|
||||
PKG_VERSION="2.8.6"
|
||||
PKG_VERSION="2.8.8rel.2"
|
||||
PKG_FILE="lynx${PKG_VERSION}.tar.bz2"
|
||||
URL="ftp://lynx.isc.org/lynx2.8.6/${PKG_FILE}"
|
||||
MD5="dc80497b7dda6a28fd80404684d27548"
|
||||
URL="ftp://lynx.isc.org/${PKG_FILE}"
|
||||
MD5="b231c2aa34dfe7ca25681ef4e55ee7e8"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
|
||||
( cat << "xEOFx"
|
||||
|
||||
./configure --prefix=/usr \
|
||||
./configure --prefix=/usr \
|
||||
--sysconfdir=/etc/lynx \
|
||||
--datadir=/usr/share/doc/lynx-2.8.6 \
|
||||
--with-zlib \
|
||||
--with-bzlib \
|
||||
--datadir=/usr/share/doc/lynx-2.8.8rel.2 \
|
||||
--with-zlib \
|
||||
--with-bzlib \
|
||||
--with-screen=ncursesw \
|
||||
--enable-locale-charset &&
|
||||
|
||||
make
|
||||
|
||||
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
|
||||
) > tmp
|
||||
|
|
28
custom/examples/964-dhcpcd
Normal file
28
custom/examples/964-dhcpcd
Normal 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
|
|
@ -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
|
|
@ -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
|
|
@ -1,33 +1,22 @@
|
|||
#
|
||||
# $Id$
|
||||
# NASM (Netwide Assembler) is an 80x86 assembler designed
|
||||
# for portability and modularity. It includes a
|
||||
# disassembler as well.
|
||||
|
||||
PKG="nasm"
|
||||
PKG_VERSION="0.98.39"
|
||||
PKG_FILE="nasm-${PKG_VERSION}.tar.bz2"
|
||||
URL="http://downloads.sourceforge.net/nasm/${PKG_FILE}"
|
||||
MD5="2032ad44c7359f7a9a166a40a633e772"
|
||||
PKG_VERSION="2.11.08"
|
||||
PKG_FILE="nasm-${PKG_VERSION}.tar.xz"
|
||||
URL="http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/${PKG_FILE}"
|
||||
MD5="0d461a085b088a14dd6628c53be1ce28"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/nasm-0.98.39-security_fix-1.patch"
|
||||
|
||||
( cat << "xEOFx"
|
||||
|
||||
patch -Np1 -i ../nasm-0.98.39-security_fix-1.patch &&
|
||||
./configure --prefix=/usr &&
|
||||
make
|
||||
make -C rdoff/doc
|
||||
make -C rdoff/doc html
|
||||
|
||||
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
|
||||
make install
|
||||
|
||||
xEOFx
|
||||
) > tmp
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# SYSLINUX is a collection of boot loaders for the Linux
|
||||
# operating system which operates off Linux ext2/3
|
||||
# filesystems, MS-DOS FAT filesystems, network servers
|
||||
# using PXE firmware, or from CD-ROMs. The FAT
|
||||
# filesystem version can be installed from DOS, NT, or
|
||||
# Linux.
|
||||
#
|
||||
#
|
||||
# It includes a sophisticated API for add-on "COM32"
|
||||
# modules, including a significant subset of the
|
||||
# standard C library.
|
||||
#
|
||||
#
|
||||
# It also includes MEMDISK, a tool to boot legacy
|
||||
# operating systems from nontraditional media like PXE
|
||||
# or CD-ROM.
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
PKG="blfs-bootscripts"
|
||||
PKG_VERSION="20060910"
|
||||
PKG_VERSION="20150924"
|
||||
PKG_FILE="blfs-bootscripts-${PKG_VERSION}.tar.bz2"
|
||||
URL="http://www.linuxfromscratch.org/blfs/downloads/svn/${PKG_FILE}"
|
||||
MD5="e1715c58dc694bf474c4468e6bade3ad"
|
||||
URL="http://anduin.linuxfromscratch.org/sources/BLFS/conglomeration/blfs-bootscripts/${PKG_FILE}"
|
||||
MD5="97a371743223ac3815bf491863a39c7d"
|
||||
for i in PATCH{1..10}; do
|
||||
unset $i
|
||||
done
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# Any comments you wish to add
|
||||
#
|
||||
|
||||
|
@ -13,8 +10,16 @@ for i in PATCH{1..10}; do
|
|||
unset $i
|
||||
done
|
||||
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"
|
||||
|
||||
# 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
|
||||
) > tmp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# $Id$
|
||||
|
||||
set -e
|
||||
|
||||
: <<inline_doc
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash
|
||||
# $Id$
|
||||
|
||||
# Acknowledgment:
|
||||
# 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
|
||||
# archive with a dir of the same name and extract the object
|
||||
# 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}... "
|
||||
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
|
||||
mv $F ${F}.XX
|
||||
mkdir $F
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash
|
||||
# $Id$
|
||||
|
||||
# Acknowledgment:
|
||||
# The following code is a modified version of an original work written by
|
||||
|
|
896
extras/farce
896
extras/farce
|
@ -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"
|
||||
|
|
@ -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
|
|
@ -1,23 +1,29 @@
|
|||
#!/bin/bash
|
||||
# $Id$
|
||||
|
||||
set -e
|
||||
|
||||
: << inline_doc
|
||||
Installs a set-up to build BLFS packages.
|
||||
You can set these variables:
|
||||
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.
|
||||
Must start with a '/' (default /blfs_root)
|
||||
BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
|
||||
(default development)
|
||||
BLFS_COMMIT : any commit (branch/tag/sha)
|
||||
(default trunk)
|
||||
LFS_COMMIT : any commit (branch/tag/sha)
|
||||
(default trunk)
|
||||
Examples:
|
||||
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:
|
||||
(as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs
|
||||
(as user) ./install-blfs-tools.sh
|
||||
2 - To install with only user privileges:
|
||||
(as user) INITSYS=<your system> ./install-blfs-tools.sh
|
||||
2 - To install with only user privileges (default to sysv):
|
||||
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
|
||||
|
||||
|
||||
|
@ -44,66 +50,105 @@ declare -r nl_=$'\n'
|
|||
declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
||||
declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
||||
declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
||||
declare -r dotSTR=".................." # Format display of parameters and versions
|
||||
|
||||
# bold yellow > < pair
|
||||
declare -r R_arrow=$'\e[1;33m>\e[0m'
|
||||
declare -r L_arrow=$'\e[1;33m<\e[0m'
|
||||
|
||||
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"
|
||||
# blfs-tool envars
|
||||
BLFS_TOOL='y'
|
||||
BUILDDIR=$(cd ~;pwd)
|
||||
BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
|
||||
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 -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
|
||||
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||
[[ $VERBOSITY > 0 ]] && echo " OK"
|
||||
|
||||
[[ $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.
|
||||
declare -r dotSTR=".................." # needed for proper display of versions
|
||||
echo
|
||||
check_alfs_tools
|
||||
check_blfs_tools
|
||||
echo "${SD_BORDER}${nl_}"
|
||||
|
||||
# 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}
|
||||
rm -rf ${BUILDDIR}${BLFS_ROOT}/*
|
||||
cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
||||
cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
||||
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
||||
cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
||||
[[ $VERBOSITY > 0 ]] && echo "... OK"
|
||||
[[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
|
||||
|
||||
# Clean-up
|
||||
make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
|
||||
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
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "Cleaning the ${BUILDDIR}${BLFS_ROOT} directory "
|
||||
# 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
|
||||
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.
|
||||
# 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
|
||||
[[ $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 \
|
||||
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
|
||||
[[ $VERBOSITY > 0 ]] && echo "... OK"
|
||||
|
||||
|
|
483
jhalfs
483
jhalfs
|
@ -1,31 +1,25 @@
|
|||
#!/bin/bash
|
||||
# $Id$
|
||||
set -e
|
||||
# Pass trap handlers to functions
|
||||
set -E
|
||||
|
||||
# VT100 colors
|
||||
declare -r BLACK=$'\e[1;30m'
|
||||
declare -r DK_GRAY=$'\e[0;30m'
|
||||
|
||||
declare -r RED=$'\e[31m'
|
||||
declare -r GREEN=$'\e[32m'
|
||||
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 BOLD=$'\e[1m'
|
||||
declare -r REVERSE=$'\e[7m'
|
||||
declare -r HIDDEN=$'\e[8m'
|
||||
|
||||
declare -r tab_=$'\t'
|
||||
declare -r nl_=$'\n'
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
||||
# shellcheck disable=SC2034
|
||||
declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
||||
# shellcheck disable=SC2034
|
||||
declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
||||
|
||||
# bold yellow > < pair
|
||||
|
@ -37,20 +31,14 @@ declare -r L_arrow=$'\e[1;33m<\e[0m'
|
|||
#-----------------------#
|
||||
simple_error() { # Basic error trap.... JUST DIE
|
||||
#-----------------------#
|
||||
# If +e then disable text output
|
||||
if [[ "$-" =~ e ]]; then
|
||||
LASTLINE="$1"
|
||||
LASTERR="$2"
|
||||
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
|
||||
LASTLINE="$1"
|
||||
LASTERR="$2"
|
||||
LASTSOURCE="$4"
|
||||
error_message "${GREEN} Error $LASTERR at $LASTSOURCE line ${LASTLINE}!"
|
||||
}
|
||||
|
||||
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
|
||||
# ctrl-c SIGINT
|
||||
|
@ -66,50 +54,95 @@ see_ya() {
|
|||
set -e
|
||||
trap see_ya 0
|
||||
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="
|
||||
${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$
|
||||
\$Date$
|
||||
${BOLD} \"jhalfs\"${OFF} builder tool (development) $git_commit
|
||||
|
||||
Written by George Boudreau and Manuel Canales Esparcia,
|
||||
plus several contributions.
|
||||
Copyright (C) 2005-2023, the jhalfs team:
|
||||
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
|
||||
${BOLD}Gnu General Public License, Version 2.${OFF}
|
||||
The files in the ${BOLD}menu${OFF} directory are subjected to the ${BOLD}ISC License${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
|
||||
-v ) echo "$version" && exit 1 ;;
|
||||
-v ) echo "$version" && exit ;;
|
||||
run ) : ;;
|
||||
* )
|
||||
echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
||||
exit 1
|
||||
;;
|
||||
* ) echo "$usage" && exit 1 ;;
|
||||
esac
|
||||
|
||||
# If the user has not saved his configuration file, let's ask
|
||||
# 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) \
|
||||
-ge $(ls -l --time-style='+%Y%m%d%H%M%S' configuration | cut -d' ' -f 6) ]
|
||||
then echo -n "Do you want to run jhalfs? yes/no (yes): "
|
||||
read ANSWER
|
||||
if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
|
||||
echo "${nl_}Exiting gracefully.${nl_}"
|
||||
exit
|
||||
fi
|
||||
time_current=$(stat -c '%Y' configuration 2>/dev/null || date +%s)
|
||||
time_old=$(stat -c '%Y' configuration.old 2>/dev/null || printf '%s' "$time_current")
|
||||
if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ] ; then
|
||||
printf 'Do you want to run jhalfs? yes/no (yes): '
|
||||
read -r ANSWER
|
||||
case ${ANSWER:0:1} in
|
||||
n|N) printf "\nExiting gracefully.\n"; exit ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Change this to 0 to suppress almost all messages
|
||||
VERBOSITY=1
|
||||
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
||||
source configuration
|
||||
[[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
|
||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||
load_file configuration "Loading config params from <configuration>"
|
||||
|
||||
# These are boolean vars generated from Config.in.
|
||||
# ISSUE: If a boolean parameter is not set to y(es) there
|
||||
|
@ -120,13 +153,13 @@ source configuration
|
|||
RUNMAKE=${RUNMAKE:-n}
|
||||
GETPKG=${GETPKG:-n}
|
||||
COMPARE=${COMPARE:-n}
|
||||
RUN_FARCE=${RUN_FARCE:-n}
|
||||
RUN_ICA=${RUN_ICA:-n}
|
||||
PKGMNGT=${PKGMNGT:-n}
|
||||
BOMB_TEST=${BOMB_TEST:-n}
|
||||
WRAP_INSTALL=${WRAP_INSTALL:-n}
|
||||
STRIP=${STRIP:=n}
|
||||
REPORT=${REPORT:=n}
|
||||
VIMLANG=${VIMLANG:-n}
|
||||
NCURSES5=${NCURSES5:-n}
|
||||
DEL_LA_FILES=${DEL_LA_FILES:-n}
|
||||
FULL_LOCALE=${FULL_LOCALE:-n}
|
||||
GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
||||
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
||||
|
@ -140,168 +173,85 @@ SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
|
|||
SET_WARNINGS=${SET_WARNINGS:=n}
|
||||
SET_MISC=${SET_MISC:=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
|
||||
NO_PROGRESS="#"
|
||||
# shellcheck disable=SC2034
|
||||
NO_PROGRESS="#"
|
||||
fi
|
||||
|
||||
|
||||
# Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
||||
CWD=$(cd `dirname $0` && pwd)
|
||||
if [[ $JHALFSDIR == $CWD ]]; then
|
||||
echo " The jhalfs source directory conflicts with the jhalfs build directory."
|
||||
echo " Please move the source directory or change the build directory."
|
||||
exit 2
|
||||
CWD="$(cd "$(dirname "$0")" && pwd)"
|
||||
if [[ $JHALFSDIR == "$CWD" ]]; then
|
||||
echo " The jhalfs source directory conflicts with the jhalfs build directory."
|
||||
echo " Please move the source directory or change the build directory."
|
||||
exit 2
|
||||
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...
|
||||
BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS}
|
||||
BOOK=${BOOK:=$JHALFSDIR/book-source}
|
||||
|
||||
|
||||
#--- Envars not sourced from configuration
|
||||
case $PROGNAME in
|
||||
clfs ) declare -r GIT="git://git.clfs.org/cross-lfs" ;;
|
||||
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
|
||||
# shellcheck disable=SC2034
|
||||
declare -r REPO=https://git.linuxfromscratch.org/lfs.git
|
||||
declare -r LOG=000-masterscript.log
|
||||
# Needed for fetching BLFS book sources when building CLFS
|
||||
declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
||||
declare -r COMMANDS=lfs-commands
|
||||
|
||||
# Set true internal variables
|
||||
COMMON_DIR="common"
|
||||
PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
||||
PACKAGE_DIR=LFS
|
||||
MODULE=$PACKAGE_DIR/master.sh
|
||||
PKGMNGTDIR="pkgmngt"
|
||||
# The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
||||
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
||||
source $COMMON_DIR/common-functions
|
||||
[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
||||
source $MODULE
|
||||
[[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||
#
|
||||
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
||||
for file in \
|
||||
"$COMMON_DIR/common-functions" \
|
||||
"$COMMON_DIR/libs/func_book_parser" \
|
||||
"$COMMON_DIR/libs/func_download_pkgs" \
|
||||
"$COMMON_DIR/libs/func_wrt_Makefile" \
|
||||
"$MODULE" ; do
|
||||
load_file "$file"
|
||||
done
|
||||
|
||||
simple_message "${SD_BORDER}${nl_}"
|
||||
|
||||
|
||||
#*******************************************************************#
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
||||
source $COMMON_DIR/libs/func_check_version.sh
|
||||
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||
LASTERR=2
|
||||
for file in \
|
||||
"$COMMON_DIR/libs/func_check_version.sh" \
|
||||
"$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>..."
|
||||
source $COMMON_DIR/libs/func_validate_configs.sh
|
||||
[[ $? > 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
|
||||
simple_message "${SD_BORDER}${nl_}"
|
||||
simple_message "Checking tools required for jhalfs${nl_}"
|
||||
check_alfs_tools
|
||||
|
||||
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
||||
simple_message "${SD_BORDER}${nl_}"
|
||||
|
||||
# blfs-tool envars
|
||||
BLFS_TOOL=${BLFS_TOOL:-n}
|
||||
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
||||
[[ $VERBOSITY > 0 ]] && echo Checking supplementary tools for installing BLFS
|
||||
check_blfs_tools
|
||||
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
||||
BLFS_SVN=${BLFS_SVN:-n}
|
||||
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
||||
#not needed now that the check is in alfs_tools
|
||||
# simple_message 'Checking supplementary tools for installing BLFS'
|
||||
# check_blfs_tools
|
||||
simple_message "${SD_BORDER}${nl_}"
|
||||
BLFS_BRANCH=${BLFS_BRANCH:-n}
|
||||
if [[ "${BLFS_SVN}" = "y" ]]; then
|
||||
BLFS_BRANCH_ID=development
|
||||
BLFS_TREE=trunk/BOOK
|
||||
elif [[ "${BLFS_WORKING_COPY}" = "y" ]]; then
|
||||
[[ -d "$BLFS_WC_LOCATION" ]] &&
|
||||
[[ -d "$BLFS_WC_LOCATION/postlfs" ]] || {
|
||||
BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
||||
if [[ "${BLFS_WORKING_COPY}" = "y" ]] &&
|
||||
[[ ! -d "$BLFS_WC_LOCATION/postlfs" ]] ; then
|
||||
echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION."
|
||||
echo " Please rerun make and fix the configuration."
|
||||
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
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading blfs tools installation function..."
|
||||
source $COMMON_DIR/libs/func_install_blfs
|
||||
[[ $? > 0 ]] && echo "function module did not load.." && exit 1
|
||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||
load_file "${COMMON_DIR}/libs/func_install_blfs"
|
||||
fi
|
||||
|
||||
###################################
|
||||
|
@ -312,8 +262,8 @@ fi
|
|||
validate_config
|
||||
echo "${SD_BORDER}${nl_}"
|
||||
echo -n "Are you happy with these settings? yes/no (no): "
|
||||
read ANSWER
|
||||
if [ x$ANSWER != "xyes" ] ; then
|
||||
read -r ANSWER
|
||||
if [ "x$ANSWER" != "xyes" ] ; then
|
||||
echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
||||
exit
|
||||
fi
|
||||
|
@ -322,127 +272,134 @@ echo "${nl_}${SD_BORDER}${nl_}"
|
|||
# Load additional modules or configuration files based on global settings
|
||||
# compare module
|
||||
if [[ "$COMPARE" = "y" ]]; then
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
||||
source $COMMON_DIR/libs/func_compare.sh
|
||||
[[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||
load_file "${COMMON_DIR}/libs/func_compare.sh" 'Loading compare module'
|
||||
fi
|
||||
#
|
||||
# save module
|
||||
if [[ "$SAVE_CH5" = "y" ]]; then
|
||||
load_file "${COMMON_DIR}/libs/func_save.sh" 'Loading save module'
|
||||
fi
|
||||
#
|
||||
# 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
|
||||
[[ $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
|
||||
[[ $VERBOSITY > 0 ]] && echo -n "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}"
|
||||
load_file optimize/opt_config 'Loading optimization config'
|
||||
# Validate optimize settings, if required
|
||||
validate_opt_settings
|
||||
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 requested, clean the build directory
|
||||
# If requested, clean the build directory
|
||||
clean_builddir
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
mkdir -p $BUILDDIR/sources
|
||||
sudo mkdir -p "$BUILDDIR/sources"
|
||||
sudo chmod a+wt "$BUILDDIR/sources"
|
||||
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
|
||||
[[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
|
||||
cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
|
||||
cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
||||
#
|
||||
# Copy urls.xsl, if needed
|
||||
[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
||||
#
|
||||
# Create the test-log directory, if needed
|
||||
[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && 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
|
||||
# Create the log directory
|
||||
if [[ ! -d $LOGDIR ]]; then
|
||||
mkdir "$LOGDIR"
|
||||
fi
|
||||
true >"$LOGDIR/$LOG"
|
||||
|
||||
# Copy common helper files
|
||||
cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh,run-in-cgroup.sh} "$JHALFSDIR/"
|
||||
|
||||
# Copy needed stylesheets
|
||||
cp "$COMMON_DIR"/{packages.xsl,chroot.xsl,kernfs.xsl} "$JHALFSDIR/"
|
||||
cp "$PACKAGE_DIR/$XSL" "$JHALFSDIR/"
|
||||
|
||||
export XSL=$JHALFSDIR/${XSL}
|
||||
|
||||
# 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
|
||||
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
|
||||
# This file will be used to create the REPORT header
|
||||
validate_config > $JHALFSDIR/jhalfs.config
|
||||
validate_config >"$JHALFSDIR/jhalfs.config"
|
||||
fi
|
||||
#
|
||||
# Copy optimize files, if needed
|
||||
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
||||
#
|
||||
# Copy compare files, if needed
|
||||
|
||||
# Copy optimize files, if needed
|
||||
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override "$JHALFSDIR/"
|
||||
|
||||
# Copy compare files, if needed
|
||||
if [[ "$COMPARE" = "y" ]]; then
|
||||
mkdir -p $JHALFSDIR/extras
|
||||
cp extras/* $JHALFSDIR/extras
|
||||
mkdir -p "$JHALFSDIR/extras"
|
||||
cp extras/* "$JHALFSDIR/extras"
|
||||
fi
|
||||
#
|
||||
# Copy custom tools config files, if requested
|
||||
|
||||
# Copy custom tools config files, if requested
|
||||
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
||||
echo "Copying custom tool scripts to $JHALFSDIR"
|
||||
mkdir -p $JHALFSDIR/custom-commands
|
||||
cp -f custom/config/* $JHALFSDIR/custom-commands
|
||||
mkdir -p "$JHALFSDIR/custom-commands"
|
||||
cp -f custom/config/* "$JHALFSDIR/custom-commands"
|
||||
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
|
||||
# Note that all customization to $JHALFSDIR have to be done before this.
|
||||
# But the LFS book is needed for BLFS tools.
|
||||
get_book
|
||||
extract_commands
|
||||
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
|
||||
|
||||
# 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
|
||||
# canonical book version
|
||||
if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
||||
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
|
||||
VERSION=$(grep 'echo.*lfs-release' "$JHALFSDIR/prbook.xml" | sed 's/.*echo[ ]*\([^ ]*\).*/\1/')
|
||||
fi
|
||||
|
||||
build_Makefile
|
||||
|
@ -451,7 +408,7 @@ echo "${SD_BORDER}${nl_}"
|
|||
|
||||
# Check for build prerequisites.
|
||||
echo
|
||||
cd $CWD
|
||||
cd "$CWD"
|
||||
check_prerequisites
|
||||
echo "${SD_BORDER}${nl_}"
|
||||
# All is well, run the build (if requested)
|
||||
|
|
|
@ -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();
|
|
@ -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
5
menu/LICENSE.txt
Normal 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.
|
145
menu/Makefile
145
menu/Makefile
|
@ -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
4
menu/README
Normal 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
|
571
menu/conf.c
571
menu/conf.c
|
@ -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;
|
||||
}
|
392
menu/confdata.c
392
menu/confdata.c
|
@ -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;
|
||||
}
|
1099
menu/expr.c
1099
menu/expr.c
File diff suppressed because it is too large
Load diff
195
menu/expr.h
195
menu/expr.h
|
@ -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
Reference in a new issue