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 |
|
---|
39 | define echo_SULUSER_request
|
---|
40 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
41 | @echo $(BOLD)$(BLUE)$@
|
---|
42 | @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
---|
43 | @echo sudo requires a password
|
---|
44 | endef
|
---|
45 |
|
---|
46 | define echo_CHROOT_request
|
---|
47 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
48 | @echo $(BOLD)$(BLUE)$@
|
---|
49 | @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
---|
50 | @echo a password is required
|
---|
51 | endef
|
---|
52 |
|
---|
53 | define echo_message
|
---|
54 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
55 | @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
|
---|
56 | endef
|
---|
57 |
|
---|
58 | #=======================
|
---|
59 |
|
---|
60 |
|
---|
61 | #=== BUILD FUNCTIONS ===
|
---|
62 |
|
---|
63 | define remove_existing_dirs
|
---|
64 | @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
|
---|
65 | ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
---|
66 | [ -n "$$ROOT" ] && \
|
---|
67 | if [ -d $(SRCSDIR)/$$ROOT ]; then \
|
---|
68 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
69 | rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
|
---|
70 | fi;
|
---|
71 | endef
|
---|
72 |
|
---|
73 | define remove_existing_dirs2
|
---|
74 | @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
|
---|
75 | ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
---|
76 | [ -n "$$ROOT" ] && \
|
---|
77 | if [ -d $(SRC)/$$ROOT ]; then \
|
---|
78 | rm -rf $(SRC)/$$ROOT && \
|
---|
79 | rm -rf $(SRC)/$${ROOT%-*}-build; \
|
---|
80 | fi;
|
---|
81 | @if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
|
---|
82 | rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
|
---|
83 | fi;
|
---|
84 | endef
|
---|
85 |
|
---|
86 | #==#
|
---|
87 |
|
---|
88 | define unpack
|
---|
89 | @cd $(SRCSDIR) && \
|
---|
90 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
91 | endef
|
---|
92 |
|
---|
93 | define unpack2
|
---|
94 | @cd $(SRC) && \
|
---|
95 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
96 | endef
|
---|
97 |
|
---|
98 | #==#
|
---|
99 |
|
---|
100 | define get_pkg_root
|
---|
101 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
102 | if [ "$(1)" != "nouser" ]; then \
|
---|
103 | echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \
|
---|
104 | chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \
|
---|
105 | else \
|
---|
106 | echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \
|
---|
107 | fi;
|
---|
108 | endef
|
---|
109 |
|
---|
110 | define get_pkg_root2
|
---|
111 | @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
112 | echo "export PKGDIR=$(SRC)/$$ROOT" > envars; \
|
---|
113 | if [ "$(PKGMNGT)" = "y" ]; then \
|
---|
114 | echo "export PKG_DEST=$(SRC)/$@" >> envars; \
|
---|
115 | echo "source packInstall.sh" >> envars; \
|
---|
116 | echo "export -f packInstall" >> envars; \
|
---|
117 | fi;
|
---|
118 | endef
|
---|
119 |
|
---|
120 | define get_pkg_root_LUSER
|
---|
121 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
122 | echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
|
---|
123 | endef
|
---|
124 |
|
---|
125 | #==#
|
---|
126 |
|
---|
127 | define touch_timestamp
|
---|
128 | @touch $(SRC)/timestamp-marker && sleep 1
|
---|
129 | endef
|
---|
130 |
|
---|
131 | define touch_timestamp_LUSER
|
---|
132 | @touch $(SRCSDIR)/timestamp-marker && sleep 1
|
---|
133 | endef
|
---|
134 |
|
---|
135 | define log_new_files
|
---|
136 | @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
|
---|
137 | -newer $(SRC)/timestamp-marker -not -type d \
|
---|
138 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
|
---|
139 | endef
|
---|
140 |
|
---|
141 | define log_new_files_LUSER
|
---|
142 | @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
|
---|
143 | -newer $(SRCSDIR)/timestamp-marker -not -type d \
|
---|
144 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
|
---|
145 | endef
|
---|
146 |
|
---|
147 | #==@
|
---|
148 |
|
---|
149 | define remove_build_dirs
|
---|
150 | @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
151 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
152 | rm -rf $(SRCSDIR)/$(1)-build
|
---|
153 | endef
|
---|
154 |
|
---|
155 | define remove_build_dirs2
|
---|
156 | @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
157 | rm -rf $(SRC)/$$ROOT && \
|
---|
158 | rm -rf $(SRC)/$(1)-build
|
---|
159 | endef
|
---|
160 |
|
---|
161 | #==#
|
---|
162 |
|
---|
163 | define housekeeping
|
---|
164 | @touch $@ && \
|
---|
165 | sleep .25 && \
|
---|
166 | echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
|
---|
167 | echo --------------------------------------------------------------------------------$(WHITE) && \
|
---|
168 | if [ "$(BREAKPOINT)" = "$@" ] ; then \
|
---|
169 | echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \
|
---|
170 | false ; \
|
---|
171 | fi
|
---|
172 | endef
|
---|
173 |
|
---|
174 | #=======================
|
---|
175 |
|
---|
176 |
|
---|
177 | #==== FINAL MESSAGES ===
|
---|
178 |
|
---|
179 | define echo_report
|
---|
180 | echo ; \
|
---|
181 | echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
|
---|
182 | echo ; \
|
---|
183 | echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
|
---|
184 | echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \
|
---|
185 | echo ; \
|
---|
186 | echo That will help us to keep more accurate SBU and ; \
|
---|
187 | echo disk usage values into the book. Thanks. ; \
|
---|
188 | echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
|
---|
189 | endef
|
---|
190 |
|
---|
191 | define echo_finished
|
---|
192 | @echo $(BOLD)
|
---|
193 | @echo --------------------------------------------------------------------------------
|
---|
194 | @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
|
---|
195 | @echo --------------------------------------------------------------------------------
|
---|
196 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
197 | @echo --------------------------------------------------------------------------------
|
---|
198 | @echo
|
---|
199 | @echo To be able to boot your new system you need to follow
|
---|
200 | @echo the next steps:$(WHITE)
|
---|
201 | @echo
|
---|
202 | @echo $(tab_)- Enter to the chroot using the command found
|
---|
203 | @echo $(tab_)in the section -Entering the Chroot Environment-
|
---|
204 | @echo $(tab_)except if building CLFS with METHOD=boot.
|
---|
205 | @echo
|
---|
206 | @echo $(tab_)- Set a password for the root user.
|
---|
207 | @echo
|
---|
208 | @echo $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
|
---|
209 | @echo $(tab_)/etc/sysconfig/console, /etc/sysconfig/network,
|
---|
210 | @echo $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
|
---|
211 | @echo $(tab_)any other configuration file required to suit your needs.
|
---|
212 | @echo
|
---|
213 | @echo $(tab_)- Exit from the chroot.
|
---|
214 | @echo
|
---|
215 | @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
|
---|
216 | @echo $(tab_)You can set-up the host bootloader or the new boot-loader
|
---|
217 | @echo $(tab_)installed on the new system.
|
---|
218 | @echo $(tab_)If the last, you must to mount the virtual filesystems, re-enter
|
---|
219 | @echo $(tab_)the chroot and be sure that /dev is populated with the
|
---|
220 | @echo $(tab_)required devices before configure the boot-loader. When ready,
|
---|
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
|
---|