2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
|
BOLD = "[0;1m"
|
|
|
|
|
RED = "[1;31m"
|
|
|
|
|
GREEN = "[0;32m"
|
|
|
|
|
ORANGE = "[0;33m"
|
|
|
|
|
BLUE = "[1;34m"
|
|
|
|
|
WHITE = "[00m"
|
|
|
|
|
YELLOW = "[1;33m"
|
|
|
|
|
|
|
|
|
|
OFF = "[0m"
|
|
|
|
|
REVERSE = "[7m"
|
|
|
|
|
|
2006-11-06 23:06:35 +01:00
|
|
|
|
tab_ = " "
|
|
|
|
|
nl_ = ""
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
#==== BUILD MESSAGES ===
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
|
define echo_PHASE
|
|
|
|
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
|
2006-10-02 21:32:06 +02:00
|
|
|
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
2007-02-25 10:44:08 +01:00
|
|
|
|
@echo $(WHITE)
|
2006-10-02 21:32:06 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2007-03-02 01:09:55 +01:00
|
|
|
|
define sh_echo_PHASE
|
|
|
|
|
echo $(BOLD)--------------------------------------------------------------------------------;\
|
|
|
|
|
echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
|
2012-02-02 00:29:37 +01:00
|
|
|
|
echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
|
2007-03-02 01:09:55 +01:00
|
|
|
|
endef
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
|
define echo_SU_request
|
|
|
|
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
|
|
|
|
@echo $(BLUE)$@
|
|
|
|
|
@echo $(WHITE)ROOT privilege is required to perform a number commands
|
|
|
|
|
@echo sudo will request a password to all high privilege cmds to execute correctly
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define echo_SULUSER_request
|
|
|
|
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
|
|
|
|
@echo $(BOLD)$(BLUE)$@
|
|
|
|
|
@echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
2006-12-15 11:53:10 +01:00
|
|
|
|
@echo sudo requires a password
|
2006-10-02 21:32:06 +02:00
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define echo_CHROOT_request
|
|
|
|
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
|
|
|
|
@echo $(BOLD)$(BLUE)$@
|
|
|
|
|
@echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
|
|
|
|
|
@echo a password is required
|
|
|
|
|
endef
|
2006-04-06 21:35:22 +02:00
|
|
|
|
|
|
|
|
|
define echo_message
|
2006-10-02 21:32:06 +02:00
|
|
|
|
@echo $(BOLD)--------------------------------------------------------------------------------
|
|
|
|
|
@echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
#=======================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#=== BUILD FUNCTIONS ===
|
|
|
|
|
|
2006-08-16 19:42:54 +02:00
|
|
|
|
define remove_existing_dirs
|
|
|
|
|
@PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
|
|
|
|
|
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
2007-08-15 19:04:38 +02:00
|
|
|
|
[ -n "$$ROOT" ] && \
|
|
|
|
|
if [ -d $(SRCDIR)/$$ROOT ]; then \
|
|
|
|
|
rm -rf $(SRCSDIR)/$$ROOT && \
|
|
|
|
|
rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
|
|
|
|
|
fi;
|
2006-08-16 19:42:54 +02:00
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define remove_existing_dirs2
|
2006-10-02 21:32:06 +02:00
|
|
|
|
@PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
|
2006-08-16 19:42:54 +02:00
|
|
|
|
ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
|
2007-08-15 19:04:38 +02:00
|
|
|
|
[ -n "$$ROOT" ] && \
|
|
|
|
|
if [ -d $(SRC)/$$ROOT ]; then \
|
|
|
|
|
rm -rf $(SRC)/$$ROOT && \
|
|
|
|
|
rm -rf $(SRC)/$${ROOT%-*}-build; \
|
|
|
|
|
fi;
|
2012-02-02 00:29:37 +01:00
|
|
|
|
@if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
|
|
|
|
|
rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
|
|
|
|
|
fi;
|
2006-08-16 19:42:54 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
#==#
|
2006-08-16 19:42:54 +02:00
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
define unpack
|
|
|
|
|
@cd $(SRCSDIR) && \
|
|
|
|
|
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
2006-08-16 19:42:54 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
define unpack2
|
|
|
|
|
@cd $(SRC) && \
|
|
|
|
|
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
|
2006-08-16 19:42:54 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
#==#
|
|
|
|
|
|
2006-08-16 19:42:54 +02:00
|
|
|
|
define get_pkg_root
|
|
|
|
|
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
|
|
|
|
if [ "$(1)" != "nouser" ]; then \
|
|
|
|
|
echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \
|
|
|
|
|
chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \
|
|
|
|
|
else \
|
|
|
|
|
echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \
|
|
|
|
|
fi;
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define get_pkg_root2
|
|
|
|
|
@ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
2012-02-02 00:29:37 +01:00
|
|
|
|
echo "export PKGDIR=$(SRC)/$$ROOT" > envars; \
|
|
|
|
|
if [ "$(PKGMNGT)" = "y" ]; then \
|
|
|
|
|
echo "export PKG_DEST=$(SRC)/$@" >> envars; \
|
|
|
|
|
echo "source packInstall.sh" >> envars; \
|
|
|
|
|
echo "export -f packInstall" >> envars; \
|
|
|
|
|
fi;
|
2006-08-16 19:42:54 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
|
define get_pkg_root_LUSER
|
|
|
|
|
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
|
|
|
|
echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
|
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
#==#
|
|
|
|
|
|
2007-04-28 17:24:20 +02:00
|
|
|
|
define touch_timestamp
|
|
|
|
|
@touch $(SRC)/timestamp-marker && sleep 1
|
|
|
|
|
endef
|
|
|
|
|
|
2007-06-03 11:06:13 +02:00
|
|
|
|
define touch_timestamp_LUSER
|
2007-07-02 22:59:52 +02:00
|
|
|
|
@touch $(SRCSDIR)/timestamp-marker && sleep 1
|
2007-06-03 11:06:13 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2007-04-28 17:24:20 +02:00
|
|
|
|
define log_new_files
|
2007-05-19 22:46:36 +02:00
|
|
|
|
@find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
|
2007-04-28 17:24:20 +02:00
|
|
|
|
-newer $(SRC)/timestamp-marker -not -type d \
|
2007-05-27 13:57:54 +02:00
|
|
|
|
-printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
|
2007-04-28 17:24:20 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2007-06-03 11:06:13 +02:00
|
|
|
|
define log_new_files_LUSER
|
2007-07-02 22:59:52 +02:00
|
|
|
|
@find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
|
|
|
|
|
-newer $(SRCSDIR)/timestamp-marker -not -type d \
|
2007-06-03 11:06:13 +02:00
|
|
|
|
-printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
|
|
|
|
|
endef
|
|
|
|
|
|
2007-04-28 17:24:20 +02:00
|
|
|
|
#==@
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
define remove_build_dirs
|
|
|
|
|
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
|
|
|
|
rm -rf $(SRCSDIR)/$$ROOT && \
|
|
|
|
|
rm -rf $(SRCSDIR)/$(1)-build
|
2006-04-06 21:35:22 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
define remove_build_dirs2
|
|
|
|
|
@ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
|
|
|
|
rm -rf $(SRC)/$$ROOT && \
|
|
|
|
|
rm -rf $(SRC)/$(1)-build
|
2006-04-06 21:35:22 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
#==#
|
|
|
|
|
|
|
|
|
|
define housekeeping
|
|
|
|
|
@touch $@ && \
|
|
|
|
|
sleep .25 && \
|
|
|
|
|
echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
|
2007-03-18 11:14:04 +01:00
|
|
|
|
echo --------------------------------------------------------------------------------$(WHITE) && \
|
|
|
|
|
if [ "$(BREAKPOINT)" = "$@" ] ; then \
|
|
|
|
|
echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \
|
|
|
|
|
false ; \
|
|
|
|
|
fi
|
2006-04-06 21:35:22 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-11-12 13:10:25 +01:00
|
|
|
|
#=======================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#==== FINAL MESSAGES ===
|
|
|
|
|
|
2006-04-26 21:59:19 +02:00
|
|
|
|
define echo_report
|
2007-02-25 20:24:17 +01:00
|
|
|
|
echo ; \
|
|
|
|
|
echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
|
|
|
|
|
echo ; \
|
|
|
|
|
echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
|
|
|
|
|
echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \
|
|
|
|
|
echo ; \
|
|
|
|
|
echo That will help us to keep more accurate SBU and ; \
|
|
|
|
|
echo disk usage values into the book. Thanks. ; \
|
|
|
|
|
echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
|
2006-04-26 21:59:19 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2006-04-06 21:35:22 +02:00
|
|
|
|
define echo_finished
|
|
|
|
|
@echo $(BOLD)
|
|
|
|
|
@echo --------------------------------------------------------------------------------
|
|
|
|
|
@echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
|
|
|
|
|
@echo --------------------------------------------------------------------------------
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo --------------------------------------------------------------------------------
|
|
|
|
|
@echo
|
|
|
|
|
@echo To be able to boot your new system you need to follow
|
|
|
|
|
@echo the next steps:$(WHITE)
|
|
|
|
|
@echo
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)- Enter to the chroot using the command found
|
|
|
|
|
@echo $(tab_)in the section -Entering the Chroot Environment-
|
|
|
|
|
@echo $(tab_)except if building CLFS with METHOD=boot.
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)- Set a password for the root user.
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
|
|
|
|
|
@echo $(tab_)/etc/sysconfig/console, /etc/sysconfig/network,
|
|
|
|
|
@echo $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
|
|
|
|
|
@echo $(tab_)any other configuration file required to suit your needs.
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)- Exit from the chroot.
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
|
|
|
|
|
@echo $(tab_)You can set-up the host bootloader or the new boot-loader
|
|
|
|
|
@echo $(tab_)installed on the new system.
|
|
|
|
|
@echo $(tab_)If the last, you must to mount the virtual filesystems, re-enter
|
|
|
|
|
@echo $(tab_)the chroot and be sure that /dev is populated with the
|
|
|
|
|
@echo $(tab_)required devices before configure the boot-loader. When ready,
|
|
|
|
|
@echo $(tab_)exit from the chroot and umount the filesystems
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo
|
|
|
|
|
@echo If you are an experienced LFS user, several of those steps can be
|
|
|
|
|
@echo skipped or done in a different way. But then, that is something
|
|
|
|
|
@echo that you already know and there is no need to discuss it here.
|
|
|
|
|
@echo $(BOLD)
|
|
|
|
|
@echo --------------------------------------------------------------------------------
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo --------------------------------------------------------------------------------$(WHITE)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define echo_boot_finished
|
|
|
|
|
@echo $(BOLD)
|
|
|
|
|
@echo --------------------------------------------------------------------------------
|
|
|
|
|
@echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
|
|
|
|
|
@echo --------------------------------------------------------------------------------
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo --------------------------------------------------------------------------------
|
|
|
|
|
@echo
|
|
|
|
|
@echo The build is not complete. Follow the next steps:$(WHITE)
|
|
|
|
|
@echo
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
|
|
|
|
|
@echo $(tab_) and any other configuration file required to suit your needs.
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo $(BOLD)
|
|
|
|
|
@echo $(BOLD)$(YELLOW)
|
|
|
|
|
@echo 1.If it is necessary, transfer the newly created partition to the target machine
|
|
|
|
|
@echo 2.Boot the new partition.
|
|
|
|
|
@echo 3.Once you are logged in issue the following commands
|
2006-11-06 22:19:54 +01:00
|
|
|
|
@echo $(tab_) $(BOLD)cd /jhalfs
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_) $(BOLD)make makesys
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo The build process should resume. Follow any instructions that appear.
|
|
|
|
|
@echo --------------------------------------------------------------------------------
|
2006-11-06 20:41:19 +01:00
|
|
|
|
@echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
2006-04-06 21:35:22 +02:00
|
|
|
|
@echo --------------------------------------------------------------------------------$(WHITE)
|
|
|
|
|
endef
|