Now the progress bar is a pretty time counter.
This commit is contained in:
parent
cee9568f3d
commit
843c479fed
2 changed files with 46 additions and 8 deletions
|
@ -7,6 +7,7 @@ GREEN= "[0;32m"
|
||||||
ORANGE= "[0;33m"
|
ORANGE= "[0;33m"
|
||||||
BLUE= "[1;34m"
|
BLUE= "[1;34m"
|
||||||
WHITE= "[00m"
|
WHITE= "[00m"
|
||||||
|
CURSOR_ON= "[?25h"
|
||||||
|
|
||||||
define echo_message
|
define echo_message
|
||||||
@echo $(BOLD)
|
@echo $(BOLD)
|
||||||
|
@ -72,7 +73,7 @@ define echo_finished
|
||||||
@echo that you already know and there is no need to discuss it here.
|
@echo that you already know and there is no need to discuss it here.
|
||||||
@echo $(BOLD)
|
@echo $(BOLD)
|
||||||
@echo --------------------------------------------------------------------------------
|
@echo --------------------------------------------------------------------------------
|
||||||
@echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
@echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)$(CURSOR_ON)
|
||||||
@echo --------------------------------------------------------------------------------$(WHITE)
|
@echo --------------------------------------------------------------------------------$(WHITE)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -97,6 +98,6 @@ define echo_boot_finished
|
||||||
@echo -e \\t $(BOLD)make makesys
|
@echo -e \\t $(BOLD)make makesys
|
||||||
@echo The build process should resume. Follow any instructions that appear.
|
@echo The build process should resume. Follow any instructions that appear.
|
||||||
@echo --------------------------------------------------------------------------------
|
@echo --------------------------------------------------------------------------------
|
||||||
@echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
|
@echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)$(CURSOR_ON)
|
||||||
@echo --------------------------------------------------------------------------------$(WHITE)
|
@echo --------------------------------------------------------------------------------$(WHITE)
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -4,12 +4,49 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Be sure that we know the taget name
|
||||||
[[ -z $1 ]] && exit
|
[[ -z $1 ]] && exit
|
||||||
|
TARGET=$1 # Remember the target build we are looking for
|
||||||
|
|
||||||
if [ ! -f $1 ] ; then
|
declare -r CSI=$'\e[' # DEC terminology, Control Sequence Introducer
|
||||||
while fuser -v . 2>&1 | grep make >/dev/null ; do
|
declare -r CURSOR_OFF=${CSI}$'?25l'
|
||||||
echo -n "."
|
declare -r CURSOR_ON=${CSI}$'?25h'
|
||||||
sleep 1
|
declare -r ERASE_LINE=${CSI}$'2K'
|
||||||
[[ -f $1 ]] && exit
|
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 MIN=0 # Start value for minutes
|
||||||
|
declare -i SEC=0 # Seconds accumulator
|
||||||
|
declare -i POS=0 # Start value for seconds/cursor position
|
||||||
|
|
||||||
|
write_or_exit() {
|
||||||
|
# make has been killed or failed, leave
|
||||||
|
if ! fuser -v . 2>&1 | grep make >/dev/null ; then
|
||||||
|
echo -n "${CURSOR_ON}" && exit
|
||||||
|
fi
|
||||||
|
# Target build complete, leave. If we are here, make is alive and a new
|
||||||
|
# package target may has been started. Close this instance of the script.
|
||||||
|
# The cursor will be restored by echo-finished in makefile-functions.
|
||||||
|
[[ -f ${TARGET} ]] && exit
|
||||||
|
# It is safe to write to the screen
|
||||||
|
echo -n "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# This will loop forever.. or overflow, which ever comes forst :)
|
||||||
|
for ((MIN=0; MIN >= 0; MIN++)); do
|
||||||
|
write_or_exit "${RESET_LINE}${TS_POSITION}${MIN} min. 0 sec. "
|
||||||
|
# Count the seconds
|
||||||
|
for ((SEC=1, POS=3; SEC <= 60; SEC++, POS++)); do
|
||||||
|
for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do
|
||||||
|
write_or_exit "${CSI}${POS}G${GRAPHIC_CHAR}"
|
||||||
|
sleep .2
|
||||||
|
done
|
||||||
|
# Display then accumlated time.
|
||||||
|
write_or_exit "${TS_POSITION}${MIN} min. ${SEC} sec. "
|
||||||
done
|
done
|
||||||
fi
|
done
|
||||||
|
exit
|
||||||
|
|
||||||
|
|
Reference in a new issue