[877cc6a] | 1 |
|
---|
| 2 | # $Id$
|
---|
| 3 |
|
---|
[045b2dc] | 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 |
|
---|
[fc6076c] | 15 | tab_ = " "
|
---|
| 16 | nl_ = ""
|
---|
[045b2dc] | 17 |
|
---|
[1f81129] | 18 | #==== BUILD MESSAGES ===
|
---|
| 19 |
|
---|
[045b2dc] | 20 | define echo_PHASE
|
---|
| 21 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
[f4d9a48] | 22 | @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
|
---|
[045b2dc] | 23 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
[39a93a4] | 24 | @echo $(WHITE)
|
---|
[045b2dc] | 25 | endef
|
---|
| 26 |
|
---|
[79da297] | 27 | define sh_echo_PHASE
|
---|
| 28 | echo $(BOLD)--------------------------------------------------------------------------------;\
|
---|
| 29 | echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
|
---|
[7072e1f] | 30 | echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
|
---|
[79da297] | 31 | endef
|
---|
| 32 |
|
---|
[045b2dc] | 33 | define echo_SU_request
|
---|
| 34 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
| 35 | @echo $(BLUE)$@
|
---|
[9af9dfa] | 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
|
---|
[045b2dc] | 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)
|
---|
[3e7ceed] | 43 | @echo sudo requires a password
|
---|
[045b2dc] | 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
|
---|
[877cc6a] | 52 |
|
---|
| 53 | define echo_message
|
---|
[045b2dc] | 54 | @echo $(BOLD)--------------------------------------------------------------------------------
|
---|
| 55 | @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
|
---|
[877cc6a] | 56 | endef
|
---|
| 57 |
|
---|
[1f81129] | 58 | #=======================
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | #=== BUILD FUNCTIONS ===
|
---|
| 62 |
|
---|
[401f81e] | 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@/.*@@'` && \
|
---|
[3abe9d7] | 66 | [ -n "$$ROOT" ] && \
|
---|
[b533b78] | 67 | if [ -d $(SRCSDIR)/$$ROOT ]; then \
|
---|
[3abe9d7] | 68 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
| 69 | rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
|
---|
| 70 | fi;
|
---|
[401f81e] | 71 | endef
|
---|
| 72 |
|
---|
| 73 | define remove_existing_dirs2
|
---|
[045b2dc] | 74 | @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
|
---|
[401f81e] | 75 | ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
---|
[3abe9d7] | 76 | [ -n "$$ROOT" ] && \
|
---|
| 77 | if [ -d $(SRC)/$$ROOT ]; then \
|
---|
| 78 | rm -rf $(SRC)/$$ROOT && \
|
---|
| 79 | rm -rf $(SRC)/$${ROOT%-*}-build; \
|
---|
| 80 | fi;
|
---|
[7072e1f] | 81 | @if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
|
---|
| 82 | rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
|
---|
| 83 | fi;
|
---|
[401f81e] | 84 | endef
|
---|
| 85 |
|
---|
[1f81129] | 86 | #==#
|
---|
[401f81e] | 87 |
|
---|
[1f81129] | 88 | define unpack
|
---|
| 89 | @cd $(SRCSDIR) && \
|
---|
| 90 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
[401f81e] | 91 | endef
|
---|
| 92 |
|
---|
[1f81129] | 93 | define unpack2
|
---|
| 94 | @cd $(SRC) && \
|
---|
| 95 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
[401f81e] | 96 | endef
|
---|
| 97 |
|
---|
[1f81129] | 98 | #==#
|
---|
| 99 |
|
---|
[401f81e] | 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@/.*@@'` && \
|
---|
[7072e1f] | 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;
|
---|
[401f81e] | 118 | endef
|
---|
| 119 |
|
---|
[045b2dc] | 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 |
|
---|
[1f81129] | 125 | #==#
|
---|
| 126 |
|
---|
[93346ee] | 127 | define touch_timestamp
|
---|
| 128 | @touch $(SRC)/timestamp-marker && sleep 1
|
---|
| 129 | endef
|
---|
| 130 |
|
---|
[f546320] | 131 | define touch_timestamp_LUSER
|
---|
[a60ed79] | 132 | @touch $(SRCSDIR)/timestamp-marker && sleep 1
|
---|
[f546320] | 133 | endef
|
---|
| 134 |
|
---|
[93346ee] | 135 | define log_new_files
|
---|
[6dfed89] | 136 | @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
|
---|
[93346ee] | 137 | -newer $(SRC)/timestamp-marker -not -type d \
|
---|
[c6f33fb] | 138 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
|
---|
[93346ee] | 139 | endef
|
---|
| 140 |
|
---|
[f546320] | 141 | define log_new_files_LUSER
|
---|
[a60ed79] | 142 | @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
|
---|
| 143 | -newer $(SRCSDIR)/timestamp-marker -not -type d \
|
---|
[f546320] | 144 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
|
---|
| 145 | endef
|
---|
| 146 |
|
---|
[93346ee] | 147 | #==@
|
---|
| 148 |
|
---|
[1f81129] | 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
|
---|
[877cc6a] | 153 | endef
|
---|
| 154 |
|
---|
[1f81129] | 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
|
---|
[877cc6a] | 159 | endef
|
---|
| 160 |
|
---|
[1f81129] | 161 | #==#
|
---|
| 162 |
|
---|
| 163 | define housekeeping
|
---|
| 164 | @touch $@ && \
|
---|
| 165 | sleep .25 && \
|
---|
| 166 | echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
|
---|
[dbcdfd7] | 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
|
---|
[877cc6a] | 172 | endef
|
---|
| 173 |
|
---|
[1f81129] | 174 | #=======================
|
---|
| 175 |
|
---|
| 176 |
|
---|
| 177 | #==== FINAL MESSAGES ===
|
---|
| 178 |
|
---|
[453bef0] | 179 | define echo_report
|
---|
[7fe73c8] | 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)
|
---|
[453bef0] | 189 | endef
|
---|
| 190 |
|
---|
[877cc6a] | 191 | define echo_finished
|
---|
| 192 | @echo $(BOLD)
|
---|
| 193 | @echo --------------------------------------------------------------------------------
|
---|
| 194 | @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
|
---|
| 195 | @echo --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 196 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
[877cc6a] | 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
|
---|
[f4d9a48] | 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.
|
---|
[877cc6a] | 205 | @echo
|
---|
[f4d9a48] | 206 | @echo $(tab_)- Set a password for the root user.
|
---|
[877cc6a] | 207 | @echo
|
---|
[f4d9a48] | 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.
|
---|
[877cc6a] | 212 | @echo
|
---|
[f4d9a48] | 213 | @echo $(tab_)- Exit from the chroot.
|
---|
[877cc6a] | 214 | @echo
|
---|
[f4d9a48] | 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
|
---|
[877cc6a] | 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 --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 228 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
[877cc6a] | 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 --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 237 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
[877cc6a] | 238 | @echo --------------------------------------------------------------------------------
|
---|
| 239 | @echo
|
---|
| 240 | @echo The build is not complete. Follow the next steps:$(WHITE)
|
---|
| 241 | @echo
|
---|
[f4d9a48] | 242 | @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
|
---|
| 243 | @echo $(tab_) and any other configuration file required to suit your needs.
|
---|
[877cc6a] | 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
|
---|
[d981bde] | 249 | @echo $(tab_) $(BOLD)cd /jhalfs
|
---|
[f4d9a48] | 250 | @echo $(tab_) $(BOLD)make makesys
|
---|
[877cc6a] | 251 | @echo The build process should resume. Follow any instructions that appear.
|
---|
| 252 | @echo --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 253 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
[877cc6a] | 254 | @echo --------------------------------------------------------------------------------$(WHITE)
|
---|
| 255 | endef
|
---|