[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/tools/ -> prepare (source)

   1  #!/bin/bash
   2  
   3  # Change to the scripts directory so paths are correct
   4  cd "$(dirname "$0")"/..
   5  
   6  # Do not download, only check validity of URL
   7  if [ "$1" == "--check-only" ]; then shift; SPIDER="--spider"; else SPIDER=""; fi
   8  
   9  
  10  # Default to ENU if nothing passed in as first arg
  11  if [ ".$1" == "." ]; then WINLANG="ENU"; else WINLANG="$1"; fi
  12  
  13  for cmdfile in `egrep -lri "URL\|($WINLANG|ALL)" scripts/$2`; do
  14  
  15    echo Processing $cmdfile
  16  
  17    # Look for URL|LANG in scripts/ + second arg
  18    for needed in `egrep -hri "URL\|($WINLANG|ALL)" $cmdfile | tr ' ' '~'`; do
  19        url=`echo -ne "$needed" | cut -d\| -f3 | tr '~' ' ' | perl -pe 's/[\r\n]//g;s/^ *//;s/ *$//'`
  20        file=`echo -ne "$needed" | cut -d\| -f4 | tr '~' ' '  | perl -pe 's/[\r\n]//g;s/^ *//;s/ *$//;s/([^\/]*\/*)$/lc($1)/eg'`
  21        path=`echo -ne "$file" | perl -pe 's#(.*/).*#$1#'`
  22  
  23        if [ ! "$SPIDER" == "" ]; then
  24          wget $SPIDER --passive-ftp "$url" ;
  25          continue
  26        fi
  27        # Make sure path is available
  28        mkdir -p "$path"
  29        # Download file if it doesn't exist
  30        if [ ! -f "$file" ] ; then
  31            if wget $SPIDER $WGET_OPS --passive-ftp -O "$file.$$.tmp" "$url" ; then
  32                mv "$file.$$.tmp" "$file"
  33            else
  34                rm -f "$file.$$.tmp"
  35            fi
  36        else
  37            touch "$file"
  38        fi
  39    done
  40  
  41  done


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1