Move DELAY function to bash/functions.sh

pull/334/head
Romeo-Golf 2016-12-22 11:36:45 +00:00
rodzic 56ee20aac5
commit d2c5da66ea
2 zmienionych plików z 20 dodań i 16 usunięć

Wyświetl plik

@ -31,7 +31,7 @@
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#######################################################################
#################################################################################
# Detect if a package is installed and if not attempt to install it.
function CheckPackage {
@ -107,6 +107,7 @@ function UncommentConfig {
sudo sed -i -e "/$1/s/^#//" $2
}
#################################################################################
# The following function is used to clean up the log files by removing
# any color escaping sequences from the log file so it is easier to read.
# There are other lines not needed which can be removed as well.
@ -117,3 +118,19 @@ function CleanLogFile {
# Remove the "Press enter to continue..." lines from the log file.
sed -i "/Press enter to continue.../d" $1
}
#################################################################################
# Add a pseudo-random delay of between 5 and 59 minutes
function RandomDelay() {
if [[ ${DELAY} = "true" ]] ; then
DELAY_TIME=`echo "(( 300 + ( $RANDOM + $RANDOM )) / 20 )" | bc`
DATE=`date`
echo -e ""
echo -e "\e[91m $ADSB_PROJECTTITLE"
echo -e ""
echo -en "\e[92m Pausing for ${DELAY_TIME} seconds from: \t\e[39m $DATE"
echo -e ""
sleep $DELAY_TIME
fi
}

Wyświetl plik

@ -93,6 +93,7 @@ function AptUpdate() {
fi
}
# CHECK PREREQUISITES
function CheckPrerequisites() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
@ -111,8 +112,8 @@ function CheckPrerequisites() {
fi
}
# UPDATE THIS REPOSITORY
function UpdateRepository() {
### UPDATE THIS REPOSITORY
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
@ -153,20 +154,6 @@ function UpdateOperatingSystem() {
fi
}
# Add a pseudo-random delay of between 5 and 59 minutes
function RandomDelay() {
if [[ ${DELAY} = "true" ]] ; then
DELAY_TIME=`echo "(( 300 + ( $RANDOM + $RANDOM )) / 20 )" | bc`
DATE=`date`
echo -e ""
echo -e "\e[91m $ADSB_PROJECTTITLE"
echo -e ""
echo -en "\e[92m Pausing for ${DELAY_TIME} seconds from: \t\e[39m $DATE"
echo -e ""
sleep $DELAY_TIME
fi
}
RandomDelay
AptUpdate
CheckPrerequisites