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