From 9199a13ac6493ab452251bc8c2247c731c7ca508 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sat, 10 Jun 2006 16:48:25 +0000 Subject: [PATCH] Merged r2754:2768 from trunk. --- CLFS/master.sh | 78 +++++++++++++++++++-------------- HLFS/master.sh | 48 ++++++++++++--------- LFS/master.sh | 90 ++++++++++++++++++++++++++++++--------- common/common-functions | 22 ++++++++-- common/func_compare.sh | 6 ++- common/makefile-functions | 14 ++++-- common/progress_bar.sh | 59 ++++++++++++++++++++++--- 7 files changed, 227 insertions(+), 90 deletions(-) diff --git a/CLFS/master.sh b/CLFS/master.sh index a64608a..aec8598 100755 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -20,20 +20,24 @@ host_prep_Makefiles() { # Initialization of the system cat << EOF 023-creatingtoolsdir: @\$(call echo_message, Building) - @mkdir -v \$(MOUNT_PT)/tools && \\ - rm -fv /tools && \\ - ln -sv \$(MOUNT_PT)/tools / + @mkdir \$(MOUNT_PT)/tools && \\ + rm -f /tools && \\ + ln -s \$(MOUNT_PT)/tools / @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ mkdir \$(MOUNT_PT)/sources; \\ fi; @chmod a+wt \$(MOUNT_PT)/sources && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) 024-creatingcrossdir: 023-creatingtoolsdir @mkdir -v \$(MOUNT_PT)/cross-tools && \\ - rm -fv /cross-tools && \\ - ln -sv \$(MOUNT_PT)/cross-tools / - @touch \$@ + rm -f /cross-tools && \\ + ln -s \$(MOUNT_PT)/cross-tools / + @touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) 025-addinguser: 024-creatingcrossdir @\$(call echo_message, Building) @@ -47,15 +51,17 @@ cat << EOF chown lfs \$(MOUNT_PT)/tools && \\ chown lfs \$(MOUNT_PT)/cross-tools && \\ chown lfs \$(MOUNT_PT)/sources && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) 026-settingenvironment: 025-addinguser @\$(call echo_message, Building) @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ - mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ + mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ fi; @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ - mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ + mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ fi; @echo "set +h" > /home/lfs/.bashrc && \\ echo "umask 022" >> /home/lfs/.bashrc && \\ @@ -73,7 +79,9 @@ cat << EOF echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc @chown lfs:lfs /home/lfs/.bashrc && \\ touch envars && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) EOF ) >> $MKFILE.tmp @@ -138,7 +146,7 @@ cross_tools_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -191,7 +199,7 @@ temptools_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -275,7 +283,7 @@ boot_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -341,7 +349,7 @@ chroot_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -395,7 +403,7 @@ testsuite_tools_Makefiles() { # wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -450,7 +458,7 @@ bm_testsuite_tools_Makefiles() { # wrt_remove_build_dirs2 "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -560,7 +568,7 @@ final_system_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -673,7 +681,7 @@ bm_final_system_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -735,7 +743,7 @@ bootscripts_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -796,7 +804,7 @@ bm_bootscripts_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -870,7 +878,7 @@ bootable_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -950,7 +958,7 @@ bm_bootable_Makefiles() { # [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}" # # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -1090,21 +1098,23 @@ clean-chapter4: restore-lfs-env: @\$(call echo_message, Building) @if [ -f /home/lfs/.bashrc.XXX ]; then \\ - mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ + mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ fi; @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ - mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ + mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ fi; @chown lfs:lfs /home/lfs/.bash* && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) do-housekeeping: - -umount \$(MOUNT_PT)/dev/pts - -umount \$(MOUNT_PT)/dev/shm - -umount \$(MOUNT_PT)/dev - -umount \$(MOUNT_PT)/sys - -umount \$(MOUNT_PT)/proc - -if [ ! -f user-lfs-exist ]; then \\ + @-umount \$(MOUNT_PT)/dev/pts + @-umount \$(MOUNT_PT)/dev/shm + @-umount \$(MOUNT_PT)/dev + @-umount \$(MOUNT_PT)/sys + @-umount \$(MOUNT_PT)/proc + @-if [ ! -f user-lfs-exist ]; then \\ userdel lfs; \\ rm -rf /home/lfs; \\ fi; @@ -1176,7 +1186,9 @@ restore-lfs-env: mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ fi; @chown lfs:lfs /home/lfs/.bash* && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) EOF diff --git a/HLFS/master.sh b/HLFS/master.sh index 38ab547..c6d91cc 100755 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -30,14 +30,16 @@ chapter3_Makefiles() { # Initialization of the system cat << EOF 020-creatingtoolsdir: @\$(call echo_message, Building) - @mkdir -v \$(MOUNT_PT)/tools && \\ - rm -fv /tools && \\ - ln -sv \$(MOUNT_PT)/tools / + @mkdir \$(MOUNT_PT)/tools && \\ + rm -f /tools && \\ + ln -s \$(MOUNT_PT)/tools / @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ mkdir \$(MOUNT_PT)/sources; \\ fi; @chmod a+wt \$(MOUNT_PT)/sources && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) 021-addinguser: 020-creatingtoolsdir @\$(call echo_message, Building) @@ -49,15 +51,17 @@ cat << EOF fi; @chown lfs \$(MOUNT_PT)/tools && \\ chown lfs \$(MOUNT_PT)/sources && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) 022-settingenvironment: 021-addinguser @\$(call echo_message, Building) @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ - mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ + mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ fi; @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ - mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ + mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ fi; @echo "set +h" > /home/lfs/.bashrc && \\ echo "umask 022" >> /home/lfs/.bashrc && \\ @@ -72,7 +76,9 @@ cat << EOF echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\ chown lfs:lfs /home/lfs/.bashrc && \\ touch envars && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) EOF ) >> $MKFILE.tmp @@ -197,7 +203,7 @@ EOF esac # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -365,7 +371,7 @@ EOF esac # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -457,7 +463,7 @@ EOF esac # Include a touch of the target name so make can check if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -572,21 +578,23 @@ clean-chapter7: restore-lfs-env: @\$(call echo_message, Building) @if [ -f /home/lfs/.bashrc.XXX ]; then \\ - mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ + mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ fi; @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ - mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ + mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ fi; @chown lfs:lfs /home/lfs/.bash* && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) do-housekeeping: - -umount \$(MOUNT_PT)/dev/pts - -umount \$(MOUNT_PT)/dev/shm - -umount \$(MOUNT_PT)/dev - -umount \$(MOUNT_PT)/sys - -umount \$(MOUNT_PT)/proc - -if [ ! -f user-lfs-exist ]; then \\ + @-umount \$(MOUNT_PT)/dev/pts + @-umount \$(MOUNT_PT)/dev/shm + @-umount \$(MOUNT_PT)/dev + @-umount \$(MOUNT_PT)/sys + @-umount \$(MOUNT_PT)/proc + @-if [ ! -f user-lfs-exist ]; then \\ userdel lfs; \\ rm -rf /home/lfs; \\ fi; diff --git a/LFS/master.sh b/LFS/master.sh index 35befda..d6e0bb0 100755 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -20,10 +20,12 @@ chapter4_Makefiles() { cat << EOF 020-creatingtoolsdir: @\$(call echo_message, Building) - @mkdir -v \$(MOUNT_PT)/tools && \\ - rm -fv /tools && \\ - ln -sv \$(MOUNT_PT)/tools / && \\ - touch \$@ + @mkdir \$(MOUNT_PT)/tools && \\ + rm -f /tools && \\ + ln -s \$(MOUNT_PT)/tools / && \\ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) 021-addinguser: 020-creatingtoolsdir @\$(call echo_message, Building) @@ -35,15 +37,17 @@ chapter4_Makefiles() { fi; @chown lfs \$(MOUNT_PT)/tools && \\ chmod a+wt \$(MOUNT_PT)/sources && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) 022-settingenvironment: 021-addinguser @\$(call echo_message, Building) @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ - mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ + mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ fi; @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ - mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ + mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ fi; @echo "set +h" > /home/lfs/.bashrc && \\ echo "umask 022" >> /home/lfs/.bashrc && \\ @@ -54,7 +58,9 @@ chapter4_Makefiles() { echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\ chown lfs:lfs /home/lfs/.bashrc && \\ touch envars && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) EOF ) >> $MKFILE.tmp } @@ -134,7 +140,7 @@ chapter5_Makefiles() { # Include a touch of the target name so make can check # if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -246,7 +252,7 @@ chapter6_Makefiles() { # Include a touch of the target name so make can check # if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -328,7 +334,7 @@ chapter789_Makefiles() { # Include a touch of the target name so make can check # if it's already been made. - echo -e '\t@touch $@' >> $MKFILE.tmp + wrt_touch # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -406,6 +412,8 @@ clean-all: clean clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4 +restart: restart_code all + clean-chapter4: -if [ ! -f user-lfs-exist ]; then \\ userdel lfs; \\ @@ -438,25 +446,67 @@ clean-chapter789: restore-lfs-env: @\$(call echo_message, Building) @if [ -f /home/lfs/.bashrc.XXX ]; then \\ - mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ + mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ fi; @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ - mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ + mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ fi; @chown lfs:lfs /home/lfs/.bash* && \\ - touch \$@ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) do_housekeeping: - -umount \$(MOUNT_PT)/sys - -umount \$(MOUNT_PT)/proc - -umount \$(MOUNT_PT)/dev/shm - -umount \$(MOUNT_PT)/dev/pts - -umount \$(MOUNT_PT)/dev - -if [ ! -f user-lfs-exist ]; then \\ + @-umount \$(MOUNT_PT)/sys + @-umount \$(MOUNT_PT)/proc + @-umount \$(MOUNT_PT)/dev/shm + @-umount \$(MOUNT_PT)/dev/pts + @-umount \$(MOUNT_PT)/dev + @-if [ ! -f user-lfs-exist ]; then \\ userdel lfs; \\ rm -rf /home/lfs; \\ fi; +restart_code: + @echo ">>> This feature is experimental, BUGS may exist" + + @if [ ! -L /tools ]; then \\ + echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\ + fi; + + @if [ ! -e /tools ]; then \\ + echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\ + fi; + + @if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\ + echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\ + fi; + + @if [ -f ???-kernfs ]; then \\ + mkdir -pv \$(MOUNT_PT)/{dev,proc,sys};\\ + if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\ + mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\ + fi;\\ + if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\ + mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\ + fi;\\ + if ! mount -l | grep bind >/dev/null ; then \\ + mount --bind /dev \$(MOUNT_PT)/dev;\\ + fi;\\ + if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\ + mount -vt devpts devpts \$(MOUNT_PT)/dev/pts;\\ + fi;\\ + if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\ + mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\ + fi;\\ + if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\ + mount -vt proc proc \$(MOUNT_PT)/proc;\\ + fi;\\ + if ! mount -l | grep "$\(MOUNT_PT)/sys" >/dev/null ; then \\ + mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\ + fi;\\ + fi; + EOF ) >> $MKFILE diff --git a/common/common-functions b/common/common-functions index c661476..3eea3dc 100644 --- a/common/common-functions +++ b/common/common-functions @@ -218,8 +218,8 @@ cat << EOF ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\ [[ -n \$\$ROOT ]] && \\ rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\ - if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build ]; then \\ - rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build; \\ + if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build ]; then \\ + rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build; \\ fi; EOF ) >> $MKFILE.tmp @@ -235,8 +235,8 @@ cat << EOF ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\ [[ -n \$\$ROOT ]] && \\ rm -rf \$(SRC)/\$\$ROOT && \\ - if [ -e \$(SRC)/${PKG_NAME%%-*}-build ]; then \\ - rm -rf \$(SRC)/${PKG_NAME%%-*}-build; \\ + if [ -e \$(SRC)/${PKG_NAME%-*}-build ]; then \\ + rm -rf \$(SRC)/${PKG_NAME%-*}-build; \\ fi; EOF ) >> $MKFILE.tmp @@ -464,6 +464,20 @@ EOF } +#----------------------------------# +wrt_touch() { # +#----------------------------------# +( +cat << EOF + @touch \$@ && \\ + sleep .25 && \\ + echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) +EOF +) >> $MKFILE.tmp +} + + #----------------------------------# wrt_report() { # #----------------------------------# diff --git a/common/func_compare.sh b/common/func_compare.sh index 4dc0707..5f988c8 100644 --- a/common/func_compare.sh +++ b/common/func_compare.sh @@ -101,7 +101,7 @@ wrt_do_farce_work() { # } #----------------------------------# -wrt_logs() { # +wrt_logs() { # #----------------------------------# local ITERATION=iteration-$1 @@ -111,7 +111,9 @@ wrt_logs() { # mkdir $ITERATION && \\ mv ${LOGS} $ITERATION && \\ popd 1> /dev/null - @touch \$@ + @touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) EOF ) >> $MKFILE.tmp } diff --git a/common/makefile-functions b/common/makefile-functions index c3fc21a..ac183bb 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -12,7 +12,7 @@ define echo_message @echo $(BOLD) @echo -------------------------------------------------------------------------------- @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD) - @echo --------------------------------------------------------------------------------$(WHITE) + @echo $(WHITE) endef define unpack @@ -56,16 +56,22 @@ define echo_finished @echo -e \\tin the section -Entering the Chroot Environment- @echo -e \\texcept if building CLFS with METHOO=boot. @echo - @echo -e \\t- Set a password for the root user + @echo -e \\t- Set a password for the root user. @echo @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock, @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network, @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and @echo -e \\tany other configuration file required to suit your needs. @echo - @echo -e \\t- Set-up the boot loader. See the relevant book section. + @echo -e \\t- Exit from the chroot. @echo - @echo -e \\t- Unmount the filesystems. + @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOO=boot. + @echo -e \\tYou can set-up the host bootloader or the new boot-loader + @echo -e \\tinstalled on the new system. + @echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter + @echo -e \\tto the chroot and be sure that /dev is populated with the + @echo -e \\trequired devices before configure the boot-loader. When ready, + @echo -e \\texit from the chroot and umount the filesystems @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 diff --git a/common/progress_bar.sh b/common/progress_bar.sh index 04303ef..aaa1af1 100755 --- a/common/progress_bar.sh +++ b/common/progress_bar.sh @@ -4,12 +4,57 @@ set -e +# Be sure that we know the taget name [[ -z $1 ]] && exit +TARGET=$1 # Remember the target build we are looking for -if [ ! -f $1 ] ; then - while fuser -v . 2>&1 | grep make >/dev/null ; do - echo -n "." - sleep 1 - [[ -f $1 ]] && exit - done -fi +declare -r CSI=$'\e[' # DEC terminology, Control Sequence Introducer +declare -r CURSOR_OFF=${CSI}$'?25l' +declare -r CURSOR_ON=${CSI}$'?25h' +declare -r ERASE_LINE=${CSI}$'2K' +declare -r FRAME_OPEN=${CSI}$'2G[' +declare -r FRAME_CLOSE=${CSI}$'63G]' +declare -r TS_POSITION=${CSI}$'65G' +declare -a RESET_LINE=${CURSOR_OFF}${ERASE_LINE}${FRAME_OPEN}${FRAME_CLOSE} + +declare -a GRAPHIC_STR="| / - \\ + " +declare -i SEC=0 # Seconds accumulator +declare -i PREV_SEC=0 + + +write_or_exit() { + # make has been killed or failed or run to completion, leave + if ! fuser -v . 2>&1 | grep make >/dev/null ; then + echo -n "${CURSOR_ON}" && exit + fi + # Target build complete, leave. + [[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit + # It is safe to write to the screen + echo -n "$1" +} + + # initialize screen +write_or_exit "${RESET_LINE}${TS_POSITION}0 min. 0 sec. " + + # loop forever.. +while true ; do + + # Loop through the animation string + for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do + write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}" + sleep .12 # This value MUST be less than .2 seconds. + done + + # A BASH internal variable, the number of seconds the script + # has been running. modulo convert to 0-59 + SEC=$(($SECONDS % 60)) + + # Detect rollover of the seconds. + (( PREV_SEC > SEC )) && write_or_exit "${RESET_LINE}" + (( PREV_SEC = SEC )) + + # Display the accumulated time. div minutes.. modulo seconds. + write_or_exit "${TS_POSITION}$(($SECONDS / 60)) min. $SEC sec. " +done + +exit