From d2c5da66ea7a254e071d0ba04740d8e096f7ee8a Mon Sep 17 00:00:00 2001 From: Romeo-Golf Date: Thu, 22 Dec 2016 11:36:45 +0000 Subject: [PATCH] Move DELAY function to bash/functions.sh --- bash/functions.sh | 19 ++++++++++++++++++- bash/init.sh | 17 ++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/bash/functions.sh b/bash/functions.sh index dc87c96..f805a9a 100755 --- a/bash/functions.sh +++ b/bash/functions.sh @@ -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 +} diff --git a/bash/init.sh b/bash/init.sh index e0b3a48..8be4bb6 100755 --- a/bash/init.sh +++ b/bash/init.sh @@ -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