display: added dsleep, added -n switch to prnt, use it in conf_ntp
This commit is contained in:
@@ -88,10 +88,17 @@ export On_IWhite='\e[0;107m'
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Display status with color and timestamp
|
||||
# (-n on first parameter to stay on the same line)
|
||||
# ($1 accepted values: I=info, W=warning, E=error, m=des espaces (allignement)
|
||||
# no header if anything else)
|
||||
prnt()
|
||||
{
|
||||
if [[ $1 == "-n" ]]; then
|
||||
local echoopt=$1
|
||||
shift
|
||||
else
|
||||
local echoopt=""
|
||||
fi
|
||||
case $1 in
|
||||
"I")
|
||||
local heads="[ ${IGreen}info${DEFAULTFG} ]"
|
||||
@@ -110,13 +117,30 @@ prnt()
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
echo -e "${IWhite}$(date $DATEFORMAT)${DEFAULTFG} ${heads} $@"
|
||||
echo $echoopt -e "${IWhite}$(date $DATEFORMAT)${DEFAULTFG} ${heads} $@"
|
||||
|
||||
unset heads
|
||||
unset heads echoopt
|
||||
}
|
||||
export -f prnt
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Sleep and display a counter (or "the second parameter" every second)
|
||||
dsleep()
|
||||
{
|
||||
i=$1
|
||||
while test $i -gt 0
|
||||
do
|
||||
if [[ -n $2 ]]; then
|
||||
echo -n "$2"
|
||||
else
|
||||
echo -n "${i} "
|
||||
(( i=i-1 ))
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Dump the keyboard's buffer
|
||||
dump_key_buffer()
|
||||
|
||||
@@ -41,8 +41,8 @@ conf_ntp()
|
||||
prnt I "Démarrage du service ntp..."
|
||||
svc_start ntp
|
||||
|
||||
prnt I "Attente de 5 secondes pour synchronisation de l'heure..."
|
||||
sleep 5
|
||||
prnt -n I "Attente de 5 secondes pour synchronisation de l'heure"
|
||||
dsleep 5
|
||||
|
||||
ntptime
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user