diff -ruN /usr/share/separator/functions- /usr/share/separator/functions --- /usr/share/separator/functions- 2005-08-30 18:30:14 +0400 +++ /usr/share/separator/functions 2005-10-17 03:52:56 +0400 @@ -56,6 +56,28 @@ } +copy_rpm() +{ + local SRC DST cachedir cachedfile + SRC=$1 + DST=$2 + if [ "${CACHEDIR:0:1}" = "/" ]; then + cachedir="$CACHEDIR" + else + cachedir="$WORKDIR/$CACHEDIR" + fi + if [ -z "$cachedir" ] || echo $i | egrep -qv '^(ftp|http):' ; then + curl $SRC -q -s -o $DST || return 1 + else + [ -d "$cachedir" ] || mkdir -p "$cachedir" + cachedfile="$cachedir/`basename $SRC`" + if [ ! -e "$cachedfile" ]; then + curl $SRC -q -s -o $cachedfile || return 1 + fi + cp -fp $cachedfile $DST || return 1 + fi +} + init_root() { local TMPDIR ROOT LANGS @@ -73,7 +95,7 @@ export LC_ALL=POSIX LANG=POSIX LANGUAGE=POSIX for i in $packages;do - if ! curl $i -q -s -o $ROOT/.in/`basename $i`;then + if ! copy_rpm $i $ROOT/.in/`basename $i`;then echo "Copy package `basename $i` failed !!!" exit 1 fi @@ -91,7 +113,7 @@ ROOT=$2 echo -n "getting packages for install " for i in `cat $packagesfile`;do - if ! curl $i -qs -o $ROOT/.in/`basename $i`;then + if ! copy_rpm $i $ROOT/.in/`basename $i`;then echo "Copy package `basename $i` failed !!!" exit 1 fi @@ -274,7 +296,7 @@ while read i do packagestatus "$INSTALLDIRS" `basename $i` $OUTDIR || continue - if ! curl $i -qs -o $INSTALLDIR/`basename $i`; then + if ! copy_rpm $i $INSTALLDIR/`basename $i`; then echo "Copy package $i to $INSTALLDIR/`basename $i` failed !!!" exit 1 fi