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