Scripts/get

From Organic Design wiki
  1. !/bin/sh

. config/options

NOGET=""

if [ -z "$1" ]; then

 for i in $PACKAGES/*; do
   GET=yes
   for j in $NOGET; do
     [ ${i##*/} = $j ] && GET=no break
   done
   if [ $GET = yes ]; then
     $SCRIPTS/get ${i#$PACKAGES/} || echo ""
   fi
 done
 exit 0

fi

mkdir -p $STAMPS_NOARCH/$1 STAMP=$STAMPS_NOARCH/$1/get

if [ -f $PACKAGES/$1/url ]; then

 if [ -f $STAMP ]; then
   [ ! $STAMP -ot $PACKAGES/$1/url -o $AUTOUPDATE = no ] && exit 0
   if [ $AUTOUPDATE = ask ]; then
     echo "Package $1 is not up to date."
     echo -n "Do you want to download an up to date version ? (y/n) "
     read UPDATE
     [ "$UPDATE" = y ] || exit 0
   fi
 fi
 $SCRIPTS/checkdeps get
 rm -f $STAMP
 printf "%${INDENT}c GET      $1\n" >&$SILENT_OUT
 export INDENT=$((${INDENT:-1}+$INDENT_SIZE))
 [ "$VERBOSE" != yes ] && WGET_OPT=-q
 mkdir -p $SOURCES/$1
 for i in `sed s%GEEXBOX_SRCS%$GEEXBOX_SRCS% $PACKAGES/$1/url`; do
   NBWGET=1
   until wget --passive-ftp -c $WGET_OPT -P $SOURCES/$1 $i; do
     NBWGET=$(($NBWGET+1))
     if [ $NBWGET -gt 10 ]; then
       echo -e "\nCant't get $1 sources : $i\n Try later !!"
       exit 1
     fi
   done
 done
 cp -p $PACKAGES/$1/url $STAMP
 rm -f $BUILD_BASE*/$STAMPS_NOARCH/$1/unpack
 rm -f $BUILD_BASE*/$STAMPS_NOARCH/$1/build

fi