Re: rpm --nodeps vs. yum/apt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi William, Cliff,

> And watch for arch specific packages (glibc, openssl, etc.).

 And multiple versions of the same package.

 Although I haven't set this up for Fedora yet I'll include my scripts to sort updates for RH 9.

 My directory setup is as follows:

(/data/RedHat/updates/9/SRPMS)
/data/RedHat/updates/9/athlon
/data/RedHat/updates/9/i386
/data/RedHat/updates/9/i586
/data/RedHat/updates/9/i686
/data/RedHat/updates/9/noarch

is the download tree.

(/data/RedHat/updates.sorted/9/SRPMS)
/data/RedHat/updates.sorted/9/athlon
/data/RedHat/updates.sorted/9/i386
/data/RedHat/updates.sorted/9/i586
/data/RedHat/updates.sorted/9/i686
/data/RedHat/updates.sorted/9/noarch

is where the latest versions of the packages are stored.

(/data/RedHat/updates.sorted/9/obsolete/SRPMS)
/data/RedHat/updates.sorted/9/obsolete/athlon
/data/RedHat/updates.sorted/9/obsolete/i386
/data/RedHat/updates.sorted/9/obsolete/i586
/data/RedHat/updates.sorted/9/obsolete/i686
/data/RedHat/updates.sorted/9/obsolete/noarch

is where obsolete updates are stored.

/data/RedHat/updates.sorted/9/Files.arch/athlon
/data/RedHat/updates.sorted/9/Files.arch/athlon/kernel
/data/RedHat/updates.sorted/9/Files.arch/i386
/data/RedHat/updates.sorted/9/Files.arch/i386/kernel
/data/RedHat/updates.sorted/9/Files.arch/i586
/data/RedHat/updates.sorted/9/Files.arch/i586/kernel
/data/RedHat/updates.sorted/9/Files.arch/i686
/data/RedHat/updates.sorted/9/Files.arch/i686/kernel
/data/RedHat/updates.sorted/9/Files.arch/kernel
/data/RedHat/updates.sorted/9/Files.arch/kernel/athlon
/data/RedHat/updates.sorted/9/Files.arch/kernel/i386
/data/RedHat/updates.sorted/9/Files.arch/kernel/i586
/data/RedHat/updates.sorted/9/Files.arch/kernel/i686
/data/RedHat/updates.sorted/9/Files.arch/noarch

are the directories from where I can issue the "rpm -Fv *.rpm". Ie, for my Athlon
I cd to .../Files.arch/athlon to freshen the system, for my Pentium 2 I cd to
.../Files.arch/i686. After that a cd to kernel to install the latest kernel.

 Note that these directories should all be on the same device since I use hard links.

 Here are the scripts (you can probably use "$(...)" where I use backticks ("`...`")):

 To get the latest updates via ftp (adjust the mirror and LOGFILE):

$ cat /data/RedHat/getupdates-9
#!/bin/sh
LOGFILE="/home/leonard/data/wget-RHupdates.log"

UPDATEDIR="/data/RedHat/updates"
FTPSITE="ftp://ftp.nluug.nl/site/ftp.redhat.com/redhat/linux/updates";

for dir in "athlon" "i386" "i586" "i686" "noarch" "SRPMS"
do
  cd ${UPDATEDIR}/9/${dir}
  wget --passive-ftp -a ${LOGFILE} -nc -t 3 ${FTPSITE}/9/en/os/${dir}/*
done


 To copy updates sorted by architecture to the updates.sorted tree:

$ cat /data/RedHat/sortupdates-9
#!/bin/sh
BASEPATH=/data/RedHat
if [ ! -d $BASEPATH ]; then
  echo "directory $BASEPATH does not exist"
  echo "aborting"
  exit
fi
if [ ! -d $BASEPATH/updates/9 ]; then
  echo "directory $BASEPATH/updates/9 does not exist"
  echo "aborting"
  exit
fi
if [ ! -d $BASEPATH/updates.sorted/9 ]; then
  echo "directory $BASEPATH/updates.sorted/9 does not exist"
  echo "aborting"
  exit
fi

cd $BASEPATH/updates.sorted/9
find . -type f | grep rpm | xargs -i rm {}

cd $BASEPATH/updates/9
find . -type f | grep -v SRPMS | grep rpm | xargs -i ln {} $BASEPATH/updates.sorted/9/{}

cd $BASEPATH/updates.sorted/9
./moveobsoletes9


 Move the obsolete packages to the obsolete tree (this script is called by the previous):

$ cat /data/RedHat/updates.sorted/9/moveobsoletes9
#!/bin/sh
# moveobsoletes
#
# Move obsolete binary packages to "obsolete" tree
#
# Sort files by version and move previous versions

for dir in "athlon" "i386" "i586" "i686" "noarch"
do
  for files in `ls -1 $dir | rev | cut -f 3- -d - | rev | uniq -d`
  do
    dummy=1
#    sort on date, *not* version (some versioning is done wrong)
#    this should work if you don't mess with the time stamps
    for file in `ls -1 -t $dir/$files-[0-9]* | grep ^$dir/$files-[0-9]'[^-]*'-[0-9]`
    do
      if [ $dummy != 1 ]; then
        if [ -f "obsolete/$dir/$file" ]; then
          echo "file: obsolete/$dir/$file already exists..."
        else
          mv "$file" "obsolete/$dir/"
        fi
      fi
      dummy=$[ $dummy + 1 ]
    done
  done
done


 Clear out the Files.arch tree:

$cat /data/RedHat/updates.sorted/cleanFiles
#!/bin/sh
if [ ! -d Files.arch ]; then
  exit
fi
cd Files.arch
find . -type f -exec rm {} \;
find . -type l -exec rm {} \;


 Sort files to the Files.arch tree:

$cat /data/RedHat/updates.sorted/linkfilesarch
#!/bin/sh

KERNARCHS="athlon i386 i586 i686"
MAINARCH="i386"
OTHERARCHS="athlon i586 i686"

cd /data/RedHat/updates.sorted/9

# Link noarch files to every architecture directory
cd noarch
  FILES=`find . -type f | cut -b 3-`
  for each in $FILES
  do
    echo "Hard linking noarch/$each "
    ln $each ../Files.arch/noarch/$each
   for arch in $KERNARCHS
   do
     echo "Soft linking noarch file to $arch/$each"
     ln -s ../noarch/$each ../Files.arch/$arch/$each
   done
  done
cd ..

# Link kernel files to architecture kernel directory
for arch in $KERNARCHS
do
  cd $arch
  FILES=`find . -type f -name "kernel-2*" -o -name "kernel-BOOT*" -o -name "kernel-smp*" | cut --b 3-`
  cd ..
  for file in $FILES
  do
    echo "Hard linking $arch kernel: $file"
    ln $arch/$file Files.arch/$arch/kernel/$file
    ln -s ../../$arch/kernel/$file Files.arch/kernel/$arch/$file
  done ;
done

# Hard link all i386 files except kernels to i386
cd i386
FILES=`find . -type f ! -name "kernel-2*" ! -name "kernel-BOOT*" ! -name "kernel-smp*" | cut -b 3- | sort`
cd ..
for file in $FILES
do
  echo "Hard linking i386 file: $file"
  ln i386/$file Files.arch/i386/$file
done

# Architecture specific files except kernels to architecture directory
# Other files from i386 to architecture directory
for arch in $OTHERARCHS
do
  cd $arch
  SKIPFILES=`find . -type ! -name "kernel-2*" ! -name -"kernel-BOOT*" ! -name "kernel-smp*" ! -name "kernel-unsup*" | rev | cut -f 3- -d \. | rev | cut -b 3-`
  cd ..
  for file in $FILES
  do
    tmp=$file
    skip=""
    for fileskip in $SKIPFILES
    do
      if [ "$tmp" == "$fileskip.i386.rpm" ]; then
        skip="$fileskip.$arch.rpm"
        break;
      fi
    done
    if [ "$skip" == "" ]; then
      echo "Soft linking i386/$file to $arch"
      ln -s ../i386/$file Files.arch/$arch/$file
    else
      echo "Architecture specific file $skip"
      ln $arch/$skip Files.arch/$arch/$skip
    fi
  done
done

./i686files


 And the code to sort the i686 rpm's:

$cat /data/RedHat/updates.sorted/9/i686files
#!/bin/sh

RPMDIR=/data/RedHat/updates.sorted/9
if [ ! -d $RPMDIR ]; then
  echo "RPM directory $RPMDIR does not exist"
  exit
fi

cd $RPMDIR/i686

FILES=$(find . -type f ! -name "kernel*" | rev | cut -f 3- -d \. | rev | cut -b 3-)
cd ..

cd Files.arch/i686

for FILE in $FILES
do
  if [ -f ${FILE}.i386.rpm ]; then
    rm ${FILE}.i386.rpm
  fi
  ln ../../i686/${FILE}.i686.rpm .
done

cd ../athlon

for FILE in $FILES
do
  if [ -f ${FILE}.i386.rpm ]; then
    rm ${FILE}.i386.rpm
  fi
  ln -s ../i686/${FILE}.i686.rpm .
done

cd ../..


 Hope this is of use to anyone :) .

Bye,
Leonard.

--
mount -t life -o ro /dev/dna /genetic/research




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux