[Yum] Using a fast internet connexion to update a computer with a slow one

Enrique Perez-Terron enrio at online.no
Thu Aug 5 15:24:21 UTC 2004


On Wed, 2004-08-04 at 18:14, Satish Balay wrote:
> On Wed, 4 Aug 2004, Enrique Perez-Terron wrote:
> 
> > On Wed, 2004-08-04 at 06:46, Daniel Gagnon wrote:
> > > I was wondering if there was a way for a user of Fedora Core 2 with
> > > only a 56K modem to download update on a computer that have a
> > > broadband connexion (but unfortunately, Windows) and carry them (on
> > > CDs, probably) to the computer with the slow connexion.
> > > 
> > > And how can yum be used in the process ?
> > 
> > I suggest you use "yum list update" and then carry the listed rpms on a
> > CD.
> > 
> > However, it would be nice if yum had the option 
> >   yum list updates --with-dependencies
> 
> Actually you'll need something like '--dump-url-list' - which prints
> the urls for all required pacakges (perhaps into a file) - wich can
> be directly be fed to wget.
> 
> yum --dump-url-list upgrade

Could something like this do?

#!/bin/bash

# Simple way out for now
basearch=i386
releasever=2

# Expect "Exiting on user command." in /tmp/yum-errors
#while :; do echo n; done | yum update > /tmp/yum-data 2>/tmp/yum-errors

# The resulting list has a slash between name and version-release, and no ".rpm" 
rpm_list=$(sed -n 's/^\[\(install\|update\): \([^ ]*\) \(.*\)\]/\2\/\3/p' < /tmp/yum-data)

cd /var/cache/yum

# Determine what rpms are in what repo.
# Associate repo name with each repo
for repo in *
do
  [ -d "$repo" ] || continue
  pushd "$repo/headers" >/dev/null || continue
  for rpm in $rpm_list
  do

    # Some versions are of the form 0:2.6.6..., and some are not.
    # The files in headers directories have either 0- in front of the version,
    # or the colon changed into '-'.
    name=${rpm%/*}
    version=${rpm#*/}
    nogen=${version#[0-9]:}
    if [ "$nogen" = "$version" ]
    then
	[ -r $name-0-$version.hdr ] || continue
	rpm=$name-$version
    else
	gen=${version%:*}
	version=$nogen
	[ -r $name-$gen-$version.hdr ] || continue
	rpm=$name-$version
    fi

    # Newline embedded in the list. Do not indent!!
    repo_rpm_list="$repo_rpm_list
$repo/$rpm"
    continue		
  done
  popd >/dev/null
done

# From the config file, determine the baseurl's 
# associated with each repo
while read line
do
  : $line
  case "$line" in
  \[*)
    repo=${line#\[}
    repo=${repo%\]*}
    do_urls=true
    ;;
  baseurl\=*)
    [ "$do_urls" ] || continue
    url="${line#baseurl=}"
    eval "url=\"$url\""
    echo "$repo_rpm_list" |
    sed -n "s|^$repo/\(.*\)|$url/Fedora/RPMS/\1.rpm|p" >> /tmp/yum-url-list
    do_urls=
    ;;
  esac
done < /etc/yum.conf

-Enrique





More information about the Yum mailing list