Browse Source

implement download() and update config files

master
belliash 9 years ago
parent
commit
8e786ab16d
3 changed files with 50 additions and 0 deletions
  1. +11
    -0
      config/ezbuild.conf
  2. +11
    -0
      config/ezsync.conf
  3. +28
    -0
      libraries/filesystem

+ 11
- 0
config/ezbuild.conf View File

@ -1,3 +1,14 @@
# A time designation representing the time in seconds that you allow the connection to
# the server to take. This only limits the connection phase, once curl has connected
# this option is of no more use. Setting a timeout to 0 disables it altogether. Unless
# you know what you are doing, it is best not to change the default timeout settings.
FETCHTIMEOUT="180"
# Sets the number of times EzBuild will attempt to download files and retrieve portage
# and overlays before it exits with an error. This allows for a more successful retrieval
# without user intervention most times.
FETCHTRIES="3"
# Specifies where EzBuild will store everything that it builds, and also where it will
# put all its temporary files and caches.
TEMPDIR="/var/tmp/ezbuild"

+ 11
- 0
config/ezsync.conf View File

@ -1,3 +1,14 @@
# A time designation representing the time in seconds that you allow the connection to
# the server to take. This only limits the connection phase, once curl has connected
# this option is of no more use. Setting a timeout to 0 disables it altogether. Unless
# you know what you are doing, it is best not to change the default timeout settings.
FETCHTIMEOUT="180"
# Sets the number of times EzBuild will attempt to download files and retrieve portage
# and overlays before it exits with an error. This allows for a more successful retrieval
# without user intervention most times.
FETCHTRIES="3"
# Specifies where EzBuild will store everything that it builds, and also where it will
# put all its temporary files and caches.
TEMPDIR="/var/tmp/ezbuild"

+ 28
- 0
libraries/filesystem View File

@ -3,6 +3,34 @@
# Distributed under the terms of the GNU General Public License v3
#-------------------------------------------------------------------------------
# Downloads files into specified or current directory
# Parameters: %url% %directory%
#-------------------------------------------------------------------------------
function download() {
local DEST="${2}"
local FILENAME="${1##*/}"
local URL="${1}"
if isSet DEST; then
local DEST="${DEST}/${FILENAME}"
else
local DEST="./${FILENAME}"
fi
echo -ne " ${STAR_GREEN} ${FILENAME}: "
wget --progress=dot -c -t ${FETCHTRIES} -T ${FETCHTIMEOUT} -O "${DEST}" \
${URL} 2>&1 | grep --line-buffered "%" | sed -u -e "s/[\.\,]//g" | \
awk '{printf("\b\b\b\b%4s", $2)}'
local RESULT=${PIPESTATUS[0]}
echo -ne "\b\b\b\b"
if [[ ${RESULT} -ne 0 ]]; then
logOutput "Unable to download ${URL}! Exit code: ${RESULT}"
echo -e "${COLOR_RED}${COLOR_BOLD}ERROR${COLOR_WHITE}${COLOR_NORMAL}"
else
echo -e "${COLOR_GREEN}${COLOR_BOLD}DONE${COLOR_WHITE}${COLOR_NORMAL}"
fi
return ${RESULT}
}
#-------------------------------------------------------------------------------
# Creates all components of the specified directories
# Parameters: %directory%

Loading…
Cancel
Save