1 |
|
---|
2 | # $Id$
|
---|
3 |
|
---|
4 | BOLD = "[0;1m"
|
---|
5 | RED = "[1;31m"
|
---|
6 | GREEN = "[0;32m"
|
---|
7 | ORANGE = "[0;33m"
|
---|
8 | BLUE = "[1;34m"
|
---|
9 | WHITE = "[00m"
|
---|
10 | YELLOW = "[1;33m"
|
---|
11 |
|
---|
12 | OFF = "[0m"
|
---|
13 | REVERSE = "[7m"
|
---|
14 |
|
---|
15 | tab_ = " "
|
---|
16 | nl_ = ""
|
---|
17 |
|
---|
18 | #==== BUILD MESSAGES ===
|
---|
19 |
|
---|
20 | define echo_PHASE
|
---|
21 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
22 | @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
|
---|
23 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
24 | @echo $(WHITE)
|
---|
25 | endef
|
---|
26 |
|
---|
27 | define sh_echo_PHASE
|
---|
28 | echo $(BOLD)--------------------------------------------------------------------------------;\
|
---|
29 | echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
|
---|
30 | echo $(BOLD)--------------------------------------------------------------------------------echo $(WHITE)
|
---|
31 | endef
|
---|
32 |
|
---|
33 | define echo_SU_request
|
---|
34 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
35 | @echo $(BLUE)$@
|
---|
36 | @echo $(WHITE)ROOT privilege is required to perform a number commands
|
---|
37 | @echo sudo will request a password to all high privilege cmds to execute correctly
|
---|
38 | endef
|
---|
39 |
|
---|
40 | define echo_SULUSER_request
|
---|
41 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
42 | @echo $(BOLD)$(BLUE)$@
|
---|
43 | @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
---|
44 | @echo sudo requires a password
|
---|
45 | endef
|
---|
46 |
|
---|
47 | define echo_CHROOT_request
|
---|
48 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
49 | @echo $(BOLD)$(BLUE)$@
|
---|
50 | @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
---|
51 | @echo a password is required
|
---|
52 | endef
|
---|
53 |
|
---|
54 | define echo_message
|
---|
55 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
56 | @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
|
---|
57 | endef
|
---|
58 |
|
---|
59 | #=======================
|
---|
60 |
|
---|
61 |
|
---|
62 | #=== BUILD FUNCTIONS ===
|
---|
63 |
|
---|
64 | define remove_existing_dirs
|
---|
65 | @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
|
---|
66 | ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
---|
67 | [ -n "$$ROOT" ] && [ -d $(SRCSDIR)/$$ROOT ] && \
|
---|
68 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
69 | rm -rf $(SRCSDIR)/$${ROOT%-*}-build
|
---|
70 | endef
|
---|
71 |
|
---|
72 | define remove_existing_dirs2
|
---|
73 | @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
|
---|
74 | ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
---|
75 | [ -n "$$ROOT" ] && [ -d $(SRC)/$$ROOT ] && \
|
---|
76 | rm -rf $(SRC)/$$ROOT && \
|
---|
77 | rm -rf $(SRC)/$${ROOT%-*}-build
|
---|
78 | endef
|
---|
79 |
|
---|
80 | #==#
|
---|
81 |
|
---|
82 | define unpack
|
---|
83 | @cd $(SRCSDIR) && \
|
---|
84 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
85 | endef
|
---|
86 |
|
---|
87 | define unpack2
|
---|
88 | @cd $(SRC) && \
|
---|
89 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
90 | endef
|
---|
91 |
|
---|
92 | #==#
|
---|
93 |
|
---|
94 | define get_pkg_root
|
---|
95 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
96 | if [ "$(1)" != "nouser" ]; then \
|
---|
97 | echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \
|
---|
98 | chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \
|
---|
99 | else \
|
---|
100 | echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \
|
---|
101 | fi;
|
---|
102 | endef
|
---|
103 |
|
---|
104 | define get_pkg_root2
|
---|
105 | @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
106 | echo "export PKGDIR=$(SRC)/$$ROOT" > envars
|
---|
107 | endef
|
---|
108 |
|
---|
109 | define get_pkg_root_LUSER
|
---|
110 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
111 | echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
|
---|
112 | endef
|
---|
113 |
|
---|
114 | #==#
|
---|
115 |
|
---|
116 | define touch_timestamp
|
---|
117 | @touch $(SRC)/timestamp-marker && sleep 1
|
---|
118 | endef
|
---|
119 |
|
---|
120 | define touch_timestamp_LUSER
|
---|
121 | @touch $(SRCSDIR)/timestamp-marker && sleep 1
|
---|
122 | endef
|
---|
123 |
|
---|
124 | define log_new_files
|
---|
125 | @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
|
---|
126 | -newer $(SRC)/timestamp-marker -not -type d \
|
---|
127 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
|
---|
128 | endef
|
---|
129 |
|
---|
130 | define log_new_files_LUSER
|
---|
131 | @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
|
---|
132 | -newer $(SRCSDIR)/timestamp-marker -not -type d \
|
---|
133 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
|
---|
134 | endef
|
---|
135 |
|
---|
136 | #==@
|
---|
137 |
|
---|
138 | define remove_build_dirs
|
---|
139 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
140 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
141 | rm -rf $(SRCSDIR)/$(1)-build
|
---|
142 | endef
|
---|
143 |
|
---|
144 | define remove_build_dirs2
|
---|
145 | @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
146 | rm -rf $(SRC)/$$ROOT && \
|
---|
147 | rm -rf $(SRC)/$(1)-build
|
---|
148 | endef
|
---|
149 |
|
---|
150 | #==#
|
---|
151 |
|
---|
152 | define housekeeping
|
---|
153 | @touch $@ && \
|
---|
154 | sleep .25 && \
|
---|
155 | echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
|
---|
156 | echo --------------------------------------------------------------------------------$(WHITE) && \
|
---|
157 | if [ "$(BREAKPOINT)" = "$@" ] ; then \
|
---|
158 | echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \
|
---|
159 | false ; \
|
---|
160 | fi
|
---|
161 | endef
|
---|
162 |
|
---|
163 | #=======================
|
---|
164 |
|
---|
165 |
|
---|
166 | #==== FINAL MESSAGES ===
|
---|
167 |
|
---|
168 | define echo_report
|
---|
169 | echo ; \
|
---|
170 | echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
|
---|
171 | echo ; \
|
---|
172 | echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
|
---|
173 | echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \
|
---|
174 | echo ; \
|
---|
175 | echo That will help us to keep more accurate SBU and ; \
|
---|
176 | echo disk usage values into the book. Thanks. ; \
|
---|
177 | echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
|
---|
178 | endef
|
---|
179 |
|
---|
180 | define echo_finished
|
---|
181 | @echo $(BOLD)
|
---|
182 | @echo --------------------------------------------------------------------------------
|
---|
183 | @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
|
---|
184 | @echo --------------------------------------------------------------------------------
|
---|
185 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
186 | @echo --------------------------------------------------------------------------------
|
---|
187 | @echo
|
---|
188 | @echo To be able to boot your new system you need to follow
|
---|
189 | @echo the next steps:$(WHITE)
|
---|
190 | @echo
|
---|
191 | @echo $(tab_)- Enter to the chroot using the command found
|
---|
192 | @echo $(tab_)in the section -Entering the Chroot Environment-
|
---|
193 | @echo $(tab_)except if building CLFS with METHOD=boot.
|
---|
194 | @echo
|
---|
195 | @echo $(tab_)- Set a password for the root user.
|
---|
196 | @echo
|
---|
197 | @echo $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
|
---|
198 | @echo $(tab_)/etc/sysconfig/console, /etc/sysconfig/network,
|
---|
199 | @echo $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
|
---|
200 | @echo $(tab_)any other configuration file required to suit your needs.
|
---|
201 | @echo
|
---|
202 | @echo $(tab_)- Exit from the chroot.
|
---|
203 | @echo
|
---|
204 | @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
|
---|
205 | @echo $(tab_)You can set-up the host bootloader or the new boot-loader
|
---|
206 | @echo $(tab_)installed on the new system.
|
---|
207 | @echo $(tab_)If the last, you must to mount the virtual filesystems, re-enter
|
---|
208 | @echo $(tab_)the chroot and be sure that /dev is populated with the
|
---|
209 | @echo $(tab_)required devices before configure the boot-loader. When ready,
|
---|
210 | @echo $(tab_)exit from the chroot and umount the filesystems
|
---|
211 | @echo
|
---|
212 | @echo If you are an experienced LFS user, several of those steps can be
|
---|
213 | @echo skipped or done in a different way. But then, that is something
|
---|
214 | @echo that you already know and there is no need to discuss it here.
|
---|
215 | @echo $(BOLD)
|
---|
216 | @echo --------------------------------------------------------------------------------
|
---|
217 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
218 | @echo --------------------------------------------------------------------------------$(WHITE)
|
---|
219 | endef
|
---|
220 |
|
---|
221 | define echo_boot_finished
|
---|
222 | @echo $(BOLD)
|
---|
223 | @echo --------------------------------------------------------------------------------
|
---|
224 | @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
|
---|
225 | @echo --------------------------------------------------------------------------------
|
---|
226 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
227 | @echo --------------------------------------------------------------------------------
|
---|
228 | @echo
|
---|
229 | @echo The build is not complete. Follow the next steps:$(WHITE)
|
---|
230 | @echo
|
---|
231 | @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
|
---|
232 | @echo $(tab_) and any other configuration file required to suit your needs.
|
---|
233 | @echo $(BOLD)
|
---|
234 | @echo $(BOLD)$(YELLOW)
|
---|
235 | @echo 1.If it is necessary, transfer the newly created partition to the target machine
|
---|
236 | @echo 2.Boot the new partition.
|
---|
237 | @echo 3.Once you are logged in issue the following commands
|
---|
238 | @echo $(tab_) $(BOLD)cd /jhalfs
|
---|
239 | @echo $(tab_) $(BOLD)make makesys
|
---|
240 | @echo The build process should resume. Follow any instructions that appear.
|
---|
241 | @echo --------------------------------------------------------------------------------
|
---|
242 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
243 | @echo --------------------------------------------------------------------------------$(WHITE)
|
---|
244 | endef
|
---|