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)--------------------------------------------------------------------------------$(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 of commands
|
---|
37 | @echo sudo will request a password in order to execute all high privilege commands
|
---|
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" ] && \
|
---|
68 | if [ -d $(SRCSDIR)/$$ROOT ]; then \
|
---|
69 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
70 | rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
|
---|
71 | fi;
|
---|
72 | endef
|
---|
73 |
|
---|
74 | define remove_existing_dirs2
|
---|
75 | @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
|
---|
76 | ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
---|
77 | [ -n "$$ROOT" ] && \
|
---|
78 | if [ -d $(SRC)/$$ROOT ]; then \
|
---|
79 | rm -rf $(SRC)/$$ROOT && \
|
---|
80 | rm -rf $(SRC)/$${ROOT%-*}-build; \
|
---|
81 | fi;
|
---|
82 | @if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
|
---|
83 | rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
|
---|
84 | fi;
|
---|
85 | endef
|
---|
86 |
|
---|
87 | #==#
|
---|
88 |
|
---|
89 | define unpack
|
---|
90 | @cd $(SRCSDIR) && \
|
---|
91 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
92 | endef
|
---|
93 |
|
---|
94 | define unpack2
|
---|
95 | @cd $(SRC) && \
|
---|
96 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
97 | endef
|
---|
98 |
|
---|
99 | #==#
|
---|
100 |
|
---|
101 | define get_pkg_root
|
---|
102 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
103 | if [ "$(1)" != "nouser" ]; then \
|
---|
104 | echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \
|
---|
105 | chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \
|
---|
106 | else \
|
---|
107 | echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \
|
---|
108 | fi;
|
---|
109 | endef
|
---|
110 |
|
---|
111 | define get_pkg_root2
|
---|
112 | @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
113 | echo "export PKGDIR=$(SRC)/$$ROOT" > envars; \
|
---|
114 | if [ "$(PKGMNGT)" = "y" ]; then \
|
---|
115 | echo "export PKG_DEST=$(SRC)/$@" >> envars; \
|
---|
116 | echo "source packInstall.sh" >> envars; \
|
---|
117 | echo "export -f packInstall" >> envars; \
|
---|
118 | echo "export -f wrapInstall" >> envars; \
|
---|
119 | fi;
|
---|
120 | endef
|
---|
121 |
|
---|
122 | define get_pkg_root_LUSER
|
---|
123 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
124 | echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
|
---|
125 | endef
|
---|
126 |
|
---|
127 | #==#
|
---|
128 |
|
---|
129 | define touch_timestamp
|
---|
130 | @touch $(SRC)/timestamp-marker && sleep 1
|
---|
131 | endef
|
---|
132 |
|
---|
133 | define touch_timestamp_LUSER
|
---|
134 | @touch $(SRCSDIR)/timestamp-marker && sleep 1
|
---|
135 | endef
|
---|
136 |
|
---|
137 | define log_new_files
|
---|
138 | @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
|
---|
139 | -newer $(SRC)/timestamp-marker -not -type d \
|
---|
140 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
|
---|
141 | endef
|
---|
142 |
|
---|
143 | define log_new_files_LUSER
|
---|
144 | @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
|
---|
145 | -newer $(SRCSDIR)/timestamp-marker -not -type d \
|
---|
146 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
|
---|
147 | endef
|
---|
148 |
|
---|
149 | #==@
|
---|
150 |
|
---|
151 | define remove_build_dirs
|
---|
152 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
153 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
154 | rm -rf $(SRCSDIR)/$(1)-build
|
---|
155 | endef
|
---|
156 |
|
---|
157 | define remove_build_dirs2
|
---|
158 | @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
159 | rm -rf $(SRC)/$$ROOT && \
|
---|
160 | rm -rf $(SRC)/$(1)-build
|
---|
161 | endef
|
---|
162 |
|
---|
163 | #==#
|
---|
164 |
|
---|
165 | define housekeeping
|
---|
166 | @touch $@ && \
|
---|
167 | sleep .25 && \
|
---|
168 | echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
|
---|
169 | echo --------------------------------------------------------------------------------$(WHITE) && \
|
---|
170 | if [ "$(BREAKPOINT)" = "$@" ] ; then \
|
---|
171 | echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \
|
---|
172 | false ; \
|
---|
173 | fi
|
---|
174 | endef
|
---|
175 |
|
---|
176 | #=======================
|
---|
177 |
|
---|
178 |
|
---|
179 | #==== FINAL MESSAGES ===
|
---|
180 |
|
---|
181 | define echo_report
|
---|
182 | echo ; \
|
---|
183 | echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
|
---|
184 | echo ; \
|
---|
185 | echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
|
---|
186 | echo file to $(BOLD)jhalfs-reports@linuxfromscratch.org$(WHITE) ; \
|
---|
187 | echo ; \
|
---|
188 | echo That will help us to keep more accurate SBU and ; \
|
---|
189 | echo disk usage values into the book. Thanks. ; \
|
---|
190 | echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
|
---|
191 | endef
|
---|
192 |
|
---|
193 | define echo_finished
|
---|
194 | @echo $(BOLD)
|
---|
195 | @echo --------------------------------------------------------------------------------
|
---|
196 | @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
|
---|
197 | @echo --------------------------------------------------------------------------------
|
---|
198 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
199 | @echo --------------------------------------------------------------------------------
|
---|
200 | @echo
|
---|
201 | @echo To be able to boot your new system you need to follow
|
---|
202 | @echo the next steps:$(WHITE)
|
---|
203 | @echo
|
---|
204 | @echo $(tab_)- Mount the virtual kernel file systems.
|
---|
205 | @echo
|
---|
206 | @echo $(tab_)- Enter to the chroot using the command found
|
---|
207 | @echo $(tab_)in the section -Entering the Chroot Environment-
|
---|
208 | @echo $(tab_)except if building CLFS with METHOD=boot.
|
---|
209 | @echo
|
---|
210 | @echo $(tab_)- Set a password for the root user.
|
---|
211 | @echo
|
---|
212 | @echo $(tab_)- Edit or create /etc/fstab,
|
---|
213 | @echo $(tab_) " /etc/hosts,"
|
---|
214 | @echo $(tab_) " /etc/sysconfig/clock,"
|
---|
215 | @echo $(tab_) " /etc/sysconfig/console,"
|
---|
216 | @echo $(tab_) " /etc/sysconfig/network,"
|
---|
217 | @echo $(tab_) " /etc/sysconfig/ifconfig.eth0,"
|
---|
218 | @echo $(tab_) " /etc/resolv.conf"
|
---|
219 | @echo $(tab_)and any other configuration file required to suit your needs.
|
---|
220 | @echo
|
---|
221 | @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
|
---|
222 | @echo
|
---|
223 | @echo $(tab_)You can set-up the new boot-loader installed on the new system
|
---|
224 | @echo $(tab_)or the host bootloader.
|
---|
225 | @echo
|
---|
226 | @echo $(tab_)If the last, it is better to exit first from the chroot.
|
---|
227 | @echo
|
---|
228 | @echo $(tab_)- Exit from the chroot and umount the filesystems.
|
---|
229 | @echo
|
---|
230 | @echo If you are an experienced LFS user, several of those steps can be
|
---|
231 | @echo skipped or done in a different way. But then, that is something
|
---|
232 | @echo that you already know and there is no need to discuss it here.
|
---|
233 | @echo $(BOLD)
|
---|
234 | @echo --------------------------------------------------------------------------------
|
---|
235 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
236 | @echo --------------------------------------------------------------------------------$(WHITE)
|
---|
237 | endef
|
---|
238 |
|
---|
239 | define echo_boot_finished
|
---|
240 | @echo $(BOLD)
|
---|
241 | @echo --------------------------------------------------------------------------------
|
---|
242 | @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
|
---|
243 | @echo --------------------------------------------------------------------------------
|
---|
244 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
245 | @echo --------------------------------------------------------------------------------
|
---|
246 | @echo
|
---|
247 | @echo The build is not complete. Follow the next steps:$(WHITE)
|
---|
248 | @echo
|
---|
249 | @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
|
---|
250 | @echo $(tab_) and any other configuration file required to suit your needs.
|
---|
251 | @echo $(BOLD)
|
---|
252 | @echo $(BOLD)$(YELLOW)
|
---|
253 | @echo 1.If it is necessary, transfer the newly created partition to the target machine
|
---|
254 | @echo 2.Boot the new partition.
|
---|
255 | @echo 3.Once you are logged in issue the following commands
|
---|
256 | @echo $(tab_) $(BOLD)cd /jhalfs
|
---|
257 | @echo $(tab_) $(BOLD)make makesys
|
---|
258 | @echo The build process should resume. Follow any instructions that appear.
|
---|
259 | @echo --------------------------------------------------------------------------------
|
---|
260 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
261 | @echo --------------------------------------------------------------------------------$(WHITE)
|
---|
262 | endef
|
---|