Changeset 9199a13
- Timestamp:
- 06/10/2006 04:48:25 PM (18 years ago)
- Branches:
- experimental
- Children:
- 966cb20
- Parents:
- e35e794
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
CLFS/master.sh
re35e794 r9199a13 21 21 023-creatingtoolsdir: 22 22 @\$(call echo_message, Building) 23 @mkdir -v\$(MOUNT_PT)/tools && \\24 rm -f v/tools && \\25 ln -s v\$(MOUNT_PT)/tools /23 @mkdir \$(MOUNT_PT)/tools && \\ 24 rm -f /tools && \\ 25 ln -s \$(MOUNT_PT)/tools / 26 26 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ 27 27 mkdir \$(MOUNT_PT)/sources; \\ 28 28 fi; 29 29 @chmod a+wt \$(MOUNT_PT)/sources && \\ 30 touch \$@ 30 touch \$@ && \\ 31 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 32 echo --------------------------------------------------------------------------------\$(WHITE) 31 33 32 34 024-creatingcrossdir: 023-creatingtoolsdir 33 35 @mkdir -v \$(MOUNT_PT)/cross-tools && \\ 34 rm -fv /cross-tools && \\ 35 ln -sv \$(MOUNT_PT)/cross-tools / 36 @touch \$@ 36 rm -f /cross-tools && \\ 37 ln -s \$(MOUNT_PT)/cross-tools / 38 @touch \$@ && \\ 39 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 40 echo --------------------------------------------------------------------------------\$(WHITE) 37 41 38 42 025-addinguser: 024-creatingcrossdir … … 48 52 chown lfs \$(MOUNT_PT)/cross-tools && \\ 49 53 chown lfs \$(MOUNT_PT)/sources && \\ 50 touch \$@ 54 touch \$@ && \\ 55 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 56 echo --------------------------------------------------------------------------------\$(WHITE) 51 57 52 58 026-settingenvironment: 025-addinguser 53 59 @\$(call echo_message, Building) 54 60 @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ 55 mv -v/home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\61 mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ 56 62 fi; 57 63 @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ 58 mv -v/home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\64 mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ 59 65 fi; 60 66 @echo "set +h" > /home/lfs/.bashrc && \\ … … 74 80 @chown lfs:lfs /home/lfs/.bashrc && \\ 75 81 touch envars && \\ 76 touch \$@ 82 touch \$@ && \\ 83 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 84 echo --------------------------------------------------------------------------------\$(WHITE) 77 85 EOF 78 86 ) >> $MKFILE.tmp … … 139 147 # 140 148 # Include a touch of the target name so make can check if it's already been made. 141 echo -e '\t@touch $@' >> $MKFILE.tmp149 wrt_touch 142 150 # 143 151 #--------------------------------------------------------------------# … … 192 200 # 193 201 # Include a touch of the target name so make can check if it's already been made. 194 echo -e '\t@touch $@' >> $MKFILE.tmp202 wrt_touch 195 203 # 196 204 #--------------------------------------------------------------------# … … 276 284 # 277 285 # Include a touch of the target name so make can check if it's already been made. 278 echo -e '\t@touch $@' >> $MKFILE.tmp286 wrt_touch 279 287 # 280 288 #--------------------------------------------------------------------# … … 342 350 # 343 351 # Include a touch of the target name so make can check if it's already been made. 344 echo -e '\t@touch $@' >> $MKFILE.tmp352 wrt_touch 345 353 # 346 354 #--------------------------------------------------------------------# … … 396 404 # 397 405 # Include a touch of the target name so make can check if it's already been made. 398 echo -e '\t@touch $@' >> $MKFILE.tmp406 wrt_touch 399 407 # 400 408 #--------------------------------------------------------------------# … … 451 459 # 452 460 # Include a touch of the target name so make can check if it's already been made. 453 echo -e '\t@touch $@' >> $MKFILE.tmp461 wrt_touch 454 462 # 455 463 #--------------------------------------------------------------------# … … 561 569 # 562 570 # Include a touch of the target name so make can check if it's already been made. 563 echo -e '\t@touch $@' >> $MKFILE.tmp571 wrt_touch 564 572 # 565 573 #--------------------------------------------------------------------# … … 674 682 # 675 683 # Include a touch of the target name so make can check if it's already been made. 676 echo -e '\t@touch $@' >> $MKFILE.tmp684 wrt_touch 677 685 # 678 686 #--------------------------------------------------------------------# … … 736 744 # 737 745 # Include a touch of the target name so make can check if it's already been made. 738 echo -e '\t@touch $@' >> $MKFILE.tmp746 wrt_touch 739 747 # 740 748 #--------------------------------------------------------------------# … … 797 805 # 798 806 # Include a touch of the target name so make can check if it's already been made. 799 echo -e '\t@touch $@' >> $MKFILE.tmp807 wrt_touch 800 808 # 801 809 #--------------------------------------------------------------------# … … 871 879 # 872 880 # Include a touch of the target name so make can check if it's already been made. 873 echo -e '\t@touch $@' >> $MKFILE.tmp881 wrt_touch 874 882 # 875 883 #--------------------------------------------------------------------# … … 951 959 # 952 960 # Include a touch of the target name so make can check if it's already been made. 953 echo -e '\t@touch $@' >> $MKFILE.tmp961 wrt_touch 954 962 # 955 963 #--------------------------------------------------------------------# … … 1091 1099 @\$(call echo_message, Building) 1092 1100 @if [ -f /home/lfs/.bashrc.XXX ]; then \\ 1093 mv -f v/home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\1101 mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ 1094 1102 fi; 1095 1103 @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ 1096 mv -v/home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\1104 mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ 1097 1105 fi; 1098 1106 @chown lfs:lfs /home/lfs/.bash* && \\ 1099 touch \$@ 1107 touch \$@ && \\ 1108 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 1109 echo --------------------------------------------------------------------------------\$(WHITE) 1100 1110 1101 1111 do-housekeeping: 1102 -umount \$(MOUNT_PT)/dev/pts1103 -umount \$(MOUNT_PT)/dev/shm1104 -umount \$(MOUNT_PT)/dev1105 -umount \$(MOUNT_PT)/sys1106 -umount \$(MOUNT_PT)/proc1107 -if [ ! -f user-lfs-exist ]; then \\1112 @-umount \$(MOUNT_PT)/dev/pts 1113 @-umount \$(MOUNT_PT)/dev/shm 1114 @-umount \$(MOUNT_PT)/dev 1115 @-umount \$(MOUNT_PT)/sys 1116 @-umount \$(MOUNT_PT)/proc 1117 @-if [ ! -f user-lfs-exist ]; then \\ 1108 1118 userdel lfs; \\ 1109 1119 rm -rf /home/lfs; \\ … … 1177 1187 fi; 1178 1188 @chown lfs:lfs /home/lfs/.bash* && \\ 1179 touch \$@ 1189 touch \$@ && \\ 1190 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 1191 echo --------------------------------------------------------------------------------\$(WHITE) 1180 1192 1181 1193 -
HLFS/master.sh
re35e794 r9199a13 31 31 020-creatingtoolsdir: 32 32 @\$(call echo_message, Building) 33 @mkdir -v\$(MOUNT_PT)/tools && \\34 rm -f v/tools && \\35 ln -s v\$(MOUNT_PT)/tools /33 @mkdir \$(MOUNT_PT)/tools && \\ 34 rm -f /tools && \\ 35 ln -s \$(MOUNT_PT)/tools / 36 36 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ 37 37 mkdir \$(MOUNT_PT)/sources; \\ 38 38 fi; 39 39 @chmod a+wt \$(MOUNT_PT)/sources && \\ 40 touch \$@ 40 touch \$@ && \\ 41 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 42 echo --------------------------------------------------------------------------------\$(WHITE) 41 43 42 44 021-addinguser: 020-creatingtoolsdir … … 50 52 @chown lfs \$(MOUNT_PT)/tools && \\ 51 53 chown lfs \$(MOUNT_PT)/sources && \\ 52 touch \$@ 54 touch \$@ && \\ 55 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 56 echo --------------------------------------------------------------------------------\$(WHITE) 53 57 54 58 022-settingenvironment: 021-addinguser 55 59 @\$(call echo_message, Building) 56 60 @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ 57 mv -v/home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\61 mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ 58 62 fi; 59 63 @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ 60 mv -v/home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\64 mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ 61 65 fi; 62 66 @echo "set +h" > /home/lfs/.bashrc && \\ … … 73 77 chown lfs:lfs /home/lfs/.bashrc && \\ 74 78 touch envars && \\ 75 touch \$@ 79 touch \$@ && \\ 80 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 81 echo --------------------------------------------------------------------------------\$(WHITE) 76 82 EOF 77 83 ) >> $MKFILE.tmp … … 198 204 199 205 # Include a touch of the target name so make can check if it's already been made. 200 echo -e '\t@touch $@' >> $MKFILE.tmp206 wrt_touch 201 207 # 202 208 #--------------------------------------------------------------------# … … 366 372 367 373 # Include a touch of the target name so make can check if it's already been made. 368 echo -e '\t@touch $@' >> $MKFILE.tmp374 wrt_touch 369 375 # 370 376 #--------------------------------------------------------------------# … … 458 464 459 465 # Include a touch of the target name so make can check if it's already been made. 460 echo -e '\t@touch $@' >> $MKFILE.tmp466 wrt_touch 461 467 # 462 468 #--------------------------------------------------------------------# … … 573 579 @\$(call echo_message, Building) 574 580 @if [ -f /home/lfs/.bashrc.XXX ]; then \\ 575 mv -f v/home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\581 mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ 576 582 fi; 577 583 @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ 578 mv -v/home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\584 mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ 579 585 fi; 580 586 @chown lfs:lfs /home/lfs/.bash* && \\ 581 touch \$@ 587 touch \$@ && \\ 588 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 589 echo --------------------------------------------------------------------------------\$(WHITE) 582 590 583 591 do-housekeeping: 584 -umount \$(MOUNT_PT)/dev/pts585 -umount \$(MOUNT_PT)/dev/shm586 -umount \$(MOUNT_PT)/dev587 -umount \$(MOUNT_PT)/sys588 -umount \$(MOUNT_PT)/proc589 -if [ ! -f user-lfs-exist ]; then \\592 @-umount \$(MOUNT_PT)/dev/pts 593 @-umount \$(MOUNT_PT)/dev/shm 594 @-umount \$(MOUNT_PT)/dev 595 @-umount \$(MOUNT_PT)/sys 596 @-umount \$(MOUNT_PT)/proc 597 @-if [ ! -f user-lfs-exist ]; then \\ 590 598 userdel lfs; \\ 591 599 rm -rf /home/lfs; \\ -
LFS/master.sh
re35e794 r9199a13 21 21 020-creatingtoolsdir: 22 22 @\$(call echo_message, Building) 23 @mkdir -v \$(MOUNT_PT)/tools && \\ 24 rm -fv /tools && \\ 25 ln -sv \$(MOUNT_PT)/tools / && \\ 26 touch \$@ 23 @mkdir \$(MOUNT_PT)/tools && \\ 24 rm -f /tools && \\ 25 ln -s \$(MOUNT_PT)/tools / && \\ 26 touch \$@ && \\ 27 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 28 echo --------------------------------------------------------------------------------\$(WHITE) 27 29 28 30 021-addinguser: 020-creatingtoolsdir … … 36 38 @chown lfs \$(MOUNT_PT)/tools && \\ 37 39 chmod a+wt \$(MOUNT_PT)/sources && \\ 38 touch \$@ 40 touch \$@ && \\ 41 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 42 echo --------------------------------------------------------------------------------\$(WHITE) 39 43 40 44 022-settingenvironment: 021-addinguser 41 45 @\$(call echo_message, Building) 42 46 @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ 43 mv -v/home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\47 mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ 44 48 fi; 45 49 @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ 46 mv -v/home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\50 mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ 47 51 fi; 48 52 @echo "set +h" > /home/lfs/.bashrc && \\ … … 55 59 chown lfs:lfs /home/lfs/.bashrc && \\ 56 60 touch envars && \\ 57 touch \$@ 61 touch \$@ && \\ 62 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 63 echo --------------------------------------------------------------------------------\$(WHITE) 58 64 EOF 59 65 ) >> $MKFILE.tmp … … 135 141 # Include a touch of the target name so make can check 136 142 # if it's already been made. 137 echo -e '\t@touch $@' >> $MKFILE.tmp143 wrt_touch 138 144 # 139 145 #--------------------------------------------------------------------# … … 247 253 # Include a touch of the target name so make can check 248 254 # if it's already been made. 249 echo -e '\t@touch $@' >> $MKFILE.tmp255 wrt_touch 250 256 # 251 257 #--------------------------------------------------------------------# … … 329 335 # Include a touch of the target name so make can check 330 336 # if it's already been made. 331 echo -e '\t@touch $@' >> $MKFILE.tmp337 wrt_touch 332 338 # 333 339 #--------------------------------------------------------------------# … … 407 413 clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4 408 414 415 restart: restart_code all 416 409 417 clean-chapter4: 410 418 -if [ ! -f user-lfs-exist ]; then \\ … … 439 447 @\$(call echo_message, Building) 440 448 @if [ -f /home/lfs/.bashrc.XXX ]; then \\ 441 mv -f v/home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\449 mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ 442 450 fi; 443 451 @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ 444 mv -v/home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\452 mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ 445 453 fi; 446 454 @chown lfs:lfs /home/lfs/.bash* && \\ 447 touch \$@ 455 touch \$@ && \\ 456 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 457 echo --------------------------------------------------------------------------------\$(WHITE) 448 458 449 459 do_housekeeping: 450 -umount \$(MOUNT_PT)/sys451 -umount \$(MOUNT_PT)/proc452 -umount \$(MOUNT_PT)/dev/shm453 -umount \$(MOUNT_PT)/dev/pts454 -umount \$(MOUNT_PT)/dev455 -if [ ! -f user-lfs-exist ]; then \\460 @-umount \$(MOUNT_PT)/sys 461 @-umount \$(MOUNT_PT)/proc 462 @-umount \$(MOUNT_PT)/dev/shm 463 @-umount \$(MOUNT_PT)/dev/pts 464 @-umount \$(MOUNT_PT)/dev 465 @-if [ ! -f user-lfs-exist ]; then \\ 456 466 userdel lfs; \\ 457 467 rm -rf /home/lfs; \\ 468 fi; 469 470 restart_code: 471 @echo ">>> This feature is experimental, BUGS may exist" 472 473 @if [ ! -L /tools ]; then \\ 474 echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\ 475 fi; 476 477 @if [ ! -e /tools ]; then \\ 478 echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\ 479 fi; 480 481 @if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\ 482 echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\ 483 fi; 484 485 @if [ -f ???-kernfs ]; then \\ 486 mkdir -pv \$(MOUNT_PT)/{dev,proc,sys};\\ 487 if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\ 488 mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\ 489 fi;\\ 490 if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\ 491 mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\ 492 fi;\\ 493 if ! mount -l | grep bind >/dev/null ; then \\ 494 mount --bind /dev \$(MOUNT_PT)/dev;\\ 495 fi;\\ 496 if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\ 497 mount -vt devpts devpts \$(MOUNT_PT)/dev/pts;\\ 498 fi;\\ 499 if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\ 500 mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\ 501 fi;\\ 502 if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\ 503 mount -vt proc proc \$(MOUNT_PT)/proc;\\ 504 fi;\\ 505 if ! mount -l | grep "$\(MOUNT_PT)/sys" >/dev/null ; then \\ 506 mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\ 507 fi;\\ 458 508 fi; 459 509 -
common/common-functions
re35e794 r9199a13 219 219 [[ -n \$\$ROOT ]] && \\ 220 220 rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\ 221 if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME% %-*}-build ]; then \\222 rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME% %-*}-build; \\221 if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build ]; then \\ 222 rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build; \\ 223 223 fi; 224 224 EOF … … 236 236 [[ -n \$\$ROOT ]] && \\ 237 237 rm -rf \$(SRC)/\$\$ROOT && \\ 238 if [ -e \$(SRC)/${PKG_NAME% %-*}-build ]; then \\239 rm -rf \$(SRC)/${PKG_NAME% %-*}-build; \\238 if [ -e \$(SRC)/${PKG_NAME%-*}-build ]; then \\ 239 rm -rf \$(SRC)/${PKG_NAME%-*}-build; \\ 240 240 fi; 241 241 EOF … … 460 460 rm -r \$(SRC)/$name-build; \\ 461 461 fi; 462 EOF 463 ) >> $MKFILE.tmp 464 } 465 466 467 #----------------------------------# 468 wrt_touch() { # 469 #----------------------------------# 470 ( 471 cat << EOF 472 @touch \$@ && \\ 473 sleep .25 && \\ 474 echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 475 echo --------------------------------------------------------------------------------\$(WHITE) 462 476 EOF 463 477 ) >> $MKFILE.tmp -
common/func_compare.sh
re35e794 r9199a13 102 102 103 103 #----------------------------------# 104 wrt_logs() { #104 wrt_logs() { # 105 105 #----------------------------------# 106 106 local ITERATION=iteration-$1 … … 112 112 mv ${LOGS} $ITERATION && \\ 113 113 popd 1> /dev/null 114 @touch \$@ 114 @touch \$@ && \\ 115 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ 116 echo --------------------------------------------------------------------------------\$(WHITE) 115 117 EOF 116 118 ) >> $MKFILE.tmp -
common/makefile-functions
re35e794 r9199a13 13 13 @echo -------------------------------------------------------------------------------- 14 14 @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD) 15 @echo --------------------------------------------------------------------------------$(WHITE)15 @echo $(WHITE) 16 16 endef 17 17 … … 57 57 @echo -e \\texcept if building CLFS with METHOO=boot. 58 58 @echo 59 @echo -e \\t- Set a password for the root user 59 @echo -e \\t- Set a password for the root user. 60 60 @echo 61 61 @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock, … … 64 64 @echo -e \\tany other configuration file required to suit your needs. 65 65 @echo 66 @echo -e \\t- Set-up the boot loader. See the relevant book section.66 @echo -e \\t- Exit from the chroot. 67 67 @echo 68 @echo -e \\t- Unmount the filesystems. 68 @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOO=boot. 69 @echo -e \\tYou can set-up the host bootloader or the new boot-loader 70 @echo -e \\tinstalled on the new system. 71 @echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter 72 @echo -e \\tto the chroot and be sure that /dev is populated with the 73 @echo -e \\trequired devices before configure the boot-loader. When ready, 74 @echo -e \\texit from the chroot and umount the filesystems 69 75 @echo 70 76 @echo If you are an experienced LFS user, several of those steps can be -
common/progress_bar.sh
re35e794 r9199a13 5 5 set -e 6 6 7 # Be sure that we know the taget name 7 8 [[ -z $1 ]] && exit 9 TARGET=$1 # Remember the target build we are looking for 8 10 9 if [ ! -f $1 ] ; then 10 while fuser -v . 2>&1 | grep make >/dev/null ; do 11 echo -n "." 12 sleep 1 13 [[ -f $1 ]] && exit 14 done 15 fi 11 declare -r CSI=$'\e[' # DEC terminology, Control Sequence Introducer 12 declare -r CURSOR_OFF=${CSI}$'?25l' 13 declare -r CURSOR_ON=${CSI}$'?25h' 14 declare -r ERASE_LINE=${CSI}$'2K' 15 declare -r FRAME_OPEN=${CSI}$'2G[' 16 declare -r FRAME_CLOSE=${CSI}$'63G]' 17 declare -r TS_POSITION=${CSI}$'65G' 18 declare -a RESET_LINE=${CURSOR_OFF}${ERASE_LINE}${FRAME_OPEN}${FRAME_CLOSE} 19 20 declare -a GRAPHIC_STR="| / - \\ + " 21 declare -i SEC=0 # Seconds accumulator 22 declare -i PREV_SEC=0 23 24 25 write_or_exit() { 26 # make has been killed or failed or run to completion, leave 27 if ! fuser -v . 2>&1 | grep make >/dev/null ; then 28 echo -n "${CURSOR_ON}" && exit 29 fi 30 # Target build complete, leave. 31 [[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit 32 # It is safe to write to the screen 33 echo -n "$1" 34 } 35 36 # initialize screen 37 write_or_exit "${RESET_LINE}${TS_POSITION}0 min. 0 sec. " 38 39 # loop forever.. 40 while true ; do 41 42 # Loop through the animation string 43 for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do 44 write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}" 45 sleep .12 # This value MUST be less than .2 seconds. 46 done 47 48 # A BASH internal variable, the number of seconds the script 49 # has been running. modulo convert to 0-59 50 SEC=$(($SECONDS % 60)) 51 52 # Detect rollover of the seconds. 53 (( PREV_SEC > SEC )) && write_or_exit "${RESET_LINE}" 54 (( PREV_SEC = SEC )) 55 56 # Display the accumulated time. div minutes.. modulo seconds. 57 write_or_exit "${TS_POSITION}$(($SECONDS / 60)) min. $SEC sec. " 58 done 59 60 exit
Note:
See TracChangeset
for help on using the changeset viewer.