source: common/makefile-functions@ 52575b8

2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 52575b8 was b533b78, checked in by Thomas Pegg <thomasp@…>, 13 years ago

Fix a typo. Fixes #1683

  • Property mode set to 100644
File size: 8.7 KB
Line 
1
2# $Id$
3
4BOLD = "[0;1m"
5RED = "[1;31m"
6GREEN = "[0;32m"
7ORANGE = "[0;33m"
8BLUE = "[1;34m"
9WHITE = "[00m"
10YELLOW = "[1;33m"
11
12OFF = "[0m"
13REVERSE = "[7m"
14
15tab_ = " "
16nl_ = ""
17
18#==== BUILD MESSAGES ===
19
20define echo_PHASE
21 @echo $(BOLD)--------------------------------------------------------------------------------
22 @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
23 @echo $(BOLD)--------------------------------------------------------------------------------
24 @echo $(WHITE)
25endef
26
27define sh_echo_PHASE
28 echo $(BOLD)--------------------------------------------------------------------------------;\
29 echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
30 echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
31endef
32
33define 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
38endef
39
40define 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
45endef
46
47define 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
52endef
53
54define echo_message
55 @echo $(BOLD)--------------------------------------------------------------------------------
56 @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
57endef
58
59#=======================
60
61
62#=== BUILD FUNCTIONS ===
63
64define 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;
72endef
73
74define 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;
85endef
86
87#==#
88
89define unpack
90 @cd $(SRCSDIR) && \
91 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
92endef
93
94define unpack2
95 @cd $(SRC) && \
96 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
97endef
98
99#==#
100
101define 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;
109endef
110
111define 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 fi;
119endef
120
121define get_pkg_root_LUSER
122 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
123 echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
124endef
125
126#==#
127
128define touch_timestamp
129 @touch $(SRC)/timestamp-marker && sleep 1
130endef
131
132define touch_timestamp_LUSER
133 @touch $(SRCSDIR)/timestamp-marker && sleep 1
134endef
135
136define 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)
140endef
141
142define 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)
146endef
147
148#==@
149
150define remove_build_dirs
151 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
152 rm -rf $(SRCSDIR)/$$ROOT && \
153 rm -rf $(SRCSDIR)/$(1)-build
154endef
155
156define remove_build_dirs2
157 @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
158 rm -rf $(SRC)/$$ROOT && \
159 rm -rf $(SRC)/$(1)-build
160endef
161
162#==#
163
164define 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
173endef
174
175#=======================
176
177
178#==== FINAL MESSAGES ===
179
180define 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)manuel@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)
190endef
191
192define 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_)- Enter to the chroot using the command found
204 @echo $(tab_)in the section -Entering the Chroot Environment-
205 @echo $(tab_)except if building CLFS with METHOD=boot.
206 @echo
207 @echo $(tab_)- Set a password for the root user.
208 @echo
209 @echo $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
210 @echo $(tab_)/etc/sysconfig/console, /etc/sysconfig/network,
211 @echo $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
212 @echo $(tab_)any other configuration file required to suit your needs.
213 @echo
214 @echo $(tab_)- Exit from the chroot.
215 @echo
216 @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
217 @echo $(tab_)You can set-up the host bootloader or the new boot-loader
218 @echo $(tab_)installed on the new system.
219 @echo $(tab_)If the last, you must to mount the virtual filesystems, re-enter
220 @echo $(tab_)the chroot and be sure that /dev is populated with the
221 @echo $(tab_)required devices before configure the boot-loader. When ready,
222 @echo $(tab_)exit from the chroot and umount the filesystems
223 @echo
224 @echo If you are an experienced LFS user, several of those steps can be
225 @echo skipped or done in a different way. But then, that is something
226 @echo that you already know and there is no need to discuss it here.
227 @echo $(BOLD)
228 @echo --------------------------------------------------------------------------------
229 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
230 @echo --------------------------------------------------------------------------------$(WHITE)
231endef
232
233define echo_boot_finished
234 @echo $(BOLD)
235 @echo --------------------------------------------------------------------------------
236 @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
237 @echo --------------------------------------------------------------------------------
238 @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
239 @echo --------------------------------------------------------------------------------
240 @echo
241 @echo The build is not complete. Follow the next steps:$(WHITE)
242 @echo
243 @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
244 @echo $(tab_) and any other configuration file required to suit your needs.
245 @echo $(BOLD)
246 @echo $(BOLD)$(YELLOW)
247 @echo 1.If it is necessary, transfer the newly created partition to the target machine
248 @echo 2.Boot the new partition.
249 @echo 3.Once you are logged in issue the following commands
250 @echo $(tab_) $(BOLD)cd /jhalfs
251 @echo $(tab_) $(BOLD)make makesys
252 @echo The build process should resume. Follow any instructions that appear.
253 @echo --------------------------------------------------------------------------------
254 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
255 @echo --------------------------------------------------------------------------------$(WHITE)
256endef
Note: See TracBrowser for help on using the repository browser.