[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
|
---|
[bb7de70] | 38 | endef
|
---|
[045b2dc] | 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@/.*@@'` && \
|
---|
[3abe9d7] | 67 | [ -n "$$ROOT" ] && \
|
---|
[b533b78] | 68 | if [ -d $(SRCSDIR)/$$ROOT ]; then \
|
---|
[3abe9d7] | 69 | rm -rf $(SRCSDIR)/$$ROOT && \
|
---|
| 70 | rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
|
---|
| 71 | fi;
|
---|
[401f81e] | 72 | endef
|
---|
| 73 |
|
---|
| 74 | define remove_existing_dirs2
|
---|
[045b2dc] | 75 | @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
|
---|
[401f81e] | 76 | ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
---|
[3abe9d7] | 77 | [ -n "$$ROOT" ] && \
|
---|
| 78 | if [ -d $(SRC)/$$ROOT ]; then \
|
---|
| 79 | rm -rf $(SRC)/$$ROOT && \
|
---|
| 80 | rm -rf $(SRC)/$${ROOT%-*}-build; \
|
---|
| 81 | fi;
|
---|
[7072e1f] | 82 | @if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
|
---|
| 83 | rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
|
---|
| 84 | fi;
|
---|
[401f81e] | 85 | endef
|
---|
| 86 |
|
---|
[1f81129] | 87 | #==#
|
---|
[401f81e] | 88 |
|
---|
[1f81129] | 89 | define unpack
|
---|
| 90 | @cd $(SRCSDIR) && \
|
---|
| 91 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
[401f81e] | 92 | endef
|
---|
| 93 |
|
---|
[1f81129] | 94 | define unpack2
|
---|
| 95 | @cd $(SRC) && \
|
---|
| 96 | tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
---|
[401f81e] | 97 | endef
|
---|
| 98 |
|
---|
[1f81129] | 99 | #==#
|
---|
| 100 |
|
---|
[401f81e] | 101 | define 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;
|
---|
| 109 | endef
|
---|
| 110 |
|
---|
| 111 | define get_pkg_root2
|
---|
| 112 | @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
---|
[7072e1f] | 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;
|
---|
[401f81e] | 119 | endef
|
---|
| 120 |
|
---|
[045b2dc] | 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 |
|
---|
[1f81129] | 126 | #==#
|
---|
| 127 |
|
---|
[93346ee] | 128 | define touch_timestamp
|
---|
| 129 | @touch $(SRC)/timestamp-marker && sleep 1
|
---|
| 130 | endef
|
---|
| 131 |
|
---|
[f546320] | 132 | define touch_timestamp_LUSER
|
---|
[a60ed79] | 133 | @touch $(SRCSDIR)/timestamp-marker && sleep 1
|
---|
[f546320] | 134 | endef
|
---|
| 135 |
|
---|
[93346ee] | 136 | define log_new_files
|
---|
[6dfed89] | 137 | @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
|
---|
[93346ee] | 138 | -newer $(SRC)/timestamp-marker -not -type d \
|
---|
[c6f33fb] | 139 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
|
---|
[93346ee] | 140 | endef
|
---|
| 141 |
|
---|
[f546320] | 142 | define log_new_files_LUSER
|
---|
[a60ed79] | 143 | @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
|
---|
| 144 | -newer $(SRCSDIR)/timestamp-marker -not -type d \
|
---|
[f546320] | 145 | -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
|
---|
| 146 | endef
|
---|
| 147 |
|
---|
[93346ee] | 148 | #==@
|
---|
| 149 |
|
---|
[1f81129] | 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
|
---|
[877cc6a] | 154 | endef
|
---|
| 155 |
|
---|
[1f81129] | 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
|
---|
[877cc6a] | 160 | endef
|
---|
| 161 |
|
---|
[1f81129] | 162 | #==#
|
---|
| 163 |
|
---|
| 164 | define housekeeping
|
---|
| 165 | @touch $@ && \
|
---|
| 166 | sleep .25 && \
|
---|
| 167 | echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
|
---|
[dbcdfd7] | 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
|
---|
[877cc6a] | 173 | endef
|
---|
| 174 |
|
---|
[1f81129] | 175 | #=======================
|
---|
| 176 |
|
---|
| 177 |
|
---|
| 178 | #==== FINAL MESSAGES ===
|
---|
| 179 |
|
---|
[453bef0] | 180 | define echo_report
|
---|
[7fe73c8] | 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) ; \
|
---|
[80ee2ff] | 185 | echo file to $(BOLD)jhalfs-reports@linuxfromscratch.org$(WHITE) ; \
|
---|
[7fe73c8] | 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)
|
---|
[453bef0] | 190 | endef
|
---|
| 191 |
|
---|
[877cc6a] | 192 | define echo_finished
|
---|
| 193 | @echo $(BOLD)
|
---|
| 194 | @echo --------------------------------------------------------------------------------
|
---|
| 195 | @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
|
---|
| 196 | @echo --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 197 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
[877cc6a] | 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
|
---|
[80ee2ff] | 203 | @echo $(tab_)- Mount the virtual kernel file systems.
|
---|
| 204 | @echo
|
---|
[f4d9a48] | 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 CLFS with METHOD=boot.
|
---|
[877cc6a] | 208 | @echo
|
---|
[f4d9a48] | 209 | @echo $(tab_)- Set a password for the root user.
|
---|
[877cc6a] | 210 | @echo
|
---|
[80ee2ff] | 211 | @echo $(tab_)- Edit or create /etc/fstab,
|
---|
[06bb141] | 212 | @echo $(tab_) " /etc/hosts,"
|
---|
| 213 | @echo $(tab_) " /etc/sysconfig/clock,"
|
---|
| 214 | @echo $(tab_) " /etc/sysconfig/console,"
|
---|
| 215 | @echo $(tab_) " /etc/sysconfig/network,"
|
---|
| 216 | @echo $(tab_) " /etc/sysconfig/ifconfig.eth0"
|
---|
[80ee2ff] | 217 | @echo $(tab_)and any other configuration file required to suit your needs.
|
---|
[877cc6a] | 218 | @echo
|
---|
[f4d9a48] | 219 | @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
|
---|
[80ee2ff] | 220 | @echo
|
---|
| 221 | @echo $(tab_)You can set-up the new boot-loader installed on the new system
|
---|
| 222 | @echo $(tab_)or the host bootloader.
|
---|
| 223 | @echo
|
---|
[06bb141] | 224 | @echo $(tab_)If the last, it is better to exit first from the chroot.
|
---|
[80ee2ff] | 225 | @echo
|
---|
| 226 | @echo $(tab_)- Exit from the chroot and umount the filesystems.
|
---|
[877cc6a] | 227 | @echo
|
---|
| 228 | @echo If you are an experienced LFS user, several of those steps can be
|
---|
| 229 | @echo skipped or done in a different way. But then, that is something
|
---|
| 230 | @echo that you already know and there is no need to discuss it here.
|
---|
| 231 | @echo $(BOLD)
|
---|
| 232 | @echo --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 233 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
[877cc6a] | 234 | @echo --------------------------------------------------------------------------------$(WHITE)
|
---|
| 235 | endef
|
---|
| 236 |
|
---|
| 237 | define echo_boot_finished
|
---|
| 238 | @echo $(BOLD)
|
---|
| 239 | @echo --------------------------------------------------------------------------------
|
---|
| 240 | @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
|
---|
| 241 | @echo --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 242 | @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
---|
[877cc6a] | 243 | @echo --------------------------------------------------------------------------------
|
---|
| 244 | @echo
|
---|
| 245 | @echo The build is not complete. Follow the next steps:$(WHITE)
|
---|
| 246 | @echo
|
---|
[f4d9a48] | 247 | @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
|
---|
| 248 | @echo $(tab_) and any other configuration file required to suit your needs.
|
---|
[877cc6a] | 249 | @echo $(BOLD)
|
---|
| 250 | @echo $(BOLD)$(YELLOW)
|
---|
| 251 | @echo 1.If it is necessary, transfer the newly created partition to the target machine
|
---|
| 252 | @echo 2.Boot the new partition.
|
---|
| 253 | @echo 3.Once you are logged in issue the following commands
|
---|
[d981bde] | 254 | @echo $(tab_) $(BOLD)cd /jhalfs
|
---|
[f4d9a48] | 255 | @echo $(tab_) $(BOLD)make makesys
|
---|
[877cc6a] | 256 | @echo The build process should resume. Follow any instructions that appear.
|
---|
| 257 | @echo --------------------------------------------------------------------------------
|
---|
[f4d9a48] | 258 | @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
---|
[877cc6a] | 259 | @echo --------------------------------------------------------------------------------$(WHITE)
|
---|
| 260 | endef
|
---|