externalise in libs: dump_key_buffer and set_system_proxy
This commit is contained in:
10
init.sh
10
init.sh
@@ -86,6 +86,7 @@ read_commandline $@
|
|||||||
# (--help and --version are allowed as unprivileged user)
|
# (--help and --version are allowed as unprivileged user)
|
||||||
check_root
|
check_root
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
# Logfile variable treatment -- cannot be a function
|
# Logfile variable treatment -- cannot be a function
|
||||||
|
|
||||||
if [[ -n $NEW_LOGFILE ]]; then
|
if [[ -n $NEW_LOGFILE ]]; then
|
||||||
@@ -113,6 +114,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# -- Cannot be a function ends here
|
# -- Cannot be a function ends here
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
load_autoconf
|
load_autoconf
|
||||||
|
|
||||||
@@ -120,11 +122,7 @@ load_configuration
|
|||||||
|
|
||||||
process_commandline_and_vars
|
process_commandline_and_vars
|
||||||
|
|
||||||
# Declare proxy system vars if needed and if not already declared
|
set_system_proxy
|
||||||
if [[ -n $PROXYSRV && -n $PROXYSRVPORT && -z $NO_PROXY ]]; then
|
|
||||||
export http_proxy=${http_proxy:-"http://$PROXYSRV:$PROXYSRVPORT/"}
|
|
||||||
export https_proxy=${https_proxy:-"http://$PROXYSRV:$PROXYSRVPORT/"}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Reinit stage file if no resuming
|
# Reinit stage file if no resuming
|
||||||
if [[ $RESUME != true ]]; then
|
if [[ $RESUME != true ]]; then
|
||||||
@@ -203,7 +201,7 @@ fi
|
|||||||
echo -e "${BYellow}Si vous continuez après cette étape le système sera modifié !${DEFAULTCOL}"
|
echo -e "${BYellow}Si vous continuez après cette étape le système sera modifié !${DEFAULTCOL}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
while read -r -t 0.001; do :; done # Dump the buffer
|
dump_key_buffer
|
||||||
read -n 1 -rsp $"Appuyer sur la touche <C> pour continuer ou une autre pour s'arrêter..." key
|
read -n 1 -rsp $"Appuyer sur la touche <C> pour continuer ou une autre pour s'arrêter..." key
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ export On_IWhite='\e[0;107m'
|
|||||||
# Display status with color and timestamp
|
# Display status with color and timestamp
|
||||||
# ($1 accepted values: I=info, W=warning, E=error, m=des espaces (allignement)
|
# ($1 accepted values: I=info, W=warning, E=error, m=des espaces (allignement)
|
||||||
# no header if anything else)
|
# no header if anything else)
|
||||||
prnt() {
|
prnt()
|
||||||
|
{
|
||||||
case $1 in
|
case $1 in
|
||||||
"I")
|
"I")
|
||||||
local heads="[ ${IGreen}info${DEFAULTFG} ]"
|
local heads="[ ${IGreen}info${DEFAULTFG} ]"
|
||||||
@@ -115,4 +116,15 @@ prnt() {
|
|||||||
}
|
}
|
||||||
export -f prnt
|
export -f prnt
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Dump the keyboard's buffer
|
||||||
|
dump_key_buffer()
|
||||||
|
{
|
||||||
|
while read -r -t 0.001; do
|
||||||
|
:
|
||||||
|
done
|
||||||
|
}
|
||||||
|
export -f dump_key_buffer
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@@ -111,4 +111,17 @@ get_mod_name()
|
|||||||
}
|
}
|
||||||
export -f get_mod_name
|
export -f get_mod_name
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Set system proxy vars
|
||||||
|
set_system_proxy()
|
||||||
|
{
|
||||||
|
# Declare proxy system vars if needed and if not already declared
|
||||||
|
if [[ -n $PROXYSRV && -n $PROXYSRVPORT && -z $NO_PROXY ]]; then
|
||||||
|
export http_proxy=${http_proxy:-"http://$PROXYSRV:$PROXYSRVPORT/"}
|
||||||
|
export https_proxy=${https_proxy:-"http://$PROXYSRV:$PROXYSRVPORT/"}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
export -f set_system_proxy
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user